Frictional Games Forum (read-only)

Full Version: destroying key after use?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how do my key after use
i have takin heeps out out of the script this is just the door opening door thingy
void OnStart()
{
AddUseItemCallback("OpenDoor", "key_study_1", "level_wood_1", "UnlockLevelDoor", true);

}
void OnEnter()
{
}
void OnLeave()
{
}
void UnlockLevelDoor(string &in item, string &in entity)
{
SetLevelDoorLocked(entity, false);
}
what would i have to add to destory the key after using it to unlock the door?
The Engine Scripts Page is there to help you! It is RemoveItem("<NAME>"); where <NAME> is the name of the key, in this case key_study_1. So it's RemoveItem("key_study_1");
(03-31-2012, 01:52 PM)DoubleThinking Wrote: [ -> ]
The Engine Scripts Page is there to help you! It is RemoveItem("<NAME>"); where <NAME> is the name of the key, in this case key_study_1. So it's RemoveItem("key_study_1");
so i put it underneath void UnlockDoor?
(03-31-2012, 02:10 PM)zombiehacker595 Wrote: [ -> ]
(03-31-2012, 01:52 PM)DoubleThinking Wrote: [ -> ]
The Engine Scripts Page is there to help you! It is RemoveItem(""); where is the name of the key, in this case key_study_1. So it's RemoveItem("key_study_1");
so i put it underneath void UnlockDoor?
Yes
Put it under the SetDoorLocked

It's also good to add.
GiveSanityBoostSmall();
PlaySoundAtEntity("", "unlock_door", "player", 0, false);
Only add "GiveSanityBoostSmall();" if you want unlocking the door to feel like some sort of task has been completed. Otherwise, just adding the sound will let them realize they unlocked the door. Sometimes, I just feel that adding GiveSanityBoostSmall(); makes it seem like progress has been made, and unlocking each door isn't always a step in the right direction -evil face-
(03-31-2012, 05:25 PM)JetlinerX Wrote: [ -> ]Only add "GiveSanityBoostSmall();" if you want unlocking the door to feel like some sort of task has been completed. Otherwise, just adding the sound will let them realize they unlocked the door. Sometimes, I just feel that adding GiveSanityBoostSmall(); makes it seem like progress has been made, and unlocking each door isn't always a step in the right direction -evil face-
yea thanks Smile