I need a little help here. The code here takes a 2 switches and a adjoined surface. What it does is when 1 of the 2 switches is thrown it makes the adjoined floor disapear, having the effect of a retractable bridge... When the switch is shot it emits sparks and clicks... It also sends a msg saying switch broke... However. When one switch is shot the main switch(lack of better term) Emits sparks and clicks the other does nothing... I need to have the one that is shot spark and emit the sound while the other switch will still work.... heh, coged this so far... the rest is out of my knowledge of cog...I think its gonna have to have a get sender ref or something involved but I can't get anything to work... Anyhelp is appreciated...
------------------
"Look Beyond what you think, and then you will begin to learn." ~Chris Aires~
Code:
# Jedi Knight Cog Script # # Bridgecontrol.COG # Written by Chris Aires # Description # # # This Cog is Not supported by LucasArts Entertainment Co symbols message startup message activated message damaged message timer message pulse surface switch mask=0x408 surface switch2 surface changesurface surface changesurface2 int mode=0 local int isdamaged=0 local sound switchsound sound damagesound template sparks thing sparkspoint end code startup: SetFaceGeoMode(changesurface,0); ClearAdjoinFlags(changesurface,10); SetFaceGeoMode(changesurface2,0); ClearAdjoinFlags(changesurface2,10); SetSurfaceFlags(changesurface,1); SetSurfaceFlags(changesurface2,1); SetWallCel(switch,0); mode=0; Return; activated: if(isdamaged==1) { Print("Switch is damaged"); Return; } if(GetSenderRef()==switch) { PlaySoundPos(switchsound,SurfaceCenter(switch),.6,-1,-1,0); mode=mode+1; if(mode==3) mode=0; } if(GetSenderRef()==switch2) { mode=0; PlaySoundPos(switchsound,SurfaceCenter(switch2),.6,-1,-1,0); SetWallCel(switch2,1); Sleep(0.5); SetWallCel(switch2,0); } SetWallCel(switch,mode); if(mode==0) { SetFaceGeoMode(changesurface,0); ClearAdjoinFlags(changesurface,10); SetFaceGeoMode(changesurface2,0); ClearAdjoinFlags(changesurface2,10); SetSurfaceFlags(changesurface,1); SetSurfaceFlags(changesurface2,1); } if(mode==1) { SetFaceGeoMode(changesurface,0); SetAdjoinFlags(changesurface,10); SetFaceGeoMode(changesurface2,0); SetAdjoinFlags(changesurface2,10); ClearSurfaceFlags(changesurface,1); ClearSurfaceFlags(changesurface2,1); } if(mode==2) { SetFaceGeoMode(changesurface,4); ClearAdjoinFlags(changesurface,10); SetFaceGeoMode(changesurface2,4); ClearAdjoinFlags(changesurface2,10); SetSurfaceFlags(changesurface,1); SetSurfaceFlags(changesurface2,1); } Return; damaged: if(GetSenderRef()!=switch) Return; PlaySoundPos(damagesound,SurfaceCenter(switch),.6,-1,-1,0); SetWallCel(switch,3); isdamaged=1; SetTimer(10.0); SetPulse(Rand()+0.5); Print("Switch is damaged"); Return; timer: Print("Switch has been repaired"); SetPulse(0.0); isdamaged=0; SetWallCel(switch,0); Return; pulse: CreateThing(sparks,sparkspoint); PlaySoundPos(damagesound,SurfaceCenter(switch),.6,-1,-1,0); SetPulse(Rand()+0.5); Return; end
------------------
"Look Beyond what you think, and then you will begin to learn." ~Chris Aires~