Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → A Simple Trap Cog Request
A Simple Trap Cog Request
2005-11-21, 10:13 AM #1
I would like a thrust trap for Multi-player Deathmatch. When one of four pressure plates is trod on, a sound is played (so that everyone in the game can hear it), the forcefield is deactivated, and any player in one of 5 designated sectors is shot upwards at a very high speed.

Because the forcefield is deactivated, they shoot past it, and are killed by the impact of a ceiling above them. Keep in mind that AS LONG AS one or more players are standing on any or all of the four pressure plates, the reactor is shooting upwards, the sound is playing, and the forcefield is deactivated. As soon as the players move off the surface(s) the forcefield is reactivated and everything returns to normal.

This trap needs to work for Multiplayer, so I suppose I need both a client and server cog? Thanks. :)
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-11-21, 11:00 AM #2
m4_reactorthrust.cog does most of this. It works with switches instead of pressure plates and doors instead of forcefields. You may want to adapt that one. Also, it's for MP. (It's the Bespin Mining Station thrust trap) It also plays an alarm sound and has a light-effect for warning.

Hope this helps :)
ORJ / My Level: ORJ Temple Tournament I
2005-11-21, 11:23 AM #3
Thanks JoS, I did know of that cog, but I really need the pressure plates, and a forcefield instead of the doors. I don't know enough about cog to modify it myself, so I'm still dependent on some kind cogging soul, I'm afraid... :(
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-11-22, 6:18 AM #4
Well, I'm no cogger either, but as far as I know, for pressure-plates, you simply need to change the 'activated' message to 'touched' for the switch surface(s).

I'm sure someone will want to implement your forcefields... it's much less work to adapt that existing cog than to make a new cog from scratch. (I think - but I'm no cogger).

I'm sure someone will want to help you, it shouldn't be too hard for a 'real' cogger. :)
ORJ / My Level: ORJ Temple Tournament I
2005-11-22, 9:51 PM #5
No worries everyone, PhantomCoder has kindly made me the cog. You can see it in action in my hub contest level soon. ;)
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-11-23, 5:55 AM #6
Don't forget to post it here when it's done! :D
ORJ / My Level: ORJ Temple Tournament I
2005-11-23, 8:57 AM #7
Thanks for reminding me JoS. Here's the cog. It's free for public use, just remember to credit PhantomCoder for making it:

Code:
# JK Trap

symbols

flex		ThrustSpeed			desc=Thrust_Speed
surface		Plate				desc=Plate0
surface		Plate1				desc=Plate1
surface		Plate2				desc=Plate2
surface		Plate3				desc=Plate3

surface		ForceField			desc=ForceField_Surf

sector		ThrustSec			desc=Thrust_Sector0
sector		ThrustSec1			desc=Thrust_Sector1
sector		ThrustSec2			desc=Thrust_Sector2
sector		ThrustSec3			desc=Thrust_Sector3
sector		ThrustSec4			desc=Thrust_Sector4

sound		LoopSound			desc=Loop_Sound
sound		OnPlate				desc=On_Plate_Sound
sound		OffPlate			desc=Off_Plate_Sound

int			InCount=0				local
int			TrapOn=0			local

message		startup
message		entered
message		exited


end

code

startup:

	InCount=0;
	TrapOn=0;

	ClearAdjoinFlags(ForceField, 0x2);

return;

entered:

	if(GetSenderType() != 6) return;

	InCount=InCount+1;

	PlaySoundPos(OnPlate, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);

	if(InCount > 0 && TrapOn == 0)
	{
		//Play Sound
		Channel=PlaySoundGlobal(LoopSound, 1, 0, 0x101); 

		//Deactivate Field
		SetAdjoinFlags(ForceField, 0x2);
		SetFaceGeoMode(ForceField, 0);

		//Thrust Sectors Upwards
		// unattach all players in sectors
		for(x=0; x<5; x=x+1)
		{
			SetSectorThrust(ThrustSec[x], '0 0 1', ThrustSpeed);
			currentThing = FirstThingInSector(ThrustSec[x]);
			while (currentThing != -1)
			{
				call reactorpull;
				currentThing = NextThingInSector(currentThing);
			}
		}	
		TrapOn=1;
	}
	
return;

exited:

	if(GetSenderType() != 6) return;

	InCount=InCount-1;

	PlaySoundPos(OffPlate, SurfaceCenter(GetSenderRef()), 1, -1, -1, 0);

	if(InCount == 0 && TrapOn)
	{
		//Stop Sound
		StopSound(Channel, 0); 
		//Activate Field
		ClearAdjoinFlags(ForceField, 0x2);
		SetFaceGeoMode(ForceField, 4);
		//Stop Thrust Sectors
		for(x=0; x<5; x=x+1)
		{SetSectorThrust(ThrustSec[x], '0 0 1', 0);}
		
		TrapOn=0;
	}

return;

reactorpull:

	if (GetThingType(currentThing) == 10)
	{
		DetachThing(currentThing);
		playerVec = GetThingVel(currentThing);
		playerVec = VectorAdd(vec0, playerVec);
		SetThingVel(currentThing, playerVec);
	}
	return;

end
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels

↑ Up to the top!