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
Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)
Yonmaja Offline
Junior Member

Posts: 7
Threads: 3
Joined: Oct 2010
Reputation: 0
#1
Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

I've tried everything to get this stupid door to lock and then open with a key, but I just can't.

Here's my exact script:
void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
}

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

I renamed the key awesomekey_1. I followed MulleDK19's video tutorial (http://hpl2.frictionalgames.com/tutorials) TO THE LETTER, and I still can't get the door to lock. What am I doing wrong?

I searched the forums and couldn't find a solution, even on the "Recollecting Scripts" thread the locking door post there didn't work. And yes, my door is named mansion_1.
10-21-2010, 08:34 PM
Find Reply
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#2
RE: Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

SetSwingDoorLocked("mansion_1", true, true);

10-21-2010, 08:41 PM
Find Reply
Yonmaja Offline
Junior Member

Posts: 7
Threads: 3
Joined: Oct 2010
Reputation: 0
#3
RE: Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

(10-21-2010, 08:41 PM)Pandemoneus Wrote: SetSwingDoorLocked("mansion_1", true, true);

Didn't work.
10-21-2010, 08:43 PM
Find Reply
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#4
RE: Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

Err.. misunderstood your script.

Go to the level editor, select the door, press the second tab and check 'locked'.

10-21-2010, 09:00 PM
Find Reply
Yonmaja Offline
Junior Member

Posts: 7
Threads: 3
Joined: Oct 2010
Reputation: 0
#5
RE: Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

(10-21-2010, 09:00 PM)Pandemoneus Wrote: Err.. misunderstood your script.

Go to the level editor, select the door, press the second tab and check 'locked'.

That got the door to lock but the key won't open it...
10-21-2010, 10:06 PM
Find Reply
Arvaga Offline
Junior Member

Posts: 8
Threads: 1
Joined: Oct 2010
Reputation: 1
#6
RE: Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

I tried it too and it didn't work the way he did it, but I got it to work this way...
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
  SetSwingDoorLocked(asEntity, false, true);
  PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
  RemoveItem(asItem);
}
since asEntity is the entity we used the item on and the asItem, obviously, is the item.
This way you can make a global method to unlock doors, no need to make functions for every door you have to unlock.

Visit the scripts recollection thread to find scripts for your custom stories.
10-21-2010, 10:39 PM
Find Reply
house Offline
Member

Posts: 195
Threads: 11
Joined: Oct 2010
Reputation: 1
#7
RE: Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

You should Add: AddDebugMessage("Type anything you want here", false);

What this does, it says something at the very bottom very left. It says the thing you typed in the AddDebugMessage. Its useful to see if its even doing anything. You need to have the Debug Messages activated. Activate it here: C:\Documents and Settings\"YOUR COMPUTER USER NAME\My Documents\Amnesia\Main\"YOUR AMNESIA PROFILE NAME"\user_settings.cfg
Open it with your favorite text editing program. I recommend Notepad++. But you can still use the Notepad thing. If you don't want to get Notepad++ or don't have it, right click the file, Click Open With, select Notepad, Uncheck 'Always use the selected program to open this kind of file' If you don't uncheck it. It will mess up .cfg's FOREVER! So uncheck it. Press OK. It will open the file. Find:
ShowDebugMessages="false" Make: "false" to "true". It will show the debug messages. There are other useful and useless stuff to set true and false in the file if you want. You can always go back in the file and change it.

Add the Debug Message Code like this in the void UsedKeyOnDoor:

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
AddDebugMessage("Type anything you want here", false);
}

This won't solve fixing the key not opening the door. This is just something to see if its even doing anything.
10-22-2010, 04:56 AM
Find Reply
Jumpman Offline
Junior Member

Posts: 31
Threads: 10
Joined: May 2011
Reputation: 0
#8
RE: Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

First you need to go into the editor and click on the door and set "locked",
then you need to replace you scripting part where you have "UsedKeyOnDoor" and write the name of you key.. So it sould look like this..


void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "Usedawsomekey_1", true);
}

void Usedawsomekey_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}



Hope it helped Smile
05-09-2011, 12:59 PM
Find Reply
evertuy Offline
Junior Member

Posts: 46
Threads: 9
Joined: Mar 2011
Reputation: 0
#9
RE: Can't get door to lock using SetSwingDoorLocked("mansion_1", false, true)

does your .hps file have two .hps's?

ex-
mymap.hps.hps or mymap.hps
HPS FILE

remove the first .hps in the name.


USE NOTEPAD++

Sucky sucky 5 grand?
05-10-2011, 12:40 AM
Find Reply




Users browsing this thread: 1 Guest(s)