Frictional Games Forum (read-only)
Something wrong with my script[Solved] - 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: Something wrong with my script[Solved] (/thread-26694.html)



Something wrong with my script[Solved] - Datguy5 - 10-11-2014

Solved!


RE: Something wrong with my script - MrBehemoth - 10-12-2014

The error message is telling you that there's something wrong with the SetEntityActive function on line 92. I've not counted the lines, but I'm guessing it's this:

if(SetEntityActive("armor1") == false)

So, the first thing error message says is that it can't find a matching signature (the list of variables in the brackets) for what it expects to find for SetEntityActive. We know SetEntityActive normally has two variables, a string and a boolean, so there's the first problem. But would it be true or false? You don't know, because that's what you're testing for... but it doesn't matter because...

The second part of the error message is saying that it can't convert your if condition into a boolean in order to work out whether it equals false. That's because, like most (if not all) of the functions in HPL2, SetEntityActive returns void, which means it's a one way street.

Notice how the wiki describes it as:
void SetEntityActive(string, boolean)

void SetPizzaTopping("cheese", "tomato") means call the SetPizzaTopping function and pass it 2 variables, "cheese" and "tomato". It's then up to SetPizzaTopping what it does with those variables and it returns void: it doesn't give you anything back. SetEntityActive is no different.

If we had a function:
boolean GetEntityActive(string)
then that would be different and it would do exactly what you want it to do... But we don't.

TL;DR: Your if condition is not going to work. You can't use SetEntityActive like that.

An alternative approach would be to use a variable to store whether the entity is active or not, and update it any time you use SetEntityActive. Then check the variable in your if statement instead.


RE: Something wrong with my script - PutraenusAlivius - 10-12-2014

if(SetEntityActive("armor1") == false)

That line is wrong because you can't use SetEntityActive like that. The SetEntityActive argument is void SetEntityActive(string &in asEntity, bool abActive). The void part is bold because that's the primary issue here.

Void indicates that it doesn't return any value. You are asking if armor1 is false, but the original function doesn't return any value (hence void).


RE: Something wrong with my script - Datguy5 - 10-12-2014

Ahh okay. Thanks for this both of ya.