| Datguy5   Senior Member
 
 Posts: 629
 Threads: 25
 Joined: Dec 2011
 Reputation: 
12
 | 
			| Something wrong with my script[Solved] 
 
				Solved!
			 
 
				
(This post was last modified: 10-12-2014, 10:29 AM by Datguy5.)
 |  | 
	| 10-11-2014, 11:05 PM |  | 
	
		| MrBehemoth   Senior Member
 
 Posts: 408
 Threads: 19
 Joined: Feb 2014
 Reputation: 
40
 | 
			| RE: Something wrong with my script 
 
				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.
 
 
				
(This post was last modified: 10-12-2014, 12:09 AM by MrBehemoth.)
 |  | 
	| 10-12-2014, 12:04 AM |  | 
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: Something wrong with my script 
 
				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).
 
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  | 
	| 10-12-2014, 01:54 AM |  | 
	
		| Datguy5   Senior Member
 
 Posts: 629
 Threads: 25
 Joined: Dec 2011
 Reputation: 
12
 | 
			| RE: Something wrong with my script 
 
				Ahh okay. Thanks for this both of ya.
			 
 |  | 
	| 10-12-2014, 10:28 AM |  |