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 → The bridge is out... (Cog help needed.)
The bridge is out... (Cog help needed.)
2001-07-16, 2:26 PM #1
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...


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~
2001-07-17, 4:20 PM #2
Ive seen and used a client/sever cog that does something like that...but it didnt have sparks. Sparks could be added easily. I cant remember the name of the level...but I know it was MotS multiplayer, and the author was Stawzie.
2001-07-18, 7:33 AM #3
Heh, im working with jk, i dunno if the mots cog would work for it..

------------------
"Look Beyond what you think, and then you will begin to learn." ~Chris Aires~
2001-07-18, 12:33 PM #4
First of all, why do you only have TWO adjoins? That would be an ugly bridge. Flat, just 2 adjoins...you should use a 3do and move it like a door. It wouldn't look very nice if you shot a panel and the bridge just disappeared.

Try to look for that MotS cog..chances are it WILL work in JK. I couldn't imagine a bridge COG using any new MotS cog verbs...that stuff is the same (basic stuff).
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2001-07-18, 1:37 PM #5
Well, there is A point for the 2 adjoins...

Im using it as a way into a secret area,,, the bridge can be turned on or off...

------------------
"Look Beyond what you think, and then you will begin to learn." ~Chris Aires~

↑ Up to the top!