08-01-2011, 05:40 PM
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.
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!
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!