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?
Wolfpa Offline
Junior Member

Posts: 14
Threads: 3
Joined: Aug 2013
Reputation: 0
#1
Why is the key to door script not working to me?

I tried to do everything but it just won't unlock the damn door!
This is my script:

void OnStart()
{
AddUseItemCallback("", "key", "locked_door1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key", "OnPickup");
}
void UsedKeyOnDoor("key", "locked_door1")
{
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");
}

Just pls tell me what is wrong or missing!
(This post was last modified: 08-07-2013, 07:20 AM by Wolfpa.)
08-04-2013, 10:38 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
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");

}

There, I think it should work now.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
08-04-2013, 10:53 AM
Find
Wolfpa Offline
Junior Member

Posts: 14
Threads: 3
Joined: Aug 2013
Reputation: 0
#3
RE: Why is the key to door script not working to me?

Thanks ,but it didn't work I don't know why but it didn't!

But still thanks.
08-04-2013, 10:57 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#4
RE: Why is the key to door script not working to me?

Check if the names in the level editor and the script match. If there's any .map_cache, delete it.
And, remain that your script must end with .hps (for example, level.hps) and that it must match with the name of your map.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
08-04-2013, 12:18 PM
Find
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
Wolfpa Offline
Junior Member

Posts: 14
Threads: 3
Joined: Aug 2013
Reputation: 0
#6
RE: Why is the key to door script not working to me?

A cache file has created it self in my CS map folder, should I delete it or leave it there?
08-05-2013, 09:18 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#7
RE: Why is the key to door script not working to me?

DELETE IT

"Veni, vidi, vici."
"I came, I saw, I conquered."
08-05-2013, 09:27 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#8
RE: Why is the key to door script not working to me?

.map_cache are some kind of memory of the map, and the game will load them instead the .map. That means, that if you make changes in your map, and there's a .map_cache, when you start your map in Amnesia, the changes won't be shown.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
08-05-2013, 11:49 AM
Find
Wolfpa Offline
Junior Member

Posts: 14
Threads: 3
Joined: Aug 2013
Reputation: 0
#9
RE: Why is the key to door script not working to me?

Did but still it doesn't work .I checked all names and its good,soooo...
WHAT THE HELL IS WRONG??
08-05-2013, 07:45 PM
Find
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#10
RE: Why is the key to door script not working to me?

Are the names for your doors/scripts/keys matching with that in the level editor?

Also, is your account the administrator on your computer?
(This post was last modified: 08-05-2013, 08:21 PM by Tomato Cat.)
08-05-2013, 08:20 PM
Find




Users browsing this thread: 3 Guest(s)