Surfaces damage player or AI -- prl_deadlysurface.cog
Touching, walking, or falling on these surfaces cause repeated damage to players or AI. 14 February 2002

# Jedi Knight Cog Script
#
# prl_deadlysurface.cog
# Sylvicolus [PRL] 14 February 2002
#
# Surfaces damage anything that touches them, including AI.
#
# This cog is not supported by LucasArts Entertainment Co.

symbols

message	touched		
message	entered
message	exited   
message	timer

surface	surf0	mask=0x404
surface	surf1	mask=0x404
surface	surf2	mask=0x404
surface	surf3	mask=0x404
surface	surf4	mask=0x404
surface	surf5	mask=0x404
surface	surf6	mask=0x404
surface	surf7	mask=0x404
surface	surf8	mask=0x404

flex	maxdamage=30.0
flex	mindamage=10.0
sound	zap=forcelitning03.wav
flex	damage=0.0       local
thing	victim           local

end

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

code

entered:
	SetTimerEx(0.5, 1, 0, 0);
touched:
	victim = getsourceref();
	damage = (Rand()*(maxdamage - mindamage))+mindamage;
	DamageThing(victim, damage, 0x4, victim);
	PlaySoundPos(zap, GetThingPos(victim), 1.0, 1, 10, 0x80);
	return;

exited:
	KillTimerEx(1);
	return;

timer:  
	KillTimerEx(1);
	call entered;
	return;

end