• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Why does a "smart" GroupTargetOrder on a friendly unit not work?

Status
Not open for further replies.
As in the title. When I do this:
JASS:
    private function SquadTargetOrder takes nothing returns nothing
        local trigger trg = GetTriggeringTrigger()
    
        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Target: " + OrderId2String(GetIssuedOrderId()))
    
        call DisableTrigger(trg) // Prevent infinite loop
        call GroupTargetOrder(UnitGetSquad(GetOrderedUnit()), OrderId2String(GetIssuedOrderId()), GetOrderTarget())
        call TriggerSleepAction(0.01)
        call EnableTrigger(trg)
    
        set trg = null
    endfunction

It works perfectly fine, except when right-clicking a friendly unit. Does anyone know why, or how to fix this?

Edit: well, "fixed" it by doing this:
JASS:
        if order == "smart" and targetUnit != null and IsPlayerAlly(GetOwningPlayer(orderedUnit), GetOwningPlayer(targetUnit)) then
            call GroupPointOrder(UnitGetSquad(orderedUnit), order, GetUnitX(targetUnit), GetUnitY(targetUnit))
        else
            call GroupTargetOrder(UnitGetSquad(orderedUnit), order, GetOrderTarget())
        endif
 
Last edited:
Status
Not open for further replies.
Back
Top