amnesiaplayer321
Junior Member
Posts: 31
Threads: 4
Joined: May 2013
Reputation:
0
|
Scripting Problem
Hi.I am looking forward to create a new custom story for amnesia.But i have problems with my script.And i see nothing wrong.And when i launch my story,it gives that error:
FATAL ERROR: Could not load script file
'custom_stories/mystory/maps/lvl1.hps'!
main (17, 21): ERR :Unexpected end of file
My script file:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Key", "Mansion_door", "UsedKeyonDoor", true);
AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);
void UsedKeyonDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Mansion_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Mansion", 0, false);
SetSwingDoorLocked("Door2", false, true);
PlaySoundAtEntity("", "unlock_door", "Door2", 0, false);
RemoveItem("Key");
RemoveItem("Key2");
Whats wrong about it and how to i fix?
|
|
05-20-2013, 07:19 PM |
|
Bridge
Posting Freak
Posts: 1,971
Threads: 25
Joined: May 2012
Reputation:
128
|
RE: Scripting Problem
You have to use the } character to designate the end of your function declarations.
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Key", "Mansion_door", "UsedKeyonDoor", true);
AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);
}
void UsedKeyonDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Mansion_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Mansion", 0, false);
SetSwingDoorLocked("Door2", false, true);
PlaySoundAtEntity("", "unlock_door", "Door2", 0, false);
RemoveItem("Key");
RemoveItem("Key2");
}
|
|
05-20-2013, 07:31 PM |
|
amnesiaplayer321
Junior Member
Posts: 31
Threads: 4
Joined: May 2013
Reputation:
0
|
RE: Scripting Problem
Thanks it did work but why is second door not locked?I did same thing on the first door's script.First door's locked but second is isn't.I downloaded beginneer set from youtube.
|
|
05-20-2013, 07:40 PM |
|
Bridge
Posting Freak
Posts: 1,971
Threads: 25
Joined: May 2012
Reputation:
128
|
RE: Scripting Problem
Are you certain the door is called "Door2"? The strings are probably case-sensitive.
(This post was last modified: 05-20-2013, 07:42 PM by Bridge.)
|
|
05-20-2013, 07:42 PM |
|
amnesiaplayer321
Junior Member
Posts: 31
Threads: 4
Joined: May 2013
Reputation:
0
|
RE: Scripting Problem
I am sure its called Door2 in both name and PlayerInteractCallBack and locked is checked.
|
|
05-20-2013, 07:44 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Scripting Problem
Minor discrepancy in your callback function.
AddUseItemCallback("", "Key", "Mansion_door", "UsedKeyonDoor", true); AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);
//Two variations. UsedKeyOnDoor & UsedKeyonDoor
void UsedKeyonDoor(string &in asItem, string &in asEntity)
//It's "UsedKeyonDoor" here
Try fixing that.
(This post was last modified: 05-20-2013, 07:59 PM by Tomato Cat.)
|
|
05-20-2013, 07:59 PM |
|
amnesiaplayer321
Junior Member
Posts: 31
Threads: 4
Joined: May 2013
Reputation:
0
|
RE: Scripting Problem
Thanks again,key gones for nothing,because the door isn't still locked.I am searching a fix for this.Is there anyway to set Door2 locked on script?
|
|
05-20-2013, 08:06 PM |
|
OriginalUsername
Posting Freak
Posts: 896
Threads: 42
Joined: Feb 2013
Reputation:
34
|
RE: Scripting Problem
Derp. Ignore what I just said.
|
|
05-20-2013, 08:27 PM |
|
amnesiaplayer321
Junior Member
Posts: 31
Threads: 4
Joined: May 2013
Reputation:
0
|
RE: Scripting Problem
Its even locked after i use the key.Why?
|
|
05-20-2013, 08:45 PM |
|
Bridge
Posting Freak
Posts: 1,971
Threads: 25
Joined: May 2012
Reputation:
128
|
RE: Scripting Problem
Did you see what Tomato Cat said? You're calling a function that doesn't exist.
AddUseItemCallback("", "Key2", "Door2", "UsedKeyOnDoor", true);
Should be:
AddUseItemCallback("", "Key2", "Door2", "UsedKeyonDoor", true);
|
|
05-20-2013, 10:01 PM |
|
|