The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 keys script
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#1
2 keys script

I'm having 2 keys in my map.

The first key you can pick up unlocks a door into another room.
On the way to the locked door, you pass another locked door. But when you unlock the door with the valid key, the other door becomes unlocked automatic... However the next key still works on the newly unlocked door...
Here is my script:

////////////////////////////
// Run first time starting map
void OnStart()
{

}

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "key2", "door2", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key1");

SetSwingDoorLocked("door2", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("key2");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

What is wrong?

Trying is the first step to success.
03-10-2012, 11:32 AM
Find


Messages In This Thread
2 keys script - by FlawlessHappiness - 03-10-2012, 11:32 AM
RE: 2 keys script - by flamez3 - 03-10-2012, 11:45 AM
RE: 2 keys script - by Stepper321 - 03-10-2012, 12:14 PM
RE: 2 keys script - by flamez3 - 03-10-2012, 12:47 PM
RE: 2 keys script - by FlawlessHappiness - 03-10-2012, 12:29 PM
RE: 2 keys script - by Stepper321 - 03-10-2012, 12:43 PM
RE: 2 keys script - by FlawlessHappiness - 03-10-2012, 01:08 PM
RE: 2 keys script - by flamez3 - 03-10-2012, 01:33 PM
RE: 2 keys script - by FlawlessHappiness - 03-10-2012, 02:55 PM
RE: 2 keys script - by flamez3 - 03-10-2012, 03:01 PM
RE: 2 keys script - by FlawlessHappiness - 03-10-2012, 03:23 PM
RE: 2 keys script - by DaAinGame - 03-10-2012, 08:28 PM



Users browsing this thread: 1 Guest(s)