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

[Spell] 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.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Make sure your dummy unit has 0 casting/turning time. Here is an example map (I am using latest patch if it matters).
 

Attachments

  • Circle Carrion Swarm.w3x
    13.7 KB · Views: 15
I've already responded to this in The Lab. Please don't cross-post the same query. We're generally pretty quick.

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 12
Joined
Feb 22, 2010
Messages
1,115
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..
You do not need such tricks, I made no changes to attached code.
 
Status
Not open for further replies.
Top