Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to replace entities?
GoreGrinder99 Offline
Member

Posts: 166
Threads: 47
Joined: Feb 2013
Reputation: 1
#1
How to replace entities?

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?

-Grind to the Gore-
(This post was last modified: 05-24-2014, 09:22 PM by GoreGrinder99.)
05-24-2014, 09:19 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: How to replace entities?

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
Find
GoreGrinder99 Offline
Member

Posts: 166
Threads: 47
Joined: Feb 2013
Reputation: 1
#3
RE: How to replace entities?

(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!!

-Grind to the Gore-
05-24-2014, 11:36 PM
Find




Users browsing this thread: 1 Guest(s)