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
Noob needs scripting help.
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#1
Noob needs scripting help.

I'm working on a custom story, and I've run into a problem.
I have a locked door that I want to open with a key, but when I go into the map, the game crashes and says there was an error in the script.

This is my script:
Quote:////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("","Key_1", "mansion_3". "KeyOnDoor", true)
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("Key_1")

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

}

The map worked fine until I added the key commands into my script. Any help would be greatly appreciated.

09-04-2011, 10:54 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Noob needs scripting help.

You forgot a ; and } at the end of KeyOnDoor's code block.

Tutorials: From Noob to Pro
09-04-2011, 11:01 PM
Website Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#3
RE: Noob needs scripting help.

You didn't put a ';' and '}' at the end of your KeyOnDoor function.

RemoveItem("Key_1");
}

09-04-2011, 11:02 PM
Website Find
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#4
RE: Noob needs scripting help.

ahhh. thanks, didn't notice that.

(09-04-2011, 11:13 PM)A Tricky Carnie Wrote: ahhh. thanks, didn't notice that.
I thought I fixed it, but I guess not, heres what I have now:
Quote:////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("","Key_1", "mansion_3". "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false)
RemoveItem("Key_1");
}

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

}

the "FATAL ERROR" box that shows up when I enter the map says...
Quote:FATAL ERROR: Could not load script file
'custom_stories/CursedMansion/maps/ch01/J:Steam/steamapps/common/amnesia the dark descent/custom_stories/CursedMansion/maps/ch01/map2.hps'!
main (8,1): ERR : Unexpected token '{'

I don't know if that is of any help, but I'm assuming the (8,1) refers to line 8 of the .hps file and the 1 means the first character on that line, which would be '{', and I don't know how to fix that.


(This post was last modified: 09-04-2011, 11:49 PM by A Tricky Carnie.)
09-04-2011, 11:13 PM
Find
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#5
RE: Noob needs scripting help.

nvm, I re-wrote it, and got it to work.

09-05-2011, 02:07 AM
Find




Users browsing this thread: 3 Guest(s)