View Full Version : Complicated Cog.
I am interested in a cog, i would make it myself if i knew how, but i dont so, here it goes. What i wanted the cog to do was control doors, if someone was in say, the room, and someone else comes along and tries to open the door, it wont open, but if no one is in the room, then the door opens. I assume it will be nearly impossible because the person would want to get out after entering.
Vane
------------------
There's only one thing that im scared of, and it's Pixels... THERE EVERYWHERE!!!! AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH! *runs threw a wall*
darthslaw
06-20-2004, 08:16 PM
# Jedi Knight Cog Script
#
# Control doors -- sector is the control sector; only players in that sector may open
# the door, or if there's no one in the sector, anyone may open it.
#
# [Darth Slaw]
#
# This Cog is Not supported by LucasArts Entertainment Co
symbols
message activated
message arrived
message timer
sector ctrlsector
thing door
flex speed=5.0
flex wait=2.0
end
# ================================================== ======================================
code
activated:
if((GetCurFrame(door) == 0 && !IsThingMoving(door)) && (GetSectorPlayerCount(ctrlsector) == 0 || GetThingSector(GetSourceRef()) == ctrlSector))
{
MoveToFrame(door, 1, speed);
}
stop;
# .................................................. ......................................
arrived:
if(GetCurFrame(door) == 1 && !IsThingMoving(door))
{
SetTimer(wait);
}
stop;
timer:
MoveToFrame(door, 0, speed);
stop;
end
[edit]Heh, I realized I forgot to parse; parsec saved me a heap of trouble -- I messed up on my parenthases, had one extra http://forums.massassi.net/html/redface.gif
[This message has been edited by Darth Slaw (edited June 20, 2004).]
Thanx a lot http://forums.massassi.net/html/smile.gif, i havent tried it yet, but i will soon.
------------------
There's only one thing that im scared of, and it's Pixels... THERE EVERYWHERE!!!! AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH! *runs threw a wall*
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.