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


Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to unlock door with key?
LoneWolf Offline
Senior Member

Posts: 308
Threads: 43
Joined: Sep 2010
Reputation: 0
#11
RE: How to unlock door with key?

Scripts all right, its the tabs in the level editor which may have been filled out wrongly. I think the key needs 3 names down, 1 for the cfg file, for name of key and text to appear, and 1 for key picked up and 1 for key to be used on door and for key to be removed.

But the door just needs 2, one in collide i think and 1 in name.

If you've done this right then, have you posted your full script? and does the error say theres a line wrong? eg. (2,1).
12-11-2010, 01:45 AM
Find Reply
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#12
RE: How to unlock door with key?

(12-11-2010, 01:45 AM)LoneWolf Wrote: Scripts all right, its the tabs in the level editor which may have been filled out wrongly. I think the key needs 3 names down, 1 for the cfg file, for name of key and text to appear, and 1 for key picked up and 1 for key to be used on door and for key to be removed.

But the door just needs 2, one in collide i think and 1 in name.

If you've done this right then, have you posted your full script? and does the error say theres a line wrong? eg. (2,1).

I have corrected these in level editor..


ERROR: FATAL ERROR: Could not load script file custom/stories/FTD/custom_stories/FTD/maps/00_example.hps'! main (3,2) : ERR : No matching signatures to 'AddUseItemCallback(string@&, string@&, const bool)'


Full Script:

void OnStart()
{
AddUseItemCallback("", "key_1", "door_1" "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0.0f, false);
RemoveItem("key_1");
AddDebugMessage("KeyOnDoor", false);
}

////////////////////////////
// Run when entering map
void OnEnter()
{
}

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

Im confused how this can be so confusing and hard... I dont never learn scripting i just love this game and just wanna make one beautiful map :I

“Life is a game, play it”
12-11-2010, 02:18 AM
Find Reply
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#13
RE: How to unlock door with key?

these is a , missing in
AddUseItemCallback("", "key_1", "door_1" "UsedKeyOnDoor", true);

make it
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
12-11-2010, 01:06 PM
Website Find Reply
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#14
RE: How to unlock door with key?

(12-11-2010, 01:06 PM)jens Wrote: these is a , missing in
AddUseItemCallback("", "key_1", "door_1" "UsedKeyOnDoor", true);

make it
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);

Holy shit! It works thanks u are my savior!! Blush

“Life is a game, play it”
12-11-2010, 04:11 PM
Find Reply
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#15
RE: How to unlock door with key?

Quote:There's a comma missing in your callback.

Dodgy

This could've been solved much earlier.. well, nice that you got it working.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
12-11-2010, 04:54 PM
Find Reply
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#16
RE: How to unlock door with key?

(12-11-2010, 04:54 PM)Frontcannon Wrote:
Quote:There's a comma missing in your callback.

Dodgy

This could've been solved much earlier.. well, nice that you got it working.

Yeah i know okay only one thing now... How i am missing the "name of key" and description of key? Tell me codes and im good Smile

“Life is a game, play it”
12-11-2010, 05:03 PM
Find Reply
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#17
RE: How to unlock door with key?

Why should you miss anything when it works?


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
12-11-2010, 05:22 PM
Find Reply
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#18
RE: How to unlock door with key?

(12-11-2010, 05:22 PM)Frontcannon Wrote: Why should you miss anything when it works?

Now it only works when i use the key on door and it unlocks and that sound, but it only says when i picked up key "Picked up" and now description in the key? Thats my problem..

“Life is a game, play it”
12-11-2010, 05:31 PM
Find Reply
Tirilno Offline
Junior Member

Posts: 27
Threads: 5
Joined: Jul 2011
Reputation: 0
#19
RE: How to unlock door with key?

Can you guys please look at my script? Smile I have tried everyting and looked through every 'how to' and tutorial videos I find but I can't unlock my door -.- I want my door to be open when I use the key, but It's still locked after I use it :/ (I'm using a level door) Tongue

void OnStart()
{
AddUseItemCallback("", "Storagekey_1", "Storagedoor", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Storagedoor", false, true);
PlaySoundAtEntity("", "Unlock_door", "Storagedoor", 0, false);
}
void OnLeave()
{

}
07-06-2011, 10:18 PM
Find Reply
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#20
RE: How to unlock door with key?

(07-06-2011, 10:18 PM)Tirilno Wrote: Can you guys please look at my script? Smile I have tried everyting and looked through every 'how to' and tutorial videos I find but I can't unlock my door -.- I want my door to be open when I use the key, but It's still locked after I use it :/ (I'm using a level door) Tongue

void OnStart()
{
AddUseItemCallback("", "Storagekey_1", "Storagedoor", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Storagedoor", false, true);
PlaySoundAtEntity("", "Unlock_door", "Storagedoor", 0, false);
}
void OnLeave()
{

}

For level doors you have to use this:

SetLevelDoorLocked(string& asName, bool abLocked);

Try this:

void OnStart()
{
   AddUseItemCallback("", "Storagekey_1", "Storagedoor", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
     SetLevelDoorLocked("Storagedoor", false);
     PlaySoundAtEntity("", "unlock_door", "Storagedoor", 0, false);
}
void OnLeave()
{

}

07-06-2011, 10:26 PM
Find Reply




Users browsing this thread: 1 Guest(s)