Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help destroying key after use?
Author Message
zombiehacker595 Offline
Member

Posts: 141
Joined: Mar 2012
Reputation: 3
Post: #1
destroying key after use?

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?
03-31-2012 01:41 PM
Find all posts by this user Quote this message in a reply
DoubleThinking Offline
Junior Member

Posts: 32
Joined: Mar 2012
Reputation: 1
Post: #2
RE: destroying key after use?

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
Find all posts by this user Quote this message in a reply
zombiehacker595 Offline
Member

Posts: 141
Joined: Mar 2012
Reputation: 3
Post: #3
RE: destroying key after use?

(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
Find all posts by this user Quote this message in a reply
Xanthos Offline
Senior Member

Posts: 318
Joined: Mar 2012
Reputation: 8
Post: #4
RE: destroying key after use?

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

(This post was last modified: 03-31-2012 03:40 PM by Xanthos.)
03-31-2012 03:38 PM
Find all posts by this user Quote this message in a reply
JetlinerX Offline
Senior Member

Posts: 599
Joined: Jun 2011
Reputation: 19
Post: #5
RE: destroying key after use?

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-

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

03-31-2012 05:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
zombiehacker595 Offline
Member

Posts: 141
Joined: Mar 2012
Reputation: 3
Post: #6
RE: destroying key after use?

(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
04-01-2012 02:26 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: