My Cliff Hanger System is a little editing system for JK levels that allows you to grab ledges and pull yourself up. Originally, it just bounced you up onto the ledge, along with an external KEY. I've since expanded upon it, but I have problems...I want to make it so you can grab the ledge and stay there till you pull yourself up. No problem. Got all that working fine. You just press crouch to jump up (there's no IsThingJumping() cog line in JK, so it needs to be crouch). Now, the problem is the external KEYs. While your frozen, hanging, the COG plays a looping KEY of the player hanging and swaying. But when you pull yourself up, and when it plays the climb up animation, it works, but afterwards the hang animation is still on! As you can see below, I've tried StopThing(player) and StopAnim(Hang_Anim), also I've tried StopKey(), and a butt load of flags and tweaking. Still no luck. The closest I got was replacing the climb anim with the hang anim, which played it once w/o looping. After that one time it stopped and all was normal, but it looked like crap for those 2 seconds of animating.
Here's the COG:
# Jedi Knight COG Script
#
# cliffhanger.cog
#
# Created by Emon. E-Mail: emon@ejm.i-p.com OR emon@coruscant.net - Zone: EJM_Emon
#
# Enables the player to jump and grab onto ledges. Uses thrusts to move the player.
# Additional KEY is not required, all though looks nice. Triggered by surfaces.
#
#
# This COG is not supported by LucasArts Entertainment Co.
flags=0x240
symbols
thing player local
keyframe Climb_Anim=cliffclimb.key
keyframe Hang_Anim=cliffhang.key
surface Ledge
vector upVel local
vector newVel local
vector playerVel local
int PopupSpeed=2
int PulseCheck=0 local
message touched
message pulse
end
# ========================================================================================
code
touched:
PulseCheck=0;
If(GetThingHealth(player) == 0) Return;
PlayKey(player, Hang_Anim, 1, 0x0); // Play looping hanging KEY.
Print("You touched the ledge."); // Debug tool. Prints a message letting you know you touched the trigger surface.
SetPulse(.1);
SetThingVel(player, 0.0, 0.0, 0.0); // Stop player movement.
ClearPhysicsFlags(player, 0x1); // Take away gravity.
SetActorFlags(0x40000); // Take away movement.
Return;
pulse:
If (PulseCheck == 1) Return;
If(GetThingHealth(player) == 0)
{
SetPhysicsFlags(player, 0x1);
ClearActorFlags(0x40000);
}
If(IsThingCrouching(player))
{
PulseCheck=1;
Print("You are crouching.");
StopAnim(Hang_Anim);
StopThing(player);
PlayKey(player, Climb_Anim, 1, 0x38); // Play climb up KEY.
SetPhysicsFlags(player, 0x1);
ClearActorFlags(player, 0x40000);
upVel = VectorSet(0.0, 0.0, PopupSpeed);
playerVel = GetThingVel(player);
newVel = VectorAdd(upVel, playerVel);
DetachThing(player);
SetThingVel(player, newVel);
Print("You climbed the ledge."); // Debug tool. Prints a message letting you know your climb was successful.
}
Return;
end
I've tried everything...from flags to PlayMode(), and nothing seems to work. I originally was going to uss alternating PUPs with ParseArg(player, "puppet=ky_hang.pup") but I wanted this to be fully compatible with mods like Spork, where sometimes your using a pup other than KY. This becomes a problem because if your using the lightstaff, and when the Cliff Hanger COG resets the pup, it'll reset the wrong one.
If anyone knows how to fix this in ANY way, of if you have ANY help at all, PLEASE respond!
Here's the COG:
# Jedi Knight COG Script
#
# cliffhanger.cog
#
# Created by Emon. E-Mail: emon@ejm.i-p.com OR emon@coruscant.net - Zone: EJM_Emon
#
# Enables the player to jump and grab onto ledges. Uses thrusts to move the player.
# Additional KEY is not required, all though looks nice. Triggered by surfaces.
#
#
# This COG is not supported by LucasArts Entertainment Co.
flags=0x240
symbols
thing player local
keyframe Climb_Anim=cliffclimb.key
keyframe Hang_Anim=cliffhang.key
surface Ledge
vector upVel local
vector newVel local
vector playerVel local
int PopupSpeed=2
int PulseCheck=0 local
message touched
message pulse
end
# ========================================================================================
code
touched:
PulseCheck=0;
If(GetThingHealth(player) == 0) Return;
PlayKey(player, Hang_Anim, 1, 0x0); // Play looping hanging KEY.
Print("You touched the ledge."); // Debug tool. Prints a message letting you know you touched the trigger surface.
SetPulse(.1);
SetThingVel(player, 0.0, 0.0, 0.0); // Stop player movement.
ClearPhysicsFlags(player, 0x1); // Take away gravity.
SetActorFlags(0x40000); // Take away movement.
Return;
pulse:
If (PulseCheck == 1) Return;
If(GetThingHealth(player) == 0)
{
SetPhysicsFlags(player, 0x1);
ClearActorFlags(0x40000);
}
If(IsThingCrouching(player))
{
PulseCheck=1;
Print("You are crouching.");
StopAnim(Hang_Anim);
StopThing(player);
PlayKey(player, Climb_Anim, 1, 0x38); // Play climb up KEY.
SetPhysicsFlags(player, 0x1);
ClearActorFlags(player, 0x40000);
upVel = VectorSet(0.0, 0.0, PopupSpeed);
playerVel = GetThingVel(player);
newVel = VectorAdd(upVel, playerVel);
DetachThing(player);
SetThingVel(player, newVel);
Print("You climbed the ledge."); // Debug tool. Prints a message letting you know your climb was successful.
}
Return;
end
I've tried everything...from flags to PlayMode(), and nothing seems to work. I originally was going to uss alternating PUPs with ParseArg(player, "puppet=ky_hang.pup") but I wanted this to be fully compatible with mods like Spork, where sometimes your using a pup other than KY. This becomes a problem because if your using the lightstaff, and when the Cliff Hanger COG resets the pup, it'll reset the wrong one.
If anyone knows how to fix this in ANY way, of if you have ANY help at all, PLEASE respond!
Bassoon, n. A brazen instrument into which a fool blows out his brains.