Frictional Games Forum (read-only)
[SCRIPT] This won't work for some reason... - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] This won't work for some reason... (/thread-16895.html)



This won't work for some reason... - ElectricRed - 07-11-2012

I wrote a simple script and for some reason it's not working. I've tried everything. (Yes, I double checked the name of the area in the level editor. Tongue )

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "AreaSeeMonster", "SeeMonster", true, 1);
}

void SeeMonster(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("monster_1");
    StartPlayerLookAt("monster_1", 2.0f, 2.0f, "");
    GiveSanityDamage(15, true);
    AddDebugMessage("SeeMonster", false);
}

I get no errors when loading the map or anything. It just doesn't work. The debug message doesn't show up either. Is there a reason why this could be happening?

Thanks.


RE: This won't work for some reason... - Adny - 07-11-2012

Everything in your script appears to be correct. Is the name of the .hps file the same as the .map file? Are they located in the same folder? Is the area "AreaSeeMonster" active in the level editor?

Also, if you have a .cache file in the same folder as your map, delete it. It prevents changes in the level editor from appearing in game; perhaps its preventing the script area from appearing altogether. Oh, and add OnEnter/OnLeave functions to your hps file as well.

Those are all of the immediate problems/fixes I can think of. Good luck.


RE: This won't work for some reason... - ElectricRed - 07-11-2012

Well, there are other scripts in the map that are working fine. It's just this one that isn't working, so I figured it was the script itself. I tried deleting the map cache, but nothing happened. The area is active in the level editor.

Thanks for the response.


RE: This won't work for some reason... - Rapture - 07-11-2012

Make sure the Area name is called "AreaSeeMonster"


RE: This won't work for some reason... - ElectricRed - 07-11-2012

Yeah it is...

Okay, so I messed around with a ton of stuff, including just rewriting the script from scratch, and somehow it started working. I have no idea how or why, but at least it's fixed! Thanks for the help. >.<


RE: This won't work for some reason... - Omyn - 07-13-2012

(07-11-2012, 09:26 PM)ElectricRed Wrote: Yeah it is...

Okay, so I messed around with a ton of stuff, including just rewriting the script from scratch, and somehow it started working. I have no idea how or why, but at least it's fixed! Thanks for the help. >.<
I noticed you missed the end } in SeeMonster. Not sure if you just missed that when you copy pasted. Glad to see you got it resolved tho.