Page 1 of 1
Script: Pick up a key and unlock a door...
Posted: Sat Dec 11, 2004 2:25 pm
by Goldeneye090
Hey all. Just wondering if it's possible to make a script where you can only go through a certain door if you've picked up an object...like a key or somethin...and once u pick up the object no one else can have it unless u drop it...Thanks.
GoldenEye
Posted: Sat Dec 11, 2004 3:55 pm
by Bjarne BZR
Sure, make the "setthread" of a trigger around the key set a value in the player
If the trigger has: "setthread gimmi_a_key_goddamnit"
Code: Select all
gimmi_a_key_goddamnit:
param.other.i_am_the_key_master = 1
end
And it the door trigger has: "setthread lemme_in_you_stooopid_imitation_of_a_door"
Code: Select all
lemme_in_you_stooopid_imitation_of_a_door:
if(param.other.i_am_the_key_master == 1) {
// stuff to open door
} else {
// tell param.other that he/she needs a key
}
end
Thats the base of it, just add some more scripting

Posted: Sat Dec 11, 2004 7:16 pm
by lizardkid
trigger around the key, setthread give_key:
Code: Select all
give_key:
$key remove
level.key = 1
at the door trigger_multiple with setthread detect_key:
Code: Select all
detect_key:
if(level.key = 1)
{
$locked_door open
}
is how id do it at least.
Posted: Sat Dec 11, 2004 7:26 pm
by Bjarne BZR
Well lizardkid, by doing so you would enable everyone to access the door as soon as anyone picked up the key ( but yes: removing the key is smatt if you only want one person to have it ).
Also: as soon as you start demanding a unique key: you must also start to handle people dying to drop the key, and people leaving the server... so you would probably need to scan all the players on aregular basis to make sure the key is still in the game.
So the simplest is to leave the key for anyone to pick up and just mark the ones that triggered the key trigger like in the code I did... and only let them pass the door. ( but simple solutions are not always what you want

)