HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
How to unlock door with key?
Okay im making my first Amnesia map and i need help to unlock door with key..
I make script with mulledk 19 tutorial instructions but.. It doesnt work..
Please help!
“Life is a game, play it”
|
|
12-09-2010, 10:48 PM |
|
Frontcannon
Senior Member
Posts: 538
Threads: 10
Joined: Jul 2010
Reputation:
2
|
RE: How to unlock door with key?
The script. Post it.
╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
|
|
12-09-2010, 10:57 PM |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to unlock door with key?
(12-09-2010, 10:57 PM)Frontcannon Wrote: The script. Post it.
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key1", "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(key1
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Thats my first script ever. Sorry im new at this one..
“Life is a game, play it”
|
|
12-09-2010, 11:16 PM |
|
Frontcannon
Senior Member
Posts: 538
Threads: 10
Joined: Jul 2010
Reputation:
2
|
RE: How to unlock door with key?
This screws up your script:
void USedKeyOnDoor(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door," "mansion_1", 0, false);
{ RemoveItem(key1
Way too many syntax errors.
Fixed:
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, false);
RemoveItem("key1");
}
You also should take a look here.
edits
With every other read, I find a new syntax error. Do you check your script after saving?
-
There's a comma missing in your callback.
╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
(This post was last modified: 12-09-2010, 11:31 PM by Frontcannon.)
|
|
12-09-2010, 11:25 PM |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to unlock door with key?
(12-09-2010, 11:25 PM)Frontcannon Wrote: This screws up your script:
void USedKeyOnDoor(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door," "mansion_1", 0, false);
{ RemoveItem(key1
Way too many syntax errors.
Fixed:
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, false);
RemoveItem("key1");
}
You also should take a look here.
edits
With every other read, I find a new syntax error. Do you check your script after saving?
-
There's a comma missing in your callback.
I dont understand i dont see any scripting code errors.. i save after i change scripting and test door and key.. i fixed that command but doesnt work This is hard...
“Life is a game, play it”
|
|
12-09-2010, 11:36 PM |
|
house
Member
Posts: 195
Threads: 11
Joined: Oct 2010
Reputation:
1
|
RE: How to unlock door with key?
It takes years of practicing coding... Just kidding, Here, look at this:
void OnStart()
{
AddUseItemCallback("", "key1", "mansion_1" "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, false);
RemoveItem("key1");
}
mansion_1 is: The name of your door you want to unlock.
key1: The name of the key you want to open the door with.
So now, replace everything from the code above from mansion_1 to the door to unlock, and key1 to the name of the key to use to open the door.
Then copy it into your .hps file for your level!
|
|
12-10-2010, 04:42 AM |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to unlock door with key?
(12-10-2010, 04:42 AM)house Wrote: It takes years of practicing coding... Just kidding, Here, look at this:
void OnStart()
{
AddUseItemCallback("", "key1", "mansion_1" "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0.0f, false);
RemoveItem("key1");
}
mansion_1 is: The name of your door you want to unlock.
key1: The name of the key you want to open the door with.
So now, replace everything from the code above from mansion_1 to the door to unlock, and key1 to the name of the key to use to open the door.
Then copy it into your .hps file for your level!
Okay, but i renamed that "mansion_1" that door but im getting message its already named object somewhere.. then i renamed it "door_1" and "key1" but doesnt work :I
Here: //===========================================
// Starter's Script File!
//===========================================
//===========================================
// This runs when the map first starts
void OnStart()
{
AddUseItemCallback("", "key1", "door_1" "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0.0f, false);
RemoveItem("key1");
}
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}
This is pissing me off..
“Life is a game, play it”
|
|
12-10-2010, 01:53 PM |
|
Oscar House
Senior Member
Posts: 302
Threads: 3
Joined: Nov 2010
Reputation:
9
|
RE: How to unlock door with key?
Are you sure your key is named key1 and your door named door_1 ?
|
|
12-10-2010, 02:29 PM |
|
LoneWolf
Senior Member
Posts: 308
Threads: 43
Joined: Sep 2010
Reputation:
0
|
RE: How to unlock door with key?
Remeber the name doesnt just go in the name box it also goes in the callback box too. in the right tab.
|
|
12-10-2010, 04:12 PM |
|
HumiliatioN
Posting Freak
Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation:
18
|
RE: How to unlock door with key?
(12-10-2010, 02:29 PM)Oscar House Wrote: Are you sure your key is named key1 and your door named door_1 ?
Yes im sure.
(12-10-2010, 04:12 PM)LoneWolf Wrote: Remeber the name doesnt just go in the name box it also goes in the callback box too. in the right tab.
Yeah i know but it doesnt work this is probably some unknown error or my map has bugs.. I have "key1" named key in my first room then first door is named "door_1" because previously named was "mansion_1" but i get this message which says "This same name has already somewhere in this object too etc."
I dont know just please write the right code i dont care what name calls it has to be! I copy paste it... Or i just quit scripting and never finish the map
And sorry my crappy english!
“Life is a game, play it”
(This post was last modified: 12-11-2010, 12:27 AM by HumiliatioN.)
|
|
12-11-2010, 12:22 AM |
|
|