I'm working with a grapple hook in MotS - It seems to work just fine, except when I launch it, it only seems to go so far and land in mid air. Or if your close to a wall, or item then it might touch. Could anyone take a peek at it and see what is wrong please Thanks
----------------------------
symbols
keyframe fireAnim=kygrip0.key local
sound grapfireSound=grfire.wav local
sound graphitSound=grhit.wav local
sound grapretractSound=grretract.wav local
thing player local
template grap=+grapplehook local
int hooklanded=0 local
vector dir local
thing graphook local
int hook=0 local
message startup
message activated
message pulse
message newplayer
message stop_hook
end
# ========================================================================================
code
startup:
player = GetLocalPlayerThing();
SetPulse(0);
call stop_hook;
Return;
# .....................................
activated:
player = GetSourceRef();
if(hook)
{
PlaySoundThing(grapretractSound, player, 1.0, -1.0, -1.0, 0x80);
Print("Grapple Retracted");
call stop_hook;
return;
}
else
{
graphook = FireProjectile(player, grap, grapfireSound, 75, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
Print("Grapple Deployed");
hook=1;
SetPulse(0.1);
}
Return;
# .....................................
pulse:
if(hooklanded == 0)
{
if((GetThingAttachFlags(graphook) != 0) || (IsThingMoving(graphook) == 0))
{
hooklanded = 1;
PlaySoundThing(graphitSound, player, 1.0, -1.0, -1.0, 0x80);
Print("Hook Attached");
}
}
else
{
if(GetThingHealth(graphook) == 0)
{
call stop_hook;
return;
}
dir = VectorScale(VectorNorm(VectorSub(GetThingPos(graphook), GetThingPos(player))), 40);
DetachThing(player);
ClearPhysicsFlags(player, 0x1);
ApplyForce(player, dir);
}
Return;
# ........................................................................................
newplayer:
call stop_hook;
Return;
# ........................................................................................
stop_hook:
SetPulse(0);
if(graphook)
{
DestroyThing(graphook);
}
hook = 0;
hooklanded = 0;
SetPhysicsFlags(player, 0x1);
Return;
end
------------------------------------
------------------
Generation Knights - for MotS
( http://viper-studios.clanpages.com/ )
------------------------
----------------------------
symbols
keyframe fireAnim=kygrip0.key local
sound grapfireSound=grfire.wav local
sound graphitSound=grhit.wav local
sound grapretractSound=grretract.wav local
thing player local
template grap=+grapplehook local
int hooklanded=0 local
vector dir local
thing graphook local
int hook=0 local
message startup
message activated
message pulse
message newplayer
message stop_hook
end
# ========================================================================================
code
startup:
player = GetLocalPlayerThing();
SetPulse(0);
call stop_hook;
Return;
# .....................................
activated:
player = GetSourceRef();
if(hook)
{
PlaySoundThing(grapretractSound, player, 1.0, -1.0, -1.0, 0x80);
Print("Grapple Retracted");
call stop_hook;
return;
}
else
{
graphook = FireProjectile(player, grap, grapfireSound, 75, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
Print("Grapple Deployed");
hook=1;
SetPulse(0.1);
}
Return;
# .....................................
pulse:
if(hooklanded == 0)
{
if((GetThingAttachFlags(graphook) != 0) || (IsThingMoving(graphook) == 0))
{
hooklanded = 1;
PlaySoundThing(graphitSound, player, 1.0, -1.0, -1.0, 0x80);
Print("Hook Attached");
}
}
else
{
if(GetThingHealth(graphook) == 0)
{
call stop_hook;
return;
}
dir = VectorScale(VectorNorm(VectorSub(GetThingPos(graphook), GetThingPos(player))), 40);
DetachThing(player);
ClearPhysicsFlags(player, 0x1);
ApplyForce(player, dir);
}
Return;
# ........................................................................................
newplayer:
call stop_hook;
Return;
# ........................................................................................
stop_hook:
SetPulse(0);
if(graphook)
{
DestroyThing(graphook);
}
hook = 0;
hooklanded = 0;
SetPhysicsFlags(player, 0x1);
Return;
end
------------------------------------
------------------
Generation Knights - for MotS
( http://viper-studios.clanpages.com/ )
------------------------