• 🏆 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!

[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