Frictional Games Forum (read-only)

Full Version: Script making map crash in Dev Mode.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I found out that all scripting needs to be done within the (mapname).hps file, rather than set scripts, for example, "Doorslam.hps", then linking said scripts to areas within the level editor.

Correct me if I'm wrong there please guys!

So anyways, now I've been messing around, just practicing, with a simple door slam script, so player leaves a room, and the door will slam shut behind him/her. Here's my script, copied directly from a Wiki Tutorial.

Quote:void OnStart()

{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

But now, when in Developer mode, and trying to load my map, it says it can't read the script and crashes.

By the way, Yes, I am a newcomer haha.

Thanks guys!
I kinda get the first question, but yes. All your scripts for the map are in the (mapname).hps

You said you copied the script directly? Did you copy&paste or type it all down? I see a few inconsistency, I think.
This is just me scrutinizing every detail since any typo can mess up your script.

Make sure you have a Script Area called "script_slam" in your map, and the door named "mansion_1". I'm just saying this because you said you were a newcomer, and that could mean alot of things can possibly go wrong.

Code:
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
I think that might be ok, I'll test it out later. But I think you need something in the first "", because its the internal name. Anything will do, just dont call it "Late for Dinner".

Also the "react_scare" should have a .snt normally at the end "react_scare.snt". I know you can preload the sound, but the other 2 have .snt at the end, so I would think that would also need it to.

Or the developer mode could be screwing it up, either you missed something or its just Amensia itself. The game is quite buggy in my opinion.
Go back and review the Developer Enviroment Guide and tripe-check your settings.
Change this:

Spoiler below!
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

to this:

Spoiler below!
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);