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

Weird IssuePointOrderLoc casting behavior

Level 3
Joined
Nov 29, 2023
Messages
13
So i have this spell 'A02R' based off channel
  • baseOrderId = orderString: "blink"
  • TargetType: Point Target
  • casting time: 0.0s
  • followTrough time: 1.0s
  • disableOtherAbilities: true
And i get the following behaviours when interacting with it
  1. manual cast -> the spell is casted as intented
  2. triggered cast via
    JASS:
    call IssuePointOrderLoc(u, "blink", GetUnitLoc(u))
    -> also works
  3. triggered cast via
    JASS:
    call IssuePointOrderLoc(u, "blink", PolarProjectionBJ(GetUnitLoc(u), 25/*or any number != 0*/, 260))
    -> wont work, the unit u will begin casting the spell, indicated by the green casting overlay in the unit command card. But the spell casting step will never complete (the green overlay will conutinue until the unit u is given a new order. (The events EVENT_PLAYER_UNIT_SPELL_EFFECT and EVENT_PLAYER_UNIT_SPELL_FINISH never fire)
whole trigger below if it helps
JASS:
function Trig_W4V2_AI_Conditions takes nothing returns boolean
    //call BJDebugMsg("actual " + I2S(GetUnitTypeId(GetAttacker())) +  " " + R2S(BlzGetUnitAbilityCooldownRemaining(GetAttacker(), 'A02R'))+ " " + I2S(GetUnitCurrentOrder(GetAttacker())))
    //call BJDebugMsg("expected " + I2S('H00T') + " 0.0 " + "not " + I2S(OrderId("blink")))
    return GetUnitTypeId(GetAttacker()) == 'H00T' and BlzGetUnitAbilityCooldownRemaining(GetAttacker(), 'A02R') == 0.0 and GetUnitCurrentOrder(GetAttacker()) != OrderId("blink")
endfunction

function Trig_W4V2_AI_Actions takes nothing returns nothing
    local unit farthest = null
    local real distanceF = 0
    local real distanceC = 0
    local unit c
    local group g = CreateGroup()
    local unit u = GetAttacker()
    local location l = GetUnitLoc(u)
    local location lc
    local player p = GetOwningPlayer(u)
    
    call GroupEnumUnitsInRangeOfLoc(g, l, 700, function True_Filter)
    loop 
        set c = FirstOfGroup(g)
        exitwhen c == null
        call GroupRemoveUnit(g, c)
        
        if (IsUnitEnemy(c, p) and UnitAlive(c) and GetUnitAbilityLevel(c,'Avul') < 1 ) then
            set lc = GetUnitLoc(c)
            set distanceC = DistanceBetweenPoints(l, lc)
            if (distanceC > distanceF) then
                set distanceF = distanceC
                set farthest = c
            endif
            call RemoveLocation(lc)
        endif
    endloop
    
    set farthest = null
    if (farthest != null) then
        set lc = GetUnitLoc(farthest)
    else
        set lc = PolarProjectionBJ(l, 25, 260)
    endif
    
    //call RemoveGuardPosition(u)
    //call BJDebugMsg(R2S(GetLocationX(lc)) + " " + R2S(GetLocationY(lc)))
    //call IssuePointOrder(u, "blink", GetLocationX(lc), GetLocationY(lc))
    
    //Test 2. this works!
    call IssuePointOrderLoc(u, "blink", GetUnitLoc(u) )
    
    //Test 3. this doesnt work!
    //call IssuePointOrderLoc(u, "blink", PolarProjectionBJ(GetUnitLoc(u), 25, 260) )
    
    call BJDebugMsg("aaaaa")
    
    call DestroyGroup(g)
    call RemoveLocation(lc)
    call RemoveLocation(l)
    set lc = null
    set l = null
    set u = null
    set c = null
    set farthest = null
    set g = null
    set p = null
endfunction

//===========================================================================
function InitTrig_W4V2_AI takes nothing returns nothing
    set gg_trg_W4V2_AI = CreateTrigger(  )
    //call DisableTrigger( gg_trg_W4V2_AI )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_W4V2_AI, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_W4V2_AI, Condition( function Trig_W4V2_AI_Conditions ) )
    call TriggerAddAction( gg_trg_W4V2_AI, function Trig_W4V2_AI_Actions )
endfunction

I've attach a pic of what i meant by "the green casting overlay" being active

Has anybody encountered this issue?
 

Attachments

  • a02r.JPG
    a02r.JPG
    32.2 KB · Views: 4
Level 24
Joined
Feb 27, 2019
Messages
833
The difference between the two is that GetUnitLoc(u) is cast instantly since the location is on the unit whilst PolarProjectionBJ(GetUnitLoc(u), 25, 260) is not cast instantly since the unit has to turn towards the point. That normally shouldnt be a problem. I cant see anything that could cause the problem within the trigger.
 
Level 3
Joined
Nov 29, 2023
Messages
13
Unfortunatly no,

the unit has movement, the ability has 1000 casting range so the target is withing range.

Btw i reproduced the issue also on a small test map.

So to recap you will see:

1 the manual cast being fine

2 the scripted cast (by ordering the archmage to amove toward the creeps) going on for forever
 

Attachments

  • testmap.w3m
    32.1 KB · Views: 3
Level 24
Joined
Feb 27, 2019
Messages
833
That was a weird one indeed.. I looked at the map. Test 3 works fine if you set the angle to AngleBetweenPoints(GetUnitLoc(u), GetUnitLoc(GetAttackedUnitBJ()). So I digged a little deeper and it appears that the unit gets stuck facing the unit it attacked whilst still trying to cast the ability. That said I am not sure setting the angle to that is 100% safe. The order does work fine on any angle after a 0.01 polled wait so skipping a frame with a timer might be an option.
 
Top