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 → whats wrong here?
whats wrong here?
2003-02-03, 5:02 AM #1
This cog wont work:| why?

Code:
# Jedi Knight Cog Script#
# CompDoor.COG
#
# 
# 
# EH_AceCSF
# This Cog is Not supported by LucasArts Entertainment Co

symbols

thing       door      nolink
thing       fueltank      nolink
thing       camera                             desc=camera_door     
thing       camera1                             desc=camera_wall     
Thing       wall        linkid=2
surface     switch      linkid=1
sound       activate 
sound       blow 

message      activated
message      removed    
message	     startup
flex         delay=1.5                          desc=delay                    

int          old_camera                         local                         
int          player                             local                         
int          active=0                           local                         

int         status=0 local

end

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

code
startup:
player=jkGetLocalPlayer();

activated:
   if ((GetSenderId() == 1) && (active == 0))

   {
      PlaySoundLocal(activate, 1, 0, 0);
      SetActorFlags(player, 0xa00000);
      old_camera = GetCurrentCamera();
      SetCurrentCamera(0);
      SetCameraFocus(0, camera);
      PlaySoundLocal(activated, 1, 0, 132);
      sleep(1,0);
      movetoframe(door, 1, 5);
      Print("Stormtroops! i need to find other way..");
      sleep(delay);
      SetCameraFocus(0, camera1);
      Print("hmm..");
      sleep(delay);
      ClearActorFlags(player, 0xa00000);
      SetCameraFocus(0, player);
      SetCurrentCamera(old_camera);
      active = 1;
   }
return;

removed:

if (GetSenderRef() != fueltank) Return;
{
      PlaySoundLocal(blow, 1, 0, 0);
      movetoframe(wall, 1, 5);
      active = 2;
}
return;

end


[This message has been edited by EH_AceCSF (edited February 03, 2003).]
2003-02-03, 5:31 AM #2
I take it you cut & pasted this thing together....

Code:
# Jedi Knight Cog Script by Swanny
#
# CompDoor.COG
#
# EH_AceCSF, GBK

symbols

thing door
thing fueltank
thing camera
thing camera1
Thing wall linkid=2
surface switch linkid=1
sound Beep	#Never, NEVER declare a variable with the name of a message.
sound blow

message activated
message removed
message startup
flex delay=1.5

int old_camera local
Thing player local
int active=0 local

end

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

code
startup:
player=jkGetLocalPlayer();
Stop;		//Its always good to have these...

activated:
if (GetSenderId() == 1 && active == 0) {
PlaySoundLocal(Beep, 1, 0, 0);
SetActorFlags(player, 0xa00000);
old_camera = GetCurrentCamera();
SetCurrentCamera(0);
SetCameraFocus(0, camera);
PlaySoundLocal(Beep, 1, 0, 0);  //0x84?  WTF?  Those only have affect on thingsounds.
sleep(1.0);	//Commas are a killer.
movetoframe(door, 1, 5);
Print("Stormtroops! i need to find other way..");
sleep(delay);
SetCameraFocus(0, camera1);
Print("hmm..");
sleep(delay);
ClearActorFlags(player, 0xa00000);
SetCameraFocus(0, player);
SetCurrentCamera(old_camera);
active = 1;
}
return;

removed:

if (GetSenderRef() != fueltank) Return;

PlaySoundLocal(blow, 1, 0, 0);
movetoframe(wall, 1, 5);
active = 2;
return;

end


It is untested, but Parsec likes it. Be more careful when copying code from other cogs...
And when the moment is right, I'm gonna fly a kite.
2003-02-03, 7:29 AM #3
thx
2003-02-03, 8:01 AM #4
one more, can you check this cog:
Code:
# Jedi Knight Cog Script
#
# r2control.COG
#
# Puzzle involving the r5 opening a door and moving.
# 
# EH_AceCSF
# This Cog is Not supported by LucasArts Entertainment Co

symbols

thing       generator1   nolink
thing       generator2   nolink
surface       swith        linkid=2  
thing       r2door1      nolink
thing       r2door2      nolink
thing       ghost1a      nolink
thing       ghost1b      nolink
thing       ghost2      nolink
thing       ghost3      nolink
thing       door1      linkid=1
#surface     switch1      nolink
#surface     switch2      nolink
#surface     switch3      nolink
#surface     switch4      nolink
sound       beep
sound       r2sound   
message     activated
#message     pulse
#message     killed
#message     touched
int         r2=-1   local         
template    r2templete
int         status1=0 local
int         status2=0
int         status3=0 local
int         status4=0 local
flex        doorspeed
sector      doorsec1           nolink

end

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

code

activated:

if(GetSenderId() == 1)
{

MovetoFrame(door1, 1, doorspeed);
sleep(10);
MovetoFrame(door1, 0, doorspeed);

}
Return;

if((GetSenderId() == 2) && (status1 == 0) && (status2 == 0))
{
PlaySoundLocal(beep,1,0,0x0);
status1 = 1;
r5=CreateThing(r2templete,generator1);
CaptureThing(r2);
sleep(1);
call movedroid1;
}
return;

if((GetSenderId() == 2) && (status1 == 0) && (status2 == 1))
{
PlaySoundLocal(beep,1,0,0x0);
status1 = 1;
r5=CreateThing(r2templete,generator2);
CaptureThing(r2);
sleep(1);
call movedroid2;
}
return;

if((GetSenderId() == 2) && (status1 == 0) && (status2 > 1))
Print("cog is broken.. Ending script");
stop;

#========================================================================================
movedroid1:
{
#setpulse(0.001);
AISetMoveThing(r2,ghost1a);
AISetLookPos(r2,GetThingPos(ghost1a));
AISetMode(r2,0x202);
call movedroid3;
}
#========================================================================================
movedroid1:
{
#setpulse(0.001);
AISetMoveThing(r2,ghost1b);
AISetLookPos(r2,GetThingPos(ghost1b));
AISetMode(r2,0x202);
call movedroid3;
}
#=====================================================================================
movedroid3;
{
AISetMoveThing(r2,ghost2);
AISetLookPos(r2,GetThingPos(ghost2));
AISetMode(r2,0x202);
sleep(5);
AISetMoveThing(r2,ghost3);
AISetLookPos(r2,GetThingPos(ghost3));
}
#========================================================================================

#killed:

#status2=0;
#return;

#touched:

#if(status==0 && GetThingSector(r5) == doorsec)
#{
#status2=1;
#return;
#}

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

end


its still not completed, so some orders were disable #.
2003-02-03, 10:03 AM #5
[http://forums.massassi.net/html/eek.gif]

Code:
# Jedi Knight Cog Script
#
# r2control.COG
#
# Puzzle involving the r5 opening a door and moving.
# 
# EH_AceCSF
# This Cog is Not supported by LucasArts Entertainment Co

symbols

thing generator1 nolink
thing generator2 nolink
surface swith linkid=2
thing r2door1 nolink
thing r2door2 nolink
thing ghost1a nolink
thing ghost1b nolink
thing ghost2 nolink
thing ghost3 nolink
thing door1 linkid=1
#surface switch1 nolink
#surface switch2 nolink
#surface switch3 nolink
#surface switch4 nolink
sound beep
sound r2sound
message activated
#message pulse
#message killed
#message touched
int r2=-1 local
template r2templete
int status1=0 local
int status2=0
int status3=0 local
int status4=0 local
flex doorspeed
sector doorsec1 nolink

end

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

code

activated:

if(GetSenderId() == 1)
{

MovetoFrame(door1, 1, doorspeed);
sleep(10);
MovetoFrame(door1, 0, doorspeed);

}

if((GetSenderId() == 2) && (status1 == 0) && (status2 == 0))
{
PlaySoundLocal(beep,1,0,0x0);
status1 = 1;
r2=CreateThing(r2templete,generator1);
CaptureThing(r2);
sleep(1);
call movedroid1;
}

if((GetSenderId() == 2) && (status1 == 0) && (status2 == 1))
{
PlaySoundLocal(beep,1,0,0x0);
status1 = 1;
r2=CreateThing(r2templete,generator2);
CaptureThing(r2);
sleep(1);
call movedroid2;
}

if((GetSenderId() == 2) && (status1 == 0) && (status2 > 1))
Print("cog is broken.. Ending script");
stop;

#========================================================================================
movedroid1:
#setpulse(0.001);
AISetMoveThing(r2,ghost1a);
AISetLookPos(r2,GetThingPos(ghost1a));
AISetMode(r2,0x202);
call movedroid3;
#========================================================================================
movedroid2:

#setpulse(0.001);
AISetMoveThing(r2,ghost1b);
AISetLookPos(r2,GetThingPos(ghost1b));
AISetMode(r2,0x202);
call movedroid3;

#=====================================================================================
movedroid3:

AISetMoveThing(r2,ghost2);
AISetLookPos(r2,GetThingPos(ghost2));
AISetMode(r2,0x202);
sleep(5);
AISetMoveThing(r2,ghost3);
AISetLookPos(r2,GetThingPos(ghost3));
Stop;
#========================================================================================

#killed:

#status2=0;
#return;

#touched:

#if(status==0 && GetThingSector(r5) == doorsec)
#{
#status2=1;
#return;
#}

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

end
And when the moment is right, I'm gonna fly a kite.
2003-02-03, 10:33 AM #6
eeeee what you changed?

↑ Up to the top!