Getting these two cogs to work correctly in multiplayer is the only thing holding me back from completing my Great Wall of China CTF level. I will only post the catapult one for now because I have a few Ideas on how to get my rope climbing cog to work better. If I continue to have trouble with it then I'll post it as well.
Here is the catapult cog Zagibu wrote for me. It may have some modifications I've made but I think it is probably the original. The problems it has are 1: for some reason after two or three times of a player being launched by the catapult, the catapult moves forward, leaving the fire ghost behind it. 2: When the catapult does move forward on a host computer (even though it shouldn't) it doesn't move on the client computer. I corrected the movement problem using a 3do flicker cog but then the catapult wouldn't fire. I hope this info is helpful in debugging this cog. Attached is a test level with a gob and a jed project folder along with the cog below.
Here is the catapult cog Zagibu wrote for me. It may have some modifications I've made but I think it is probably the original. The problems it has are 1: for some reason after two or three times of a player being launched by the catapult, the catapult moves forward, leaving the fire ghost behind it. 2: When the catapult does move forward on a host computer (even though it shouldn't) it doesn't move on the client computer. I corrected the movement problem using a 3do flicker cog but then the catapult wouldn't fire. I hope this info is helpful in debugging this cog. Attached is a test level with a gob and a jed project folder along with the cog below.
Code:
symbols
keyframe animation
sound fire_sound
vector force
thing catapult
thing fire_ghost
thing player local
flex max_dist=0.1
flex dist_temp local
flex fire_sound_dist=2
int firing local
message startup
message entered
message trigger
end
code
startup:
// Initialize control variables
firing = 0;
Return;
entered:
// Return if another firing process is in the works
if(firing)
Return;
// Determine distance from toucher to fire_ghost
dist_temp = VectorDist(GetThingPos(GetSourceRef()), GetThingPos(fire_ghost));
// Only process positive distances
if(dist_temp < 0)
dist_temp = dist_temp * -1;
// Check if toucher is within range of fire_ghost
if(dist_temp - max_dist < 0)
SendTrigger(-1, 133799, GetPlayerNum(GetSourceRef()), -1, -1, -1);
Return;
trigger:
if(GetSourceRef() == 133799)
{
player = GetPlayerThing(GetParam(0));
// Activate the catapult
firing = 1;
// Detach the player from the catapult
DetachThing(player);
// Shoot the player
ApplyForce(player, force);
// Display the fire animation
PlayKey(catapult, animation, 0, 0x2);
// Play the fire sound
PlaySoundThing(fire_sound, catapult, 1.6, 0, fire_sound_dist * 10.5, 0x80);
// Wait until animation has stopped
Sleep(GetKeyLen(animation));
// Deactivate catapult
firing = 0;
}
Return;
endIf curiosity killed the cat then perhaps Curious George killed the cat.
But Cat's do have nine lives so who knows?
But Cat's do have nine lives so who knows?
