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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why is the key to door script not working to me?
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#5
RE: Why is the key to door script not working to me?

void OnStart()
{
AddUseItemCallback("", "key", "locked_door1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key");
}
void OnPickup(string &in asEntity, string &in type)
{
    SetEntityActive("servant_grunt_1", true);
    ShowEnemyPlayerPosition("servant_grunt_1");
}


This should work.


If it doesn't, you probably haven't matched the names properly. "locked_door1" must be the name of the door in the level editor.

"key" must be the name of the key in the level editor.

Are you trying to open a swing door? Or a level door? A swing door doesn't load another map. A level door does.
(This post was last modified: 08-04-2013, 09:23 PM by FurtherGames.)
08-04-2013, 09:22 PM
Find


Messages In This Thread
RE: Why is the key to door script not working to me? - by FurtherGames - 08-04-2013, 09:22 PM



Users browsing this thread: 1 Guest(s)