• 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.

[Solved] Issuing orders to units with Locust

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
I'm trying to use the following code to order a unit with locust to attack a nearby unit

JASS:
                call GroupEnumUnitsInRange(g, GetUnitX(toHide), GetUnitY(toHide), 350, viableTargetFilter)
                set u = FirstOfGroup(g)
                call print("null?")
                if u != null then
                    call print("yes!")
                    call IssueTargetOrderById(toHide, 'Aatk', u)
                else
                    call print("no")
                endif

it prints null? YES! (contradictd myself there n accident) but its over and over again. The unit isn't being issued to move at all.

Is it possible or are there any alternatives? the point is that the unit is like a shadow that autoattacks nearby targets.
 
Does the unit have move speed. Also, you should check if the order is successful. IssueTargetOrderById returns a boolean:
JASS:
if IssueTargetOrderById(toHie, 'Aatk', u) then
    call print("successful order")
else
    call print("failed order")
endif

I don't know the behavior of locust units as far as attacking goes, but perhaps that^ may lead you into the right direction.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You cant pick units with Locust that way afaik. You have to pick all units of type, or all units owned by player, or something like that.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
You cant pick units with Locust that way afaik. You have to pick all units of type, or all units owned by player, or something like that.

the variable "toHide" was the unit with the locust. :p

Maker's solution worked fine. Ty! +rep to all

@purge I knew the attack wasn't successful so that wouldn't help me too much :D

e/ cant rep purge. :(
 
Status
Not open for further replies.
Top