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
Of Keys and Locked doors...
Ethril Offline
Junior Member

Posts: 7
Threads: 1
Joined: Jan 2011
Reputation: 0
#1
Sad  Of Keys and Locked doors...

Hi guys! was wondering if you could help me with some scripting. I have been trying to get a certain locked door to be opened by a key. However, the key doesn't open the door nor will the door stay locked unless I have the box marked "locked", ticked.

Here are my scripts

extra_english.lang file:


<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">(story description)</Entry>
</CATEGORY>


<CATEGORY Name="Journal">
<Entry Name="Note_Test01_Name">Dusty Note</Entry>
<Entry Name="Note_Test01_Text">(note text).</Entry>
</CATEGORY>


<CATEGORY Name="Inventory">
<Entry Name="ItemName_StrangeKey">Strange Key</Entry>
<Entry Name="ItemDesc_StrangeKey">Key for a cellar door.</Entry>
</CATEGORY>

</LANGUAGE>


and here is the HPS:

void onStart()
{
AddUseItemCallback("", "strangekey_1", "cellar_wood01_2", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cellar_wood01_2", false, true);
PlaySoundAtEntity("", "unlock_door", "cellar_wood01_2", 0, false);
RemoveItem("strangekey_1");
}

void onEnter()
{

}


void OnLeave()
{

}


The key works as intended, when picked up it will say you have picked up strange key and it will show in my inventory along with the description but when used on the door that it is supposed to unlock, it will just not work.

Does anyone know what is wrong with my script Sad?
(This post was last modified: 01-12-2011, 07:06 AM by Ethril.)
01-12-2011, 03:27 AM
Find
Ethril Offline
Junior Member

Posts: 7
Threads: 1
Joined: Jan 2011
Reputation: 0
#2
RE: Of Keys and Locked doors...

any one Sad?
01-12-2011, 10:46 AM
Find
Neatherblade Offline
Junior Member

Posts: 19
Threads: 5
Joined: Jan 2011
Reputation: 0
#3
RE: Of Keys and Locked doors...

void OnStart()
{
AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

Taken from here

http://www.frictionalgames.com/forum/thread-5117.html
01-12-2011, 11:10 AM
Find
Ethril Offline
Junior Member

Posts: 7
Threads: 1
Joined: Jan 2011
Reputation: 0
#4
RE: Of Keys and Locked doors...

(01-12-2011, 11:10 AM)Neatherblade Wrote: void OnStart()
{
AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

Taken from here

http://www.frictionalgames.com/forum/thread-5117.html

Ty for the info! however it still will not open with the use of my key. Are there any options on the door and key that I have to put info in? all I have done is ticked the "lock" box on the door entity. I am able to pick up the key see it's name and description however when I double click on it and use it on the door, it says this item can not be used this way!

here is my current script! help please Sad! OldDoor= door name strangekey_1 = key name

void onStart()
{
AddUseItemCallback("", "strangekey_1", "OldDoor", "KeyOnDoor", true);
}


void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("OldDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "OldDoor", 0.0f, true);
}



void onEnter()
{

}


void OnLeave()
{

}
01-12-2011, 11:48 AM
Find
Neatherblade Offline
Junior Member

Posts: 19
Threads: 5
Joined: Jan 2011
Reputation: 0
#5
RE: Of Keys and Locked doors...

The door you have in the editor is named OldDoor aswell?
01-12-2011, 12:27 PM
Find
Ethril Offline
Junior Member

Posts: 7
Threads: 1
Joined: Jan 2011
Reputation: 0
#6
RE: Of Keys and Locked doors...

(01-12-2011, 12:27 PM)Neatherblade Wrote: The door you have in the editor is named OldDoor aswell?

yes, It is a cellar door and I renamed it in the editor as OldDoor

it is marked as active and it is also marked as locked
01-12-2011, 12:44 PM
Find
Ethril Offline
Junior Member

Posts: 7
Threads: 1
Joined: Jan 2011
Reputation: 0
#7
RE: Of Keys and Locked doors...

Bump for great justice!
01-14-2011, 07:47 AM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#8
Wink  RE: Of Keys and Locked doors...

Work with debug messages to check if the KeyOnDoor function is ever called!


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
01-14-2011, 08:04 PM
Find
Ethril Offline
Junior Member

Posts: 7
Threads: 1
Joined: Jan 2011
Reputation: 0
#9
RE: Of Keys and Locked doors...

(01-14-2011, 08:04 PM)Frontcannon Wrote: Work with debug messages to check if the KeyOnDoor function is ever called!

sorry if this is a stupid question but how do I check debug message hehe Huh
01-15-2011, 07:03 AM
Find
Andross Offline
Junior Member

Posts: 38
Threads: 1
Joined: Oct 2010
Reputation: 0
#10
RE: Of Keys and Locked doors...

You need to setup a dev environment as described in this guide and use AddDebugMessage().
01-15-2011, 07:07 AM
Find




Users browsing this thread: 2 Guest(s)