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

IssuePointOrder in loop

Status
Not open for further replies.
Level 2
Joined
May 31, 2019
Messages
20
Here is my code:

function Trig_orderConditions takes nothing returns boolean
return ((GetSpellAbilityId() == 'A002'))
endfunction

function Trig_orderActions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local unit t = CreateUnit(GetOwningPlayer(u), 'e000', x, y, 0)
local integer i = 1
local real x0
local real y0
call UnitApplyTimedLife(t, 'BHwe', 10)
call UnitAddAbility(t, 'A003')
call SetUnitAbilityLevel(t, 'A003', 1)
loop
exitwhen i > 36
set x0 = x + 100 * CosBJ(10.0 * I2R(i))
set y0 = y + 100 * SinBJ(10.0 * I2R(i))
call BJDebugMsg("x:" + R2S(x0) + ", y:" + R2S(y0))
call IssuePointOrder(t, "carrionswarm", x0, y0)
set i = i + 1
endloop
set u = null
set t = null
endfunction

//===========================================================================
function InitTrig_order takes nothing returns nothing
set gg_trg_order = CreateTrigger()
#ifdef DEBUG
call YDWESaveTriggerName(gg_trg_order, "order")
#endif
call TriggerRegisterAnyUnitEventBJ( gg_trg_order, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(gg_trg_order, Condition(function Trig_orderConditions))
call TriggerAddAction(gg_trg_order, function Trig_orderActions)
endfunction

What I expected to see is a circle but in game I only got one spelled to the right. I already change the Cool1 and Cost1 to 0.00.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Here is my code:

JASS:
function Trig_orderConditions takes nothing returns boolean
    return ((GetSpellAbilityId() == 'A002'))
endfunction

function Trig_orderActions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local unit t = CreateUnit(GetOwningPlayer(u), 'e000', x, y, 0)
    local integer i = 1
    local real x0
    local real y0
    call UnitApplyTimedLife(t, 'BHwe', 10)
    call UnitAddAbility(t, 'A003')
    call SetUnitAbilityLevel(t, 'A003', 1)
    loop
        exitwhen i > 36
        set x0 = x + 100 * CosBJ(10.0 * I2R(i))
        set y0 = y + 100 * SinBJ(10.0 * I2R(i))
        call BJDebugMsg("x:" + R2S(x0) + ", y:" + R2S(y0))
        call IssuePointOrder(t, "carrionswarm", x0, y0)
        set i = i + 1
    endloop
    set u = null
    set t = null
endfunction

//===========================================================================
function InitTrig_order takes nothing returns nothing
    set gg_trg_order = CreateTrigger()
#ifdef DEBUG
    call YDWESaveTriggerName(gg_trg_order, "order")
#endif
    call TriggerRegisterAnyUnitEventBJ( gg_trg_order, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition(gg_trg_order, Condition(function Trig_orderConditions))
    call TriggerAddAction(gg_trg_order, function Trig_orderActions)
endfunction

What I expected to see is a circle but in game I only got one spelled to the right. I already change the Cool1 and Cost1 to 0.00.

Ftfy

Edit: the issue is that the spell isn't able to be cast by the same unit over and over in one instant.

You'll have to use a trick like add ability, cast spell, remove ability. You might also have to remove 'Amov' from the caster.
 
Level 2
Joined
May 31, 2019
Messages
20
Ftfy

Edit: the issue is that the spell isn't able to be cast by the same unit over and over in one instant.

You'll have to use a trick like add ability, cast spell, remove ability. You might also have to remove 'Amov' from the caster.
Thank you for reply. Your solution is a good way and I already found another way which is that change more args of e000 like castbsw, blend and so on.
 
Level 9
Joined
Jul 20, 2018
Messages
176
I already change the Cool1 and Cost1 to 0.00.
Have you fields Art - Animation - Cast Point and Art - Animation - Cast Backswing set to 0?
castbsw, blend and so on.
Ok, I see this.

But some spells cannot be cast even if all such conditions are satisfied. Chain Lightning cannot be cast if previous bolt still exists. Each hit requires 0.25 s, so if X targets are maximum, then for 0.25 * X seconds after cast Chain Lightning cannot be cast 2nd time.

I suggest you to use my dummy, just copy it into your map (via opening 2 maps in editor and switching between them via Window submenu).
 

Attachments

  • TempMap.w3x
    16.2 KB · Views: 91
Level 2
Joined
May 31, 2019
Messages
20
Have you fields Art - Animation - Cast Point and Art - Animation - Cast Backswing set to 0?

Ok, I see this.

But some spells cannot be cast even if all such conditions are satisfied. Chain Lightning cannot be cast if previous bolt still exists. Each hit requires 0.25 s, so if X targets are maximum, then for 0.25 * X seconds after cast Chain Lightning cannot be cast 2nd time.

I suggest you to use my dummy, just copy it into your map (via opening 2 maps in editor and switching between them via Window submenu).
I will check your dummy. Thanks a lot!
 
Status
Not open for further replies.
Top