Frictional Games Forum (read-only)

Full Version: How to replace entities?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
Simple make if(type == "OnIgnite") into Type with uppercase T, in order to match the string &in Type in the parameters.
(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!!