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 → FF switch
FF switch
2000-11-24, 3:46 PM #1
I'm trying to use the switched FF cog from the D.L. section in my level. On start-up though the FF looks normal but does no damage when you walk into it. You press the switch and it "comes alive". ie does damage and makes the FF noise. You press again and it switches off. From then on all is normal. What I want is it to act like a FF right from the start. I dont know much cog. Thanks for any help.

------------------
La lova num botaffa
JK:DFII Editing
ALHan
PSP
2000-11-24, 6:39 PM #2
P.S. The cog works 100% if I have the force field OFF at start up. I want FF ON!
JK:DFII Editing
ALHan
PSP
2000-11-26, 6:57 AM #3
Post the code here. Should be easy.
KOP_blujay
Just dancin'...and singin'...in the Force.
2000-11-26, 10:29 PM #4
Here it is

# Jedi Knight Cog Script
#
# TJC_forcefield.cog
#
# generic switching forcefield.
# set geomodeff to 3 if the mat for the forcefield is single color, 4 if it is texture.
# Setting it wrong will crash the game!
#
# This cog not suported by LEC


symbols

message touched
message damaged
message timer
message activated

surface switch0
surface surf0 mask=0x408
surface surf1 mask=0x408

int victim=-1 local
int player=-1 local
int damaging=1 local
int active=0 local
int dummy local
int dummy1 local
int garbage local
int geomodeff
int activeono=0 local

flex maxDamage=10.0
flex minDamage=5.0
flex interval=0.25
flex minLight=0.2
flex maxLight=1.0
flex period=0.5

sound wav0=ForceFieldHum01.wav local
sound wav1=ForceFieldHit01.wav local
sound starwav=forcefieldon01.wav local
sound stopwav=forcefieldoff01.wav local
sound activate=activate02.wav local

template sparks=+heavysmoke local

end

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

code
# ........................................................................................

touched:
if (GetSenderRef() == switch0) Return;
if (active == 0)return;
if (damaging == 0) return;
victim = GetSourceRef();
damage = (Rand() * (maxDamage - minDamage)) + minDamage;
DamageThing(victim, damage, 0x2, victim); // self-inflicted damage

PlaySoundPos(wav1, GetSurfaceCenter(surf0), 0.5, 1, 10, 0);
if(!IsMulti()) CreateThing(sparks, victim);
damaging=0;
SetTimer(interval);
return;

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

damaged:
if(active == 0)return;
if(GetParam(1) == 1)
{
player=GetThingParent(GetSourceRef());
if(GetThingType(player) != 10) Return;

damage = (Rand()*(maxdamage - mindamage)) + mindamage;
DamageThing(player, damage, 0x01, player);
}
return;

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

timer:
damaging = 1;
return;

activated:
if (activeono == 1) return;
activeono = 1;
if (GetSenderRef() != switch0) Return;
garbage = PlaySoundPos(activate, GetSurfaceCenter(switch0), 1.5, 10, -1, 0);
if (active == 1){
active = 0;
garbage = SetWallCel(switch0, 1);
SetFaceGeoMode(surf0, 0x0);
ClearSurfaceFlags(surf0, 0x4000);
SetFaceGeoMode(surf1, 0x0);
ClearSurfaceFlags(surf1, 0x4000);
SetAdjoinFlags(surf1, 2);
SetAdjoinFlags(surf0, 2);

garbage = PlaySoundPos(stopwav, GetSurfaceCenter(surf0), 1.5, 10, -1, 0);
StopSurfaceAnim(surf0);
StopSurfaceAnim(surf1);
StopSound(dummy, 0);
StopSound(dummy1, 0);
sleep(2);
garbage = SetWallCel(switch0, 0);
activeono = 0;
return;
}
if (active == 0){
done = 1;
garbage = SetWallCel(switch0, 1);
active = 1;
SetFaceGeoMode(surf0,0x4);
SetSurfaceFlags(surf0,geomodeff);
ClearAdjoinFlags(surf0, 2);
SetFaceGeoMode(surf1,0x4);
SetSurfaceFlags(surf1,geomodeff);
ClearAdjoinFlags(surf1, 2);

garbage = PlaySoundPos(starwav, GetSurfaceCenter(surf0), 1.5, 10, -1, 0);
SurfaceLightAnim(surf0, minLight, maxLight, period);
SurfaceLightAnim(surf1, minLight, maxLight, period);
dummy = PlaySoundPos(wav0, GetSurfaceCenter(surf0), 0.75, 8, 15, 1);
dummy1 = PlaySoundPos(wav0, GetSurfaceCenter(surf1), 0.75, 8, 15, 1);
sleep(2);
garbage = SetWallCel(switch0, 0);
activeono = 0;
return;
}
return;
end

Thanks

------------------
La lova num botaffa
JK:DFII Editing
ALHan
PSP
2000-11-28, 11:24 AM #5
use the "startup"-message.
then type in all you want to be done at level-start. (setting adjoin-flags;...)

------------------
-eriamjh-
-eriamjh-

↑ Up to the top!