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 → Complex force field cog
Complex force field cog
2005-11-04, 8:58 AM #1
I need a cog for a multiplayer level that will control force fields on 24 surfaces. The force fields will be on all the time unless someone enters one of six sectors. When someone is in one of those six sectors the force fields will deactivate. It would also be cool if the force field surfaces could run a continuous animated texture. I know this is somewhat complicated but it would be great if anyone will be willing to help me out here. It might sound crazy right now but once you've all seen what I'm using it for I think you'll really like it.
If curiosity killed the cat then perhaps Curious George killed the cat.
But Cat's do have nine lives so who knows?
2005-11-04, 2:05 PM #2
This one should work, but there is a strange error in the cog I cannot resolve at the moment...maybe someone else?
Code:
# complex_forcefield.cog
# 
# Controls 24 forcefield surfaces using 6 sectors as triggers
#
# Created by zagibu@gmx.ch

symbols

material	anim_material
flex		anim_speed=5

flex		damage_amount=10
int		damage_type=2
sound		damage_sound=forcefieldhit01.wav

sector		trigger_sec1=-1				mask=0x400	linkid=101
sector		trigger_sec2=-1				mask=0x400	linkid=101
sector		trigger_sec3=-1				mask=0x400	linkid=101
sector		trigger_sec4=-1				mask=0x400	linkid=101
sector		trigger_sec5=-1				mask=0x400	linkid=101
sector		trigger_sec6=-1				mask=0x400	linkid=101

int		adjoinflags_on=17
int		adjoinflags_off=0

surface		force_surf01=-1				mask=0x400	linkid=102
surface		force_surf02=-1				mask=0x400	linkid=102
surface		force_surf03=-1				mask=0x400	linkid=102
surface		force_surf04=-1				mask=0x400	linkid=102
surface		force_surf05=-1				mask=0x400	linkid=102
surface		force_surf06=-1				mask=0x400	linkid=102
surface		force_surf07=-1				mask=0x400	linkid=102
surface		force_surf08=-1				mask=0x400	linkid=102
surface		force_surf09=-1				mask=0x400	linkid=102
surface		force_surf10=-1				mask=0x400	linkid=102
surface		force_surf11=-1				mask=0x400	linkid=102
surface		force_surf12=-1				mask=0x400	linkid=102
surface		force_surf14=-1				mask=0x400	linkid=102
surface		force_surf15=-1				mask=0x400	linkid=102
surface		force_surf16=-1				mask=0x400	linkid=102
surface		force_surf17=-1				mask=0x400	linkid=102
surface		force_surf18=-1				mask=0x400	linkid=102
surface		force_surf19=-1				mask=0x400	linkid=102
surface		force_surf20=-1				mask=0x400	linkid=102
surface		force_surf21=-1				mask=0x400	linkid=102
surface		force_surf22=-1				mask=0x400	linkid=102
surface		force_surf23=-1				mask=0x400	linkid=102
surface		force_surf24=-1				mask=0x400	linkid=102

int		empty					local
int		lastempty				local
int		i					local
int		j					local

message		startup
message		touched
message		entered
message		exited
message		pulse
message		user0

end

# ========================================================================================

code

startup:
	// Wait a short while to make sure level is completely loaded
	Sleep(1);

	// Initialize variables
	empty = 1;
	lastempty = 0;

	// Start the material animation
	MaterialAnim(anim_material, anim_speed, 0x1);

	// Do an initial sector-check
	call user0;

	Return;

# ........................................................................................

touched:
	// Check if the message was sent from an interesting surface
	if(GetSenderId() != 102)
		Return;

	// Damage the player
	DamageThing(GetSourceRef(), damage_amount, damage_type, -1);

	// Play sparkling sound
	PlaySoundThing(damage_sound, GetSourceRef(), 1, 0, 10, 0);

	Return;
	
# ........................................................................................

entered:
	// Check if the message was sent from an interesting sector
	if(GetSenderId() != 101)
		Return;

	// Start sector-checking subroutine
	call user0;

	Return;

# ........................................................................................

exited:
	// Check if the message was sent from an interesting sector
	if(GetSenderId() != 101)
		Return;

	// Start sector-checking subroutine repeatedly
	SetPulse(0.1);

	Return;
	
# ........................................................................................

pulse:
	// Start sector-checking subroutine
	call user0;

	Return;

# ........................................................................................

user0:
	// Initialize emptycheck variable
	empty = 1;

	// Loop through all players
	for(i = 0; i < GetNumPlayers(); i = i + 1)
	{
		// Loop through all trigger sectors
		for(j = 0; j < 6; j = j + 1)
		{
			if(GetThingSector(GetPlayerThing(i)) == trigger_sec1[j])
				empty = 0;
		}
	}

	// Check if sectors are empty
	if(empty)
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				PrintInt(force_surf01);
				// Activate the force fields
				// Render the surfaces visible
				SetFaceGeoMode(force_surf01, 4);
				// Make the surfaces solid
				SetAdjoinFlags(force_surf01, adjoinflags_on);
				Sleep(1);
			}
		}

		// Stop the pulse
		SetPulse(0);
	}
	else
	{
		// Check if emptiness has changed
		if(empty != lastempty)
		{
			// Loop through all surfaces
			for(i = 0; i < 24; i = i + 1)
			{
				if(force_surf01 != -1)
				{
					// Deactivate the force fields
					// Render the surfaces invisible
					SetFaceGeoMode(force_surf01, 0);
					// Make the surfaces solid
					SetAdjoinFlags(force_surf01, adjoinflags_off);
				}
			}
		}
	}

	// Update trailing variable
	lastempty = empty;

	Return;

end

I'm not sure if the adjoinflags work at all...couldn't run a proper test...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-11-05, 1:51 PM #3
Thanks Zagibu.
I finnaly got my level to a point where I could test the cog out. It didn't quite work though. something weird happened. It was displaying all sorts of strange numbers in the strings. Some surfaces of the forcefield worked while others, you could walk straight through them. I'll give this cog a shot. I will just use the normal LEC animation cog instead of making that part of my cog. Hopefully we can figure out where the bugs are in your cog though. Thanks for all the help!
If curiosity killed the cat then perhaps Curious George killed the cat.
But Cat's do have nine lives so who knows?
2005-11-05, 3:54 PM #4
This should work now:
Code:
# complex_forcefield.cog
# 
# Controls 24 forcefield surfaces using 6 sectors as triggers
#
# Created by zagibu@gmx.ch

symbols

material	anim_material
flex		anim_speed=5

flex		damage_amount=10
int		damage_type=2
sound		damage_sound=forcefieldhit01.wav

sector		trigger_sec1=-1
sector		trigger_sec2=-1
sector		trigger_sec3=-1
sector		trigger_sec4=-1
sector		trigger_sec5=-1
sector		trigger_sec6=-1

int		adjoinflags_on=17
int		adjoinflags_off=0

surface		force_surf01=-1				mask=0x400	linkid=102
surface		force_surf02=-1				mask=0x400	linkid=102
surface		force_surf03=-1				mask=0x400	linkid=102
surface		force_surf04=-1				mask=0x400	linkid=102
surface		force_surf05=-1				mask=0x400	linkid=102
surface		force_surf06=-1				mask=0x400	linkid=102
surface		force_surf07=-1				mask=0x400	linkid=102
surface		force_surf08=-1				mask=0x400	linkid=102
surface		force_surf09=-1				mask=0x400	linkid=102
surface		force_surf10=-1				mask=0x400	linkid=102
surface		force_surf11=-1				mask=0x400	linkid=102
surface		force_surf12=-1				mask=0x400	linkid=102
surface		force_surf13=-1				mask=0x400	linkid=102
surface		force_surf14=-1				mask=0x400	linkid=102
surface		force_surf15=-1				mask=0x400	linkid=102
surface		force_surf16=-1				mask=0x400	linkid=102
surface		force_surf17=-1				mask=0x400	linkid=102
surface		force_surf18=-1				mask=0x400	linkid=102
surface		force_surf19=-1				mask=0x400	linkid=102
surface		force_surf20=-1				mask=0x400	linkid=102
surface		force_surf21=-1				mask=0x400	linkid=102
surface		force_surf22=-1				mask=0x400	linkid=102
surface		force_surf23=-1				mask=0x400	linkid=102
surface		force_surf24=-1				mask=0x400	linkid=102

int		empty					local
int		lastempty				local
int		i					local
int		j					local

message		startup
message		touched
message		pulse

end

# ========================================================================================

code

startup:
	// Wait a short while to make sure the level is completely loaded
	Sleep(1);

	// Initialize variables
	empty = 1;
	lastempty = 1;

	// Start the material animation
	MaterialAnim(anim_material, anim_speed, 0x1);

	// Start the sector check pulse
	SetPulse(0.2);

	Return;

# ........................................................................................

touched:
	// Check if the message was sent from an interesting surface
	if(GetSenderId() != 102)
		Return;

	// Damage the player
	DamageThing(GetSourceRef(), damage_amount, damage_type, -1);

	// Play sparkling sound
	PlaySoundThing(damage_sound, GetSourceRef(), 1, 0, 10, 0);

	Return;
	
# ........................................................................................

pulse:
	// Initialize emptycheck variable
	empty = 1;

	// Loop through all players
	for(i = 0; i < GetNumPlayers(); i = i + 1)
	{
		// Loop through all trigger sectors
		for(j = 0; j < 6; j = j + 1)
		{
			if(GetThingSector(GetPlayerThing(i)) == trigger_sec1[j])
				empty = 0;
		}
	}

	// Check if empty state has changed at all
	if(empty == lastempty)
		Return;

	// Are the sectors empty? Then activate the forcefields
	if(empty)
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				// Render the surfaces visible
				SetFaceGeoMode(force_surf01, 4);
				// Make the surfaces solid
				SetAdjoinFlags(force_surf01, adjoinflags_on);
			}
		}
	}
	// Sectors are not empty. So deactivate the forcefields
	else
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				// Render the surfaces invisible
				SetFaceGeoMode(force_surf01, 0);
				// Make the surfaces solid
				SetAdjoinFlags(force_surf01, adjoinflags_off);
			}
		}
	}

	// Update trailing variable
	lastempty = empty;

	Return;

end

I skipped force_surf13 in the first cog, resulting in an array-overbounds check, which returned the value of the next variable as a surface (empty). There where other problems, too, so I tried a simpler approach with the constant pulse. You still have to edit the proper adjoinflags (and make sure your forcefields are "on" as default, i.e. make them solid and geo4 and so on).
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-11-06, 8:59 AM #5
The updated cog seems like it pretty much works but I'm still having problems. It sets the geo to 0 after you enter the sector and sets it back to 4 when you exit but that seems to be the only thing changing when you go in and out of a trigger sector. It still won't let you pass the force field and it still damages you. I don't know if it is the cog or me not being able to get the flags right. I modified the cog so it will always play a buzz sound on a surface just for added effect. Here is the cog with the sound addition.

Code:
# complex_forcefield.cog
# 
# Controls 24 forcefield surfaces using 6 sectors as triggers
#
# Created by zagibu@gmx.ch

symbols

material	anim_material
flex		anim_speed=5

flex		damage_amount=10
int		damage_type=2
sound		damage_sound=forcefieldhit01.wav
sound           humsound=ForceFieldHum01.wav            local

sector		trigger_sec1=-1
sector		trigger_sec2=-1
sector		trigger_sec3=-1
sector		trigger_sec4=-1
sector		trigger_sec5=-1
sector		trigger_sec6=-1

int		adjoinflags_on=17
int		adjoinflags_off=0

surface         humsound_surf=-1                        mask=0x408
surface		force_surf01=-1				mask=0x400	linkid=102
surface		force_surf02=-1				mask=0x400	linkid=102
surface		force_surf03=-1				mask=0x400	linkid=102
surface		force_surf04=-1				mask=0x400	linkid=102
surface		force_surf05=-1				mask=0x400	linkid=102
surface		force_surf06=-1				mask=0x400	linkid=102
surface		force_surf07=-1				mask=0x400	linkid=102
surface		force_surf08=-1				mask=0x400	linkid=102
surface		force_surf09=-1				mask=0x400	linkid=102
surface		force_surf10=-1				mask=0x400	linkid=102
surface		force_surf11=-1				mask=0x400	linkid=102
surface		force_surf12=-1				mask=0x400	linkid=102
surface		force_surf13=-1				mask=0x400	linkid=102
surface		force_surf14=-1				mask=0x400	linkid=102
surface		force_surf15=-1				mask=0x400	linkid=102
surface		force_surf16=-1				mask=0x400	linkid=102
surface		force_surf17=-1				mask=0x400	linkid=102
surface		force_surf18=-1				mask=0x400	linkid=102
surface		force_surf19=-1				mask=0x400	linkid=102
surface		force_surf20=-1				mask=0x400	linkid=102
surface		force_surf21=-1				mask=0x400	linkid=102
surface		force_surf22=-1				mask=0x400	linkid=102
surface		force_surf23=-1				mask=0x400	linkid=102
surface		force_surf24=-1				mask=0x400	linkid=102

int		empty					local
int		lastempty				local
int		i					local
int		j					local

message		startup
message		touched
message		pulse

end

# ==================================================  ======================================

code

startup:
	// Wait a short while to make sure the level is completely loaded
	Sleep(1);

	// Initialize variables
	empty = 1;
	lastempty = 1;

	// Start the material animation
	MaterialAnim(anim_material, anim_speed, 0x1);

        PlaySoundPos(humsound, GetSurfaceCenter(humsound_surf), 1.5, 2.0, 10.0, 0x1);

	// Start the sector check pulse
	SetPulse(0.2);

	Return;

# ..................................................  ......................................

touched:
	// Check if the message was sent from an interesting surface
	if(GetSenderId() != 102)
		Return;

	// Damage the player
	DamageThing(GetSourceRef(), damage_amount, damage_type, -1);

	// Play sparkling sound
	PlaySoundThing(damage_sound, GetSourceRef(), 1, 0, 10, 0);

	Return;
	
# ..................................................  ......................................

pulse:
	// Initialize emptycheck variable
	empty = 1;

	// Loop through all players
	for(i = 0; i < GetNumPlayers(); i = i + 1)
	{
		// Loop through all trigger sectors
		for(j = 0; j < 6; j = j + 1)
		{
			if(GetThingSector(GetPlayerThing(i)) == trigger_sec1[j])
				empty = 0;
		}
	}

	// Check if empty state has changed at all
	if(empty == lastempty)
		Return;

	// Are the sectors empty? Then activate the forcefields
	if(empty)
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				// Render the surfaces visible
				SetFaceGeoMode(force_surf01, 4);
				// Make the surfaces solid
				SetAdjoinFlags(force_surf01, adjoinflags_on);
			}
		}
	}
	// Sectors are not empty. So deactivate the forcefields
	else
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				// Render the surfaces invisible
				SetFaceGeoMode(force_surf01, 0);
				// Make the surfaces solid
				SetAdjoinFlags(force_surf01, adjoinflags_off);
			}
		}
	}

	// Update trailing variable
	lastempty = empty;

	Return;

end
If curiosity killed the cat then perhaps Curious George killed the cat.
But Cat's do have nine lives so who knows?
2005-11-06, 9:25 AM #6
Well. It would be helful to know what kind of flags you have tried.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-11-06, 11:15 AM #7
I am using 4084 (impassable, no damage from fall and magsealed) for the surface flags. For the ajoin Flags I am using 15 (render past ajoin, doesn't block sound and impassable for player). I didn't use the passable flag on the ajoin flags because it won't reflect your lasers if passable is on for some reason. I think that the ajoin flags when the field is off should be 7 but I'm not positive. I hope that can help.
If curiosity killed the cat then perhaps Curious George killed the cat.
But Cat's do have nine lives so who knows?
2005-11-06, 12:03 PM #8
Okok, I've harcoded the adjon flags, so no more confusion arises. Here it is:
Code:
# complex_forcefield.cog
# 
# Controls 24 forcefield surfaces using 6 sectors as triggers
#
# Created by zagibu@gmx.ch

symbols

material	anim_material
flex		anim_speed=5

flex		damage_amount=10
int		damage_type=2
sound		damage_sound=forcefieldhit01.wav

sector		trigger_sec1=-1
sector		trigger_sec2=-1
sector		trigger_sec3=-1
sector		trigger_sec4=-1
sector		trigger_sec5=-1
sector		trigger_sec6=-1

surface		force_surf01=-1				mask=0x400	linkid=102
surface		force_surf02=-1				mask=0x400	linkid=102
surface		force_surf03=-1				mask=0x400	linkid=102
surface		force_surf04=-1				mask=0x400	linkid=102
surface		force_surf05=-1				mask=0x400	linkid=102
surface		force_surf06=-1				mask=0x400	linkid=102
surface		force_surf07=-1				mask=0x400	linkid=102
surface		force_surf08=-1				mask=0x400	linkid=102
surface		force_surf09=-1				mask=0x400	linkid=102
surface		force_surf10=-1				mask=0x400	linkid=102
surface		force_surf11=-1				mask=0x400	linkid=102
surface		force_surf12=-1				mask=0x400	linkid=102
surface		force_surf13=-1				mask=0x400	linkid=102
surface		force_surf14=-1				mask=0x400	linkid=102
surface		force_surf15=-1				mask=0x400	linkid=102
surface		force_surf16=-1				mask=0x400	linkid=102
surface		force_surf17=-1				mask=0x400	linkid=102
surface		force_surf18=-1				mask=0x400	linkid=102
surface		force_surf19=-1				mask=0x400	linkid=102
surface		force_surf20=-1				mask=0x400	linkid=102
surface		force_surf21=-1				mask=0x400	linkid=102
surface		force_surf22=-1				mask=0x400	linkid=102
surface		force_surf23=-1				mask=0x400	linkid=102
surface		force_surf24=-1				mask=0x400	linkid=102

int		empty					local
int		lastempty				local
int		i					local
int		j					local

message		startup
message		touched
message		pulse

end

# ========================================================================================

code

startup:
	// Wait a short while to make sure level is completely loaded
	Sleep(1);

	// Initialize variables
	empty = 1;
	lastempty = 1;

	// Start the material animation
	MaterialAnim(anim_material, anim_speed, 0x1);

	// Start the sector check pulse
	SetPulse(0.2);

	Return;

# ........................................................................................

touched:
	// Check if the message was sent from an interesting surface
	if(GetSenderId() != 102)
		Return;

	// Damage the player
	DamageThing(GetSourceRef(), damage_amount, damage_type, -1);

	// Play sparkling sound
	PlaySoundThing(damage_sound, GetSourceRef(), 1, 0, 10, 0);

	Return;
	
# ........................................................................................

pulse:
	// Initialize emptycheck variable
	empty = 1;

	// Loop through all players
	for(i = 0; i < GetNumPlayers(); i = i + 1)
	{
		// Loop through all trigger sectors
		for(j = 0; j < 6; j = j + 1)
		{
			if(GetThingSector(GetPlayerThing(i)) == trigger_sec1[j])
				empty = 0;
		}
	}

	// Check if empty state has changed at all
	if(empty == lastempty)
		Return;

	// Are the sectors empty? Then activate the forcefields
	if(empty)
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				// Render the surfaces visible
				SetFaceGeoMode(force_surf01, 4);
				// Make the surfaces solid
				ClearAdjoinFlags(force_surf01, 2);
			}
		}
	}
	// Sectors are not empty. So deactivate the forcefields
	else
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				// Render the surfaces invisible
				SetFaceGeoMode(force_surf01, 0);
				// Make the surfaces solid by clearing the "passable" flag
				SetAdjoinFlags(force_surf01, 2);
			}
		}
	}

	// Update trailing variable
	lastempty = empty;

	Return;

end

I've tested it with surf flags 4000 and adjoin flags 5 (in JED). The cog then just adds 2 to the adjoin flags to make the forcefields passable.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-11-06, 12:28 PM #9
Remove the impassable for player flag. That's unnecessary, and what would be causing the problem, most likely.
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-11-06, 2:50 PM #10
Thanks guys. I don't have time to test it right now but I'll get to it as soon as I can.
If curiosity killed the cat then perhaps Curious George killed the cat.
But Cat's do have nine lives so who knows?
2005-11-06, 6:05 PM #11
All ajoins seem to work fine now. It seems it has some sync issues though. For some reason the cog only works right on the host computer. On the guest computer some of the damage surfaces are on when the force fields are supposed to be off and vice versa.
If curiosity killed the cat then perhaps Curious George killed the cat.
But Cat's do have nine lives so who knows?
2005-11-06, 11:35 PM #12
I hate sync issues. No time today, maybe tomorrow.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-11-12, 11:48 AM #13
This is out of my head, and all I can do for you. I hope it works:
Code:
# complex_forcefield.cog
# 
# Controls 24 forcefield surfaces using 6 sectors as triggers
#
# Created by zagibu@gmx.ch

flags=0x240

symbols

material	anim_material
flex		anim_speed=5

flex		damage_amount=10
int		damage_type=2
sound		damage_sound=forcefieldhit01.wav

sector		trigger_sec1=-1
sector		trigger_sec2=-1
sector		trigger_sec3=-1
sector		trigger_sec4=-1
sector		trigger_sec5=-1
sector		trigger_sec6=-1

surface		force_surf01=-1				mask=0x400	linkid=102
surface		force_surf02=-1				mask=0x400	linkid=102
surface		force_surf03=-1				mask=0x400	linkid=102
surface		force_surf04=-1				mask=0x400	linkid=102
surface		force_surf05=-1				mask=0x400	linkid=102
surface		force_surf06=-1				mask=0x400	linkid=102
surface		force_surf07=-1				mask=0x400	linkid=102
surface		force_surf08=-1				mask=0x400	linkid=102
surface		force_surf09=-1				mask=0x400	linkid=102
surface		force_surf10=-1				mask=0x400	linkid=102
surface		force_surf11=-1				mask=0x400	linkid=102
surface		force_surf12=-1				mask=0x400	linkid=102
surface		force_surf13=-1				mask=0x400	linkid=102
surface		force_surf14=-1				mask=0x400	linkid=102
surface		force_surf15=-1				mask=0x400	linkid=102
surface		force_surf16=-1				mask=0x400	linkid=102
surface		force_surf17=-1				mask=0x400	linkid=102
surface		force_surf18=-1				mask=0x400	linkid=102
surface		force_surf19=-1				mask=0x400	linkid=102
surface		force_surf20=-1				mask=0x400	linkid=102
surface		force_surf21=-1				mask=0x400	linkid=102
surface		force_surf22=-1				mask=0x400	linkid=102

surface		force_surf23=-1				mask=0x400	linkid=102
surface		force_surf24=-1				mask=0x400	linkid=102

int		empty					local
int		lastempty				local
int		i					local
int		j					local

message		startup
message		touched
message		pulse
message		trigger

end

# ========================================================================================

code

startup:
	// Wait a short while to make sure level is completely loaded
	Sleep(1);

	// Initialize variables
	empty = 1;
	lastempty = 1;

	// Start the material animation
	MaterialAnim(anim_material, anim_speed, 0x1);

	// Start the sector check pulse
	SetPulse(0.2);

	Return;

# ........................................................................................

touched:
	// Check if the message was sent from an interesting surface
	if(GetSenderId() != 102)
		Return;

	// Send damage player trigger
	SendTrigger(-1, 13373, GetSourceRef(), -1, -1, -1);


	Return;
	
# ........................................................................................

pulse:
	// Initialize emptycheck variable
	empty = 1;

	// Loop through all players
	for(i = 0; i < GetNumPlayers(); i = i + 1)
	{
		// Loop through all trigger sectors
		for(j = 0; j < 6; j = j + 1)
		{
			if(GetThingSector(GetPlayerThing(i)) == trigger_sec1[j])
				empty = 0;
		}
	}

	// Check if empty state has changed at all
	if(empty == lastempty)
		Return;

	// Are the sectors empty? Then activate the forcefields
	if(empty)
		SendTrigger(-1, 13771, -1, -1, -1, -1);
	// Sectors are not empty. So deactivate the forcefields
	else
		SendTrigger(-1, 13772, -1, -1, -1, -1);

	// Update trailing variable
	lastempty = empty;

	Return;

# ........................................................................................

trigger:
	// Activation trigger
	if(GetSourceRef() == 13771)
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				// Render the surfaces visible
				SetFaceGeoMode(force_surf01, 4);
				// Make the surfaces solid by clearing the "passable" flag
				ClearAdjoinFlags(force_surf01, 2);
			}
		}
	}

	// Deactivation trigger
	if(GetSourceRef() == 13772)
	{
		// Loop through all surfaces
		for(i = 0; i < 24; i = i + 1)
		{
			if(force_surf01 != -1)
			{
				// Render the surfaces invisible
				SetFaceGeoMode(force_surf01, 0);
				// Make the surfaces passable
				SetAdjoinFlags(force_surf01, 2);
			}
		}
	}

	// Player damage trigger
	if(GetSourceRef() == 13773)
	{
		// Damage the player
		if(isServer())
			DamageThing(GetParam(0), damage_amount, damage_type, -1);

		// Play sparkling sound
		PlaySoundThing(damage_sound, GetParam(0), 1, 0, 10, 0);
	}

	Return;
end

If the damage is out of sync, try removing the if(isServer()) line and see if it works...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

↑ Up to the top!