Author Topic: Help with brick specific hookshot  (Read 849 times)

I am trying to get the old LoZ hookshot to only hook onto bricks named "hookbrick" but don't know how do do it
I have 1 snippet of code here, If anyone is willing to do this for me or help me with it, that would be great.

Code: [Select]
if ( %col.getName() $= "_hookbrick" )I don't know what do do after this, cause I'm an amateur scripter.
Don't know where to put this in the hookshot code.

Thanks in advance

Add a check within here to see if the projectile hits a brick, and the brick has that specific name. Nvm did it for you, this goes in Weapon_Hookshot.cs, replacing the function on line 280.. (btw this is untested.)
Code: [Select]
function hookshotProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%player = %obj.client.player;
%pmount = %player.getObjectMount();

if (%col.getName() $= "_hookbrick")
{
if(isObject(%pmount))
{
if(%pmount.getClassName() $= "WheeledVehicle" || %pmount.getClassName() $= "AIplayer")
{
if(%col.getClassName() $= "Player" || %col.getClassName() $= "WheeledVehicle" || %col.getClassName() $= "FlyingVehicle" ||  %col.getClassName() $= "AIplayer")
{
pushPlayerToObj2(%pmount, %col);
}
else
{
pushPlayerToObj(%ppmount, %pos);
}
return;
}
}
}
}
« Last Edit: February 08, 2013, 05:44:29 PM by Honorabl3 »

Add a check within here to see if the projectile hits a brick, and the brick has that specific name. Nvm did it for you, this goes in Weapon_Hookshot.cs, replacing the function on line 280.. (btw this is untested.)
Code: [Select]
function hookshotProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%player = %obj.client.player;
%pmount = %player.getObjectMount();

if (%col.getName() $= "_hookbrick")
{
if(isObject(%pmount))
{
if(%pmount.getClassName() $= "WheeledVehicle" || %pmount.getClassName() $= "AIplayer")
{
if(%col.getClassName() $= "Player" || %col.getClassName() $= "WheeledVehicle" || %col.getClassName() $= "FlyingVehicle" ||  %col.getClassName() $= "AIplayer")
{
pushPlayerToObj2(%pmount, %col);
}
else
{
pushPlayerToObj(%ppmount, %pos);
}
return;
}
}
}
}

Hmm
The hookshot appears ingame
But does not grapple anything, even bricks named hookbrick

I just noticed the other IF's filtering it to work. Here is what I have right now, I will work on it later. (doesn't work)

Code: [Select]
function hookshotProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%player = %obj.client.player;
%pmount = %player.getObjectMount();

if(%col.getClassName() $= "fxDTSBrick" && %col.getname() $= "_hookbrick")
{
talk("Err");
pushPlayerToObj2(%pmount, %col);
}
}



Where's demain or someone that knows a lot about scripting to help me out with this
bump

If I really focused on this, I could complete it. It's just I have too much homework.

Never mind, I just finished it for you.

Replace this with the function on line 280.
Code: [Select]
function hookshotProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getClassName() $= "fxDTSBrick" && %col.getname() $= "_hookbrick")
pushPlayerToObj(%obj.client.player, %pos);
}
« Last Edit: February 10, 2013, 06:53:04 PM by Honorabl3 »

If I really focused on this, I could complete it. It's just I have too much homework.

Never mind, I just finished it for you.

Replace this with the function on line 280.
Code: [Select]
function hookshotProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%col.getClassName() $= "fxDTSBrick" && %col.getname() $= "_hookbrick")
pushPlayerToObj(%obj.client.player, %pos);
}
seems to break the hookshot; doesn't appear ingame
My bad, seems to be a syntax error in the code that I DIDN'T edit.
Fixed it up, works great :D
thanks
« Last Edit: February 10, 2013, 09:03:53 PM by Darksaber530 »