Frictional Games Forum (read-only)
How to replace entities? - 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: How to replace entities? (/thread-25357.html)



How to replace entities? - GoreGrinder99 - 05-24-2014

I'm not sure why anything I do is failing... I currently have two separate entities cloned over each other, one is a non-lit flare, the other, ignited. I've had luck with the SetEntitycallbackFunc function by enabling and disabling the other on ignition using the OnIgnite. Everything is labeled correctly in the map as it is in the script but I get this error when I load up the map.

---------------------------
FATAL ERROR
---------------------------
FATAL ERROR: Could not load script file 'maps/starting_map.hps'!
main (16, 5) : ERR : 'type' is not declared
main (16, 5) : ERR : Expression must be of boolean type

---------------------------
OK
---------------------------


Here is the script

void OnStart()
{
SetEntityCallbackFunc("flare", "flare_ignite");
}

void OnEnter()
{
}

void OnLeave()
{
}

void flare_ignite(string &in EntityName, string &in Type)
{
if(type == "OnIgnite")
{
SetEntityActive("flare", false);
SetEntityActive("flare_lit", true);
}
}


The unlit flare is a tinderbox item and the lit flare is a grab object.

I have been out of remission on level editing/scripting for like a year and just getting back into it so I could very well be missing something obvious.

Is there any other way to replace entities, beside the new patch scripts?


RE: How to replace entities? - Mudbill - 05-24-2014

Simple make if(type == "OnIgnite") into Type with uppercase T, in order to match the string &in Type in the parameters.


RE: How to replace entities? - GoreGrinder99 - 05-24-2014

(05-24-2014, 11:08 PM)Mudbill Wrote: Simple make if(type == "OnIgnite") into Type with uppercase T, in order to match the string &in Type in the parameters.

Hahaha, wow, thanks man, much appreciated!!