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 → Locked door?
Locked door?
2002-08-30, 6:10 AM #1
Someone, I forgot who, posted a request for a locked door script. Just as I was about to post the cog, the thread was deleted. So, to prevent my 30 seconds of work from going to waste, here is the cog.

Code:
# Key - Door script.   Variable key.
#
# Version 1.5
#
# 03 - 08/2002 GBK

Symbols
Message Activated
Message Arrived
Message Blocked
Message Timer
Thing Door
Thing Player   Local
Flex Door_speed=4.0
Flex Door_sleep=4.0
Int Key_num			#Bin number of the required key.
Int Take_away=0			#Take away key after use?	0 = no.
Int UNI_num			#UNI string number.   -1 for none.
Sound Locked			#Sound to play when locked.
Sound Voice			#Sound for voice.
Int D=1			Local
End
Code
Activated: Player = Getsourceref();
If(Isthingmoving(Door) != 0 || Getcurframe(Door) != 0) Stop;
If(Getinv(Player, Key_num) == 1) { 
If(Take_away != 0) Setinv(Player, Key_num, 0);
Movetoframe(Door, 1, Door_speed); } 
Else { If(D) { D=0; Playsoundthing(Voice, Player, 1, 0, 4, 0); }
If(UNI_num != -1) JKprintUNIstring(Player, UNI_num);
Playsoundthing(Locked, Player, 1, 0, 4, 0); } Stop;
Arrived: If(Getcurframe(Door) == 1) Settimer(Door_sleep); Stop;
Blocked: If(Getgoalframe(Door) == 0) { Stopthing(Door);
Movetoframe(Door, 1, Door_speed); }
Else { Stopthing(Door);
Movetoframe(Door, 0, Door_speed); } Stop;
Timer: Movetoframe(Door, 0, Door_speed);
Stop;
End



And no, I did not seXorz this cog.

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-08-30, 9:33 AM #2
I was gonna say.......what the hell happened? [http://forums.massassi.net/html/smile.gif]

Anyways, thanks a lot. The cog aint ready for that type of thing yet.

Anyways i need a few things changed. First of all, i need to be able to define the switch itself [http://forums.massassi.net/html/wink.gif]

Second of all, the door should just open and stay open, i dont need a sleep value.

last, what is the bin number for the red wrench? Thanks.

------------------
Sanctum de la Mort

[This message has been edited by Dash_rendar (edited August 30, 2002).]
2002-08-30, 9:45 AM #3
Bah sure it is. If ver1.5 isnt old enough, what is? Besides, I clearly remember seX0ring a beta cog a few times in the past... [http://forums.massassi.net/html/smile.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-08-30, 10:09 AM #4
GBK, even the final version female actor cogs arent ready for you....... [http://forums.massassi.net/html/wink.gif]

------------------
Sanctum de la Mort Restless
2002-08-30, 10:35 AM #5
[http://forums.massassi.net/html/frown.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-08-30, 11:03 AM #6
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Dash_rendar:

Anyways i need a few things changed. First of all, i need to be able to define the switch itself [http://forums.massassi.net/html/wink.gif]

Second of all, the door should just open and stay open, i dont need a sleep value.

last, what is the bin number for the red wrench? Thanks.

</font>



If you do this, ive got a full version slave leia actor cog that wants to meet you.... [http://forums.massassi.net/html/wink.gif]

------------------
Sanctum de la Mort Restless


[This message has been edited by Dash_rendar (edited August 30, 2002).]
2002-08-30, 4:21 PM #7
/me is lonely. [http://forums.massassi.net/html/frown.gif]


Code:
# Key - Door script.   Variable key.
#
# Version 2
#
# 08/2002 GBK

Symbols
Message Activated
Message Arrived
Message Blocked
Message Timer
Surface Switch=-1
Int Allow_door=0			#Allow door to be directly activated?  0=no.
Thing Door
Thing Player   Local
Flex Door_speed=4.0
Flex Door_sleep=4.0		#To keep open, make '-1'.
Int Key_num=46			#Bin number of the required key (red).
Int Take_away=0			#Take away key after use?	0 = no.
Int UNI_num			#UNI string number.   -1 for none.
Sound Locked			#Sound to play when locked.
Sound Voice			#Sound for voice.
Int D=1			Local
End
Code
Activated: Player = Getsourceref();
If(Getsenderref() == Door && !Allow_door) Stop;
If(Switch != -1) Setwallcel(Switch, 1);
If(Isthingmoving(Door) != 0 || Getcurframe(Door) != 0) Stop;
If(Getinv(Player, Key_num) == 1) { 
If(Take_away != 0) Setinv(Player, Key_num, 0);
Movetoframe(Door, 1, Door_speed); } 
Else { If(D) { D=0; Playsoundthing(Voice, Player, 1, 0, 4, 0); }
If(UNI_num != -1) JKprintUNIstring(Player, UNI_num);
Playsoundthing(Locked, Player, 1, 0, 4, 0); } Stop;
Arrived: If(Getcurframe(Door) == 1 && Door_sleep != -1) Settimer(Door_sleep); Stop;
Blocked: If(Getgoalframe(Door) == 0) { Stopthing(Door);
Movetoframe(Door, 1, Door_speed); }
Else { Stopthing(Door);
Movetoframe(Door, 0, Door_speed); } Stop;
Timer: Movetoframe(Door, 0, Door_speed);
If(Switch != -1) Setwallcel(Switch, 0);
Stop;
End


------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-08-30, 6:24 PM #8
What is the bin number for the Yellow Wrench?

------------------
Sanctum de la Mort

Restless
2002-08-31, 4:55 AM #9
From Items.Dat:
Code:
keyimperial             43              0       1       0x042   cog=item_keyimperial.cog
wrench                  44              0       1       0x042   cog=item_wrench.cog
datadisk                45              0       1       0x042   cog=item_datadisk.cog
keyred                  46              0       1       0x042   cog=item_keyred.cog
keyblue                 47              0       1       0x042   cog=item_keyblue.cog
keyyellow               48              0       1       0x042   cog=item_keyyellow.cog
wrchblue                49              0       1       0x042   cog=item_wrenchblue.cog
wrchyellow              50              0       1       0x042   cog=item_wrenchyellow.cog
keygreen                51              0       1       0x042   cog=item_keygreen.cog


------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!