Frictional Games Forum (read-only)
[SCRIPT] destroying key after use? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] destroying key after use? (/thread-14386.html)



destroying key after use? - zombiehacker595 - 03-31-2012

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?



RE: destroying key after use? - RedMser - 03-31-2012

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");



RE: destroying key after use? - zombiehacker595 - 03-31-2012

(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?



RE: destroying key after use? - Xanthos - 03-31-2012

(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);



RE: destroying key after use? - JetlinerX - 03-31-2012

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-



RE: destroying key after use? - zombiehacker595 - 04-01-2012

(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