Warcraft III resources & community, 2003–2006 · archived

IssueTargetOrder returns a boolean?

4 posts
#1

IssueTargetOrder returns a boolean?

I've seen this in a tutorial:
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.
#2
Magic.

Well, I assume that it returns whether the process was successfully fired or not

Eg. return true for "stand", false for "arigablah"

But, thats just a guess. Theres not really much point using that anyways, as I cant see where that would ever come in handy... Who knows.
#3
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...
#4
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