• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] IssueTargetOrder returns a boolean?

Status
Not open for further replies.
Level 11
Joined
Jul 12, 2005
Messages
764
I've seen this in a tutorial:
JASS:
local boolean b = IssueTargetOrder(u, "attack",t)

I'm just interested, how does it return a boolean? What does this boolean show? I mean what do i get with it? Like is it attackable or what?
I saw that many native functions return a boolean (like this one). I don't understant.
 
Level 11
Joined
Jul 12, 2005
Messages
764
Interesting... I made an experiment around these functions and found things out. First of all, it's useless :D.
The commonly used UnitAddAbility also returns a boolean. I found that if you want to add an ability that the unit already has, it returns false. Else, it returns true, and adds the ability.
You were right about IssueTargetOrder: if the string field contains an unknown order, it returns false.
It seems, when these functions doesn't do the effect they are supposed to do, they return false.
Well that's it...
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
No, its not useless.

Its been used in some great custom functions out there, as also if there is an error in casting (not enough mana, untargetable unit/area, etc) it will return false and allows you to either do things like the IsLocPathable func by PitzerMike, or just an advanced way of debugging code

And course UnitAddAbility does :p. Around a year ago, I found out that about half the functions you expect to return nothing will instead return boolean
 
Status
Not open for further replies.
Top