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 → Door cog change
Door cog change
2000-11-01, 4:15 PM #1
All I want is to make it so that when a certain door, hits a certain frame, it changes a certain surface's adjoin and surface flags. For some reason, though, it just isn't working.

SetAdjoinFlags(floor, 0x7);
SetSurfaceFlags(floor,0x1001);

Those are the commands i'm using for the surface flags change. Yes, I have everything defined and stuff in the symbols section. Could someone maybe show me how to get the
frame = GetCurFrame(thing);
command to work for me? I'm not exactly sure how it would work, so I'm pretty sure that's where my prob is.... Thanks!


(Ohh... when I finish learning TrueBasic... and then finish Learning C/C++....then you'll be sorry...or happy, cuz you won't have to answer my questions [http://forums.massassi.net/html/smile.gif] )

------------------
Bob of Aveylon has risen from the ashes of destruction, in the form of a potato masher, and will guide you to your destiny as a whisk!!
Stranger Still, Fact or Fiction?
Dat be my site, by the way....
Warhead[97]
2000-11-02, 1:05 AM #2
Post the whole cog please. Where are you putting those 2 lines?

-Jipe
2000-11-02, 3:13 AM #3
Ohh...my god... I'm stupid.. that's probably it...


# Jedi Knight Cog Script
#
# Doorswitch2.COG
#
# Doors handled by switch with floor changes.
#
# [CYW & YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

thing door0 linkid=1
thing door1 linkid=1
thing door2 linkid=1
thing door3 linkid=1

surface switch0 linkid=2
surface switch1 linkid=2
surface floor linkid=2

flex movespeed=8.0
flex sleeptime=2.0
flex lightvalue=0.5

sound onSound=set_hi2.wav local
sound offSound=lgclick1.wav local
sound locksound=df_door2-3.wav local

int doorsector local
int numdoors=0 local
int doorstatus=0 local
int movestatus=0 local
int garbage=-1 local
int dummy=0 local

message startup
message activated
message arrived
message blocked

end

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

code
startup:
if(door0 >= 0) numdoors = numdoors + 1;
if(door1 >= 0) numdoors = numdoors + 1;
if(door2 >= 0) numdoors = numdoors + 1;
if(door3 >= 0) numdoors = numdoors + 1;

doorsector = GetThingSector(door0);
SectorAdjoins(doorsector, 0);
SectorLight(doorsector, lightvalue, 0.0); // add some light to door sector
return;

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

activated:
if (GetSenderId() == 1)
{
dummy=PlaySoundLocal(locksound, 1, 0, 0);
}
else if (GetSenderId() == 2)
{
call checkstatus;
if (movestatus) return;
if (doorstatus == 0) // all pieces are at frame 0
{
garbage = PlaySoundThing(onSound, door0, 0.6, -1, -1, 0); // play activate sound
garbage = setwallcel(switch0, 1);
if (switch1 >= 0) garbage = setwallcel(switch1, 1);
sectoradjoins(doorsector, 1);
call open_doors;
}
}
return;

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

arrived:
call checkstatus;
if(movestatus) return;
if(doorstatus == numdoors)
{ // all pieces are at frame 1
sleep(sleeptime);
call close_doors;
}
else if(doorstatus == 0)
{ // all pieces are at frame 0
garbage = PlaySoundThing(offSound, door0, 0.6, -1, -1, 0); // play deactivate sound
garbage = setwallcel(switch0, 0);
if(switch1 >= 0) garbage = setwallcel(switch1, 0);
sectoradjoins(doorsector, 0);
}
return;

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

blocked:
call open_doors;
return;

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

open_doors:
movetoframe(door0, 1, movespeed);
SetAdjoinFlags(floor, 0x7);
SetSurfaceFlags(floor,0x1001);
if (door1 >= 0) movetoframe(door1, 1, movespeed);
if (door2 >= 0) movetoframe(door2, 1, movespeed);
if (door3 >= 0) movetoframe(door3, 1, movespeed);
return;

close_doors:
movetoframe(door0, 0, movespeed);
SetAdjoinFlags(floor, 0x5);
SetSurfaceFlags(floor,0x1005);
if (door1 >= 0) movetoframe(door1, 0, movespeed);
if (door2 >= 0) movetoframe(door2, 0, movespeed);
if (door3 >= 0) movetoframe(door3, 0, movespeed);
return;

checkstatus:
movestatus = ismoving(door0);
if (door1 >= 0) movestatus = movestatus + ismoving(door1);
if (door2 >= 0) movestatus = movestatus + ismoving(door2);
if (door3 >= 0) movestatus = movestatus + ismoving(door3);

doorstatus = getcurframe(door0);
if (door1 >= 0) doorstatus = doorstatus + getcurframe(door1);
if (door2 >= 0) doorstatus = doorstatus + getcurframe(door2);
if (door3 >= 0) doorstatus = doorstatus + getcurframe(door3);
return;


end

this is the code without the getthingframe or whatever, but i'm late for school right now, so I can't add that in. I'll do it when I get back.




------------------
Bob of Aveylon has risen from the ashes of destruction, in the form of a potato masher, and will guide you to your destiny as a whisk!!
Stranger Still, Fact or Fiction?
Dat be my site, by the way....
Warhead[97]
2000-11-02, 12:30 PM #4
if (getcurframe(door1) != 1)
{

SetAdjoinFlags(floor, 0x7);
SetSurfaceFlags(floor,0x1001);

}

Please tell me if that will work, and if so, where do I put it?

------------------
Bob of Aveylon has risen from the ashes of destruction, in the form of a potato masher, and will guide you to your destiny as a whisk!!
Stranger Still, Fact or Fiction?
Dat be my site, by the way....
Warhead[97]
2000-11-02, 12:45 PM #5
Are you using all 4 doors in your script? Or do you need just one?

if(GetCurFrame(door1) != 1)
{
SetAdjoinFlags(floor, 0x7);
SetSurfaceFlags(floor,0x1001);
}

Yeah that would be right, not sure if it's necessary. Try putting your 2 lines in the end of the activated: message, right after the 2 garbage lines.

-Jipe
2000-11-02, 1:01 PM #6
Hmm.. that didn't work..

------------------
Bob of Aveylon has risen from the ashes of destruction, in the form of a potato masher, and will guide you to your destiny as a whisk!!
Stranger Still, Fact or Fiction?
Dat be my site, by the way....
Warhead[97]
2000-11-02, 1:07 PM #7
Hahah, oh wait, yes it did!

So now how can I get it to change back? Where would it put it THEN?

------------------
Bob of Aveylon has risen from the ashes of destruction, in the form of a potato masher, and will guide you to your destiny as a whisk!!
Stranger Still, Fact or Fiction?
Dat be my site, by the way....

[This message has been edited by BobTheMasher (edited November 02, 2000).]
Warhead[97]
2000-11-03, 10:12 AM #8
To reverse them? Try putting them (with changed paramaters) at the end of close_doors:

-Jipe

↑ Up to the top!