• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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