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

Using unit arrays like unit groups

Status
Not open for further replies.
Level 7
Joined
Aug 19, 2009
Messages
278
Is there a way by which unit arrays can be used as unit groups? Like adding the units in a aoe to a unit group?

I thought of something like this. Using a Damage detection system. First 1 will damage in a aoe around a unit for 0.01 damage. Add all units that are damaged to a unit array. Are there any better methods?

Which is more efficient? Adding units to unit array by this method or unit group by the other method?
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
I think the old way is better. Using unit group, u can easily check or remove the unit from it. While using Unit Array Variable, it is more difficult to check them. By the way, what do u need it for?
 
Level 7
Joined
Aug 19, 2009
Messages
278
The spell is shadowball

It throws a shadow ball(dummy unit) at a direction. It damages any unit it touches but only once. I add damaged units in a unit array and check them if the units present in the group are already present in the unit array or not.


Now the problem is the spell is MUI but inside the loop, the loop new units are not assigned to the group if 2 casts are taking place simultaneously.

I used index arrays to make it MUI

The trigger is here but its too complicated for anyone to understand.

Basically my problem is when the loop turns 2 times new units are not added to the group. Is there any non triggered way to make a unit damage another unit in its aoe but only once?(something like dota's nerubian weaver)

JASS:
function Trig_ShadowBall_Dot_Actions takes nothing returns nothing
local unit temp
local real x
local real y
local real facing
local integer cvalue
local integer tempunitpreset
local group shadowballgroup = CreateGroup()
local integer n1
local integer n = 1
    loop
    exitwhen(n > dhcount)
            if (shadowballcast[n] == 1) then
                set x = GetUnitX(shadowballunit[n])
                set y = GetUnitY(shadowballunit[n])
                call GroupEnumUnitsInRange(shadowballgroup, x, y, 200, Filter(function TrueBoolexpr))
                    loop
                    set temp = FirstOfGroup(shadowballgroup)
                    exitwhen temp == null
                        set cvalue = GetUnitUserData(demonhunters[n])
                            if (GetPlayerId(GetOwningPlayer(temp)) != cvalue) then
                            if (GetPlayerId(GetOwningPlayer(temp)) != 15) then
                            set tempunitpreset = 0
                            set n1 = ((n*50)-50)
                                loop
                                exitwhen(n1>shadowballhitunitsno[n])
                                    if(shadowballhitunits[n1+((n*50)-50)] == temp) then
                                        set tempunitpreset = 1
                                    endif
                                    set n1 = n1 + 1
                                endloop
                                    if (tempunitpreset == 0) then
                                        call UnitDamageTarget( demonhunters[n], temp, 150, true, false, ATTACK_TYPE_NORMAL , DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
                                        set x = GetUnitX(temp)
                                        set y = GetUnitY(temp)
                                            if(shadowballboolean[n] == false) then
                                                call SetUnitX(shadowballhealdummy1[n], x)
                                                call SetUnitY(shadowballhealdummy1[n], y)
                                                call IssueTargetOrder( shadowballhealdummy1[n], "shadowstrike", demonhunters[n])
                                                set shadowballboolean[n] = true
                                            elseif(shadowballboolean[n] == true) then
                                                call SetUnitX(shadowballhealdummy2[n], x)
                                                call SetUnitY(shadowballhealdummy2[n], y)
                                                call IssueTargetOrder( shadowballhealdummy2[n], "shadowstrike", demonhunters[n])
                                                set shadowballboolean[n] = false
                                            endif
                                        set shadowballhitunitsno[n] = shadowballhitunitsno[n] + 1
                                        set shadowballhitunits[shadowballhitunitsno[n]+((n*50)-50)] = temp
                                    endif
                            endif
                            endif
                        call GroupRemoveUnit(shadowballgroup, temp)
                    endloop
                set shadowballgroup=null
                set shadowballtimer[n] = shadowballtimer[n] - 20
                    if (shadowballtimer[n] <= 0) then
                        call SetUnitAnimation( shadowballunit[n], "death" )
                        call QueueUnitAnimation( shadowballunit[n], "Stand" )
                        set shadowballcast[n] = 0
                        set shadowballhitunitsno[n] = ((n*50)-50)
                        set shadowballdeathtimer[n] = 180
                    endif
            endif
    // Animation
            if (shadowballdeathtimer[n] > 0) then
                set shadowballdeathtimer[n] = shadowballdeathtimer[n] - 20
                    if (shadowballdeathtimer[n] == 0) then
                        call hidespecial(shadowballunit[n])
                    endif
            endif
            if (shadowballtimer[n] == 0) then
                set facing = GetUnitFacing(demonhunters[n])
                call SetUnitFacing(shadowballunit[n], facing)
                call SetUnitFacing(shadowballhealdummy1[n], (facing+180))
                call SetUnitFacing(shadowballhealdummy2[n], (facing+180))
            endif
        set n = n + 1
    endloop
call DestroyGroup(shadowballgroup)
set temp = null
endfunction

//===========================================================================
function InitTrig_ShadowBall_Dot takes nothing returns nothing
    set gg_trg_ShadowBall_Dot = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_ShadowBall_Dot, 0.20 )
    call TriggerAddAction( gg_trg_ShadowBall_Dot, function Trig_ShadowBall_Dot_Actions )
endfunction



-----Edit-----

I tried re-working this. But does this leak?

Re-edit doesn't work in MUI
JASS:
function Trig_ShadowBall_Dot_Actions takes nothing returns nothing
local unit temp
local real x
local real y
local real facing
local integer cvalue
local integer tempunitpreset
local group shadowballgroup
local integer n1
local integer n = 1
    loop
    exitwhen(n > dhcount)
            if (shadowballcast[n] == 1) then
                set shadowballgroup = CreateGroup()
                set x = GetUnitX(shadowballunit[n])
                set y = GetUnitY(shadowballunit[n])
                call GroupEnumUnitsInRange(shadowballgroup, x, y, 200, Filter(function TrueBoolexpr))
                    loop
                    set temp = FirstOfGroup(shadowballgroup)
                    exitwhen temp == null
                        set cvalue = GetUnitUserData(demonhunters[n])
                            if (GetPlayerId(GetOwningPlayer(temp)) != cvalue) then
                            if (GetPlayerId(GetOwningPlayer(temp)) != 15) then
                            set tempunitpreset = 0
                            set n1 = ((n*50)-50)
                                loop
                                exitwhen(n1>shadowballhitunitsno[n])
                                    if(shadowballhitunits[n1+((n*50)-50)] == temp) then
                                        set tempunitpreset = 1
                                    endif
                                    set n1 = n1 + 1
                                endloop
                                    if (tempunitpreset == 0) then
                                        call UnitDamageTarget( demonhunters[n], temp, 150, true, false, ATTACK_TYPE_NORMAL , DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
                                        set x = GetUnitX(temp)
                                        set y = GetUnitY(temp)
                                            if(shadowballboolean[n] == false) then
                                                call SetUnitX(shadowballhealdummy1[n], x)
                                                call SetUnitY(shadowballhealdummy1[n], y)
                                                call IssueTargetOrder( shadowballhealdummy1[n], "shadowstrike", demonhunters[n])
                                                set shadowballboolean[n] = true
                                            elseif(shadowballboolean[n] == true) then
                                                call SetUnitX(shadowballhealdummy2[n], x)
                                                call SetUnitY(shadowballhealdummy2[n], y)
                                                call IssueTargetOrder( shadowballhealdummy2[n], "shadowstrike", demonhunters[n])
                                                set shadowballboolean[n] = false
                                            endif
                                        set shadowballhitunitsno[n] = shadowballhitunitsno[n] + 1
                                        set shadowballhitunits[shadowballhitunitsno[n]+((n*50)-50)] = temp
                                    endif
                            endif
                            endif
                        call GroupRemoveUnit(shadowballgroup, temp)
                    endloop
                set shadowballgroup=null
                set shadowballtimer[n] = shadowballtimer[n] - 20
                    if (shadowballtimer[n] <= 0) then
                        call SetUnitAnimation( shadowballunit[n], "death" )
                        call QueueUnitAnimation( shadowballunit[n], "Stand" )
                        set shadowballcast[n] = 0
                        set shadowballhitunitsno[n] = ((n*50)-50)
                        set shadowballdeathtimer[n] = 180
                    endif
            endif
    // Animation
            if (shadowballdeathtimer[n] > 0) then
                set shadowballdeathtimer[n] = shadowballdeathtimer[n] - 20
                    if (shadowballdeathtimer[n] == 0) then
                        call hidespecial(shadowballunit[n])
                    endif
            endif
            if (shadowballtimer[n] == 0) then
                set facing = GetUnitFacing(demonhunters[n])
                call SetUnitFacing(shadowballunit[n], facing)
                call SetUnitFacing(shadowballhealdummy1[n], (facing+180))
                call SetUnitFacing(shadowballhealdummy2[n], (facing+180))
            endif
        set n = n + 1
    call DestroyGroup(shadowballgroup)
    endloop
set temp = null
endfunction

//===========================================================================
function InitTrig_ShadowBall_Dot takes nothing returns nothing
    set gg_trg_ShadowBall_Dot = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_ShadowBall_Dot, 0.20 )
    call TriggerAddAction( gg_trg_ShadowBall_Dot, function Trig_ShadowBall_Dot_Actions )
endfunction
 
Level 13
Joined
Jan 30, 2012
Messages
1,298
create group using this:
Custom script: set udg_YourGroupVar[udg_IndexVar] = CreateGroup()
then you add picked unit in AoE to YourGroupVar
use this
  • Unit Group - add picked unit to YourGroupVar
when you done with the spell, destroy it
Custom script: call DestroyGroup(udg_YourGroupVar[udg_IndexVar])
i don't know you did it in either GUI or Jass but both can be done
 
Last edited:
Level 29
Joined
Oct 24, 2012
Messages
6,543
change this
JASS:
local group shadowballgroup
to this
JASS:
local group shadowballgroup = CreateGroup()
the problem is ur never creating the group.
also this is jass everyone not GUI.

change this
JASS:
call TriggerRegisterTimerEventPeriodic( gg_trg_ShadowBall_Dot, 0.20 )
to this
JASS:
call TriggerRegisterTimerEvent( gg_trg_ShadowBall_Dot, 0.20, true)

and still when using jass anything u use twice or more store into a variable and use the variable

u should also learn how to properly indent.
function Trig_ShadowBall_Dot_Actions takes nothing returns nothing
local unit temp
local real x
local real y
local real facing
local integer cvalue
local integer tempunitpreset
local group shadowballgroup
local integer n1
local integer n = 1
loop
exitwhen(n > dhcount)
if (shadowballcast[n] == 1) then
set shadowballgroup = CreateGroup()
set x = GetUnitX(shadowballunit[n])
set y = GetUnitY(shadowballunit[n])
call GroupEnumUnitsInRange(shadowballgroup, x, y, 200, Filter(function TrueBoolexpr))
loop
set temp = FirstOfGroup(shadowballgroup)
exitwhen temp == null
set cvalue = GetUnitUserData(demonhunters[n])
if (GetPlayerId(GetOwningPlayer(temp)) != cvalue) and (GetPlayerId(GetOwningPlayer(temp)) != 15) then
set tempunitpreset = 0
set n1 = ((n*50)-50)
loop
exitwhen(n1>shadowballhitunitsno[n])
if(shadowballhitunits[n1+((n*50)-50)] == temp) then
set tempunitpreset = 1
endif
set n1 = n1 + 1
endloop
if (tempunitpreset == 0) then
call UnitDamageTarget( demonhunters[n], temp, 150, true, false, ATTACK_TYPE_NORMAL , DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS )
set x = GetUnitX(temp)
set y = GetUnitY(temp)
if(shadowballboolean[n] == false) then
call SetUnitX(shadowballhealdummy1[n], x)
call SetUnitY(shadowballhealdummy1[n], y)
call IssueTargetOrder( shadowballhealdummy1[n], "shadowstrike", demonhunters[n])
set shadowballboolean[n] = true
elseif(shadowballboolean[n] == true) then
call SetUnitX(shadowballhealdummy2[n], x)
call SetUnitY(shadowballhealdummy2[n], y)
call IssueTargetOrder( shadowballhealdummy2[n], "shadowstrike", demonhunters[n])
set shadowballboolean[n] = false
endif
set shadowballhitunitsno[n] = shadowballhitunitsno[n] + 1
set shadowballhitunits[shadowballhitunitsno[n]+((n*50)-50)] = temp
endif
endif
call GroupRemoveUnit(shadowballgroup, temp)
endloop
set shadowballgroup=null
set shadowballtimer[n] = shadowballtimer[n] - 20
if (shadowballtimer[n] <= 0) then
call SetUnitAnimation( shadowballunit[n], "death" )
call QueueUnitAnimation( shadowballunit[n], "Stand" )
set shadowballcast[n] = 0
set shadowballhitunitsno[n] = ((n*50)-50)
set shadowballdeathtimer[n] = 180
endif
endif
// Animation
if (shadowballdeathtimer[n] > 0) then
set shadowballdeathtimer[n] = shadowballdeathtimer[n] - 20
if (shadowballdeathtimer[n] == 0) then
call hidespecial(shadowballunit[n])
endif
endif
if (shadowballtimer[n] == 0) then
set facing = GetUnitFacing(demonhunters[n])
call SetUnitFacing(shadowballunit[n], facing)
call SetUnitFacing(shadowballhealdummy1[n], (facing+180))
call SetUnitFacing(shadowballhealdummy2[n], (facing+180))
endif
set n = n + 1
call DestroyGroup(shadowballgroup)
endloop
set temp = null
endfunction

//===========================================================================
function InitTrig_ShadowBall_Dot takes nothing returns nothing
set gg_trg_ShadowBall_Dot = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_ShadowBall_Dot, 0.20 )
call TriggerAddAction( gg_trg_ShadowBall_Dot, function Trig_ShadowBall_Dot_Actions )
endfunction
 
Level 7
Joined
Aug 19, 2009
Messages
278
change this
JASS:
local group shadowballgroup
to this
JASS:
local group shadowballgroup = CreateGroup()
the problem is ur never creating the group.
also this is jass everyone not GUI.

I had done that.. For testing I changed it.. Its in the first trigger I posted.

create group using this:
Custom script: set udg_YourGroupVar[udg_IndexVar] = CreateGroup()
then you add picked unit in AoE to YourGroupVar
use this
  • Unit Group - add picked unit to YourGroupVar
when you done with the spell, destroy it
Custom script: call DestroyGroup(udg_YourGroupVar[udg_IndexVar])
i don't know you did it in either GUI or Jass but both can be done

I don't want array of groups. I want an array to function like a group.

---edit----

How does "Shukuchi" work of dotas Nerubian Weaver. Basically It deals damage to the target it touches but only once not more than once till a duration.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
When u go through a unit, check if that unit is in the Damaged Group or not then deal damage. After deal damage, add that unit to the Damaged Group so that it wont be damaged again. When Shukuchi fade, destroy the Damaged Group so that u can damage them again.
 
Level 13
Joined
Jan 30, 2012
Messages
1,298
you have to use array groups if you wish to use indexing to make it completely MUI

How does "Shukuchi" work of dotas Nerubian Weaver. Basically It deals damage to the target it touches but only once not more than once till a duration.
use array groups

When u go through a unit, check if that unit is in the Damaged Group or not then deal damage. After deal damage, add that unit to the Damaged Group so that it wont be damaged again. When Shukuchi fade, destroy the Damaged Group so that u can damage them again.
yeah, that's what i meant

here is example in GUI:
  • Elemental Wave Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Current_Index) from 1 to Max_Index, do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of EW_Dummy[Current_Index])
          • Set TempPoint2 = (TempPoint offset by (EW_Speed[EW_Level[Current_Index]] x 0.03) towards EW_Angle[Current_Index] degrees)
          • Unit - Move EW_Dummy[Current_Index] instantly to TempPoint2
          • Special Effect - Create a special effect at TempPoint using EW_SFX[1]
          • Special Effect - Destroy (Last created special effect)
          • Set DamageGroup[Current_Index] = (Units within EW_AoE[EW_Level[Current_Index]] of TempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of EW_Caster[Current_Index])) Equal to True) and ((((Matching unit) is A structure) Not equal to True and ((((Matching unit) is in unDamageGroup[Current_Index]) Not equal to True and ((((Matching unit) is Magic Immune Not equal to True
          • Unit Group - Pick every unit in DamageGroup[Current_Index] and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • Unit - Cause EW_Caster[Current_Index] to damage TempUnit, dealing Damage[(Level of EW_Ability for EW_Caster[Current_Index])] damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect attached to the chest of TempUnit using EW_SFX[2]
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Add TempUnit to UndamageGroup[Current_Index]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EW_DestroyTree Equal to True
            • Then - Actions
              • Unit - Order EW_TreeDestroyer[Current_Index] to Human Blood Mage - Flame Strike TempPoint
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (EW_Dummy[Current_Index] is dead) Equal to True
            • Then - Actions
              • Custom script: call DestroyGroup(udg_UndamageGroup[udg_Current_Index])
              • Unit - Remove EW_Dummy[Current_Index] from the game
              • Set EW_Dummy[Current_Index] = EW_Dummy[Max_Index]
              • Set EW_Dummy[Max_Index] = No unit
              • Set EW_Caster[Current_Index] = EW_Caster[Max_Index]
              • Set EW_Caster[Max_Index] = No unit
              • Set EW_Angle[Current_Index] = EW_Angle[Max_Index]
              • Set EW_Angle[Max_Index] = 0.00
              • Set Current_Index = (Current_Index - 1)
              • Set Max_Index = (Max_Index - 1)
            • Else - Actions
          • Custom script: call DestroyGroup(udg_DamageGroup[udg_Current_Index])
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Max_Index Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
you can see i add them to unDamageGroup but when i finished i destroy them
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
DivineLight: After the first spell is cast, if u want the 2nd spell work, u must create unDamageGroup again through a custom script:
set udg_YourGroupVariable(YourArrayNumber or udg_YourIntegerVariable if has any)=CreateGroup().
Otherwise, it wont work. I have encountered this problem before.
 
Level 13
Joined
Jan 30, 2012
Messages
1,298
here the full trigger

  • Elemental Wave Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set EW_Ability = Elemental Wave
      • -------- This is for easier to track ability --------
      • Set EW_AoE[1] = 200.00
      • Set EW_AoE[2] = 200.00
      • Set EW_AoE[3] = 200.00
      • -------- AoE is the same system in normal shockwave you can change it --------
      • Set Damage[1] = 100.00
      • Set Damage[2] = 150.00
      • Set Damage[3] = 200.00
      • -------- Damage units in the line per level, also you can change it --------
      • Set EW_StartRange = 150.00
      • -------- This will determined how far Water Elemental is summoned --------
      • Set EW_Animation = attack
      • -------- What you want your Water Elemental do when it's moving? --------
      • Set EW_Animation_Speed = 50.00
      • -------- This is the speed when your Water Elemental do it's animation --------
      • Set EW_BaseRange[1] = 1000.00
      • Set EW_BaseRange[2] = 1000.00
      • Set EW_BaseRange[3] = 1000.00
      • -------- This is the base range, how far you want your Water Elemental Travel? --------
      • -------- the formula is 1000 / Speed per level x 0.03 x 0.03 --------
      • Set EW_Speed[1] = 1000.00
      • Set EW_Speed[2] = 1000.00
      • Set EW_Speed[3] = 1000.00
      • -------- This is your water elemental speed during its travel --------
      • -------- the formula is Speed per level x 0.03 --------
      • Set EW_SFX[1] = Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
      • Set EW_SFX[2] = Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • -------- This is Special Effect you use during Travel and which Enemies take damage --------
      • Set EW_DestroyTree = True
      • -------- Set this to false if you don't want to destroy tree --------
      • Set EW_DestroyTreeAbil = DestroyTree
      • -------- Add custom flame strike ability to destroy trees --------
  • Elemental Wave Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Elemental Wave
    • Actions
      • Set Max_Index = (Max_Index + 1)
      • Set EW_Caster[Max_Index] = (Triggering unit)
      • Set EW_Owner[Max_Index] = (Owner of EW_Caster[Max_Index])
      • Set EW_Level[Max_Index] = (Level of EW_Ability for EW_Caster[Max_Index])
      • Set TempPoint = (Position of EW_Caster[Max_Index])
      • Set TempPoint2 = (Target point of ability being cast)
      • Set EW_Angle[Max_Index] = (Angle from TempPoint to TempPoint2)
      • Set TempPoint3 = (TempPoint offset by 150.00 towards EW_Angle[Max_Index] degrees)
      • Set EW_Range[Max_Index] = ((1000.00 / (EW_Speed[(Level of EW_Ability for EW_Caster[Max_Index])] x 0.03)) x 0.03)
      • Unit - Create 1 Water Elemental for EW_Owner[Max_Index] at TempPoint3 facing EW_Angle[Max_Index] degrees
      • Set EW_Dummy[Max_Index] = (Last created unit)
      • Unit - Add a EW_Range[Max_Index] second Generic expiration timer to EW_Dummy[Max_Index]
      • Unit - Create 1 TreeDestroyer for EW_Owner[Max_Index] at TempPoint facing EW_Angle[Max_Index] degrees
      • Set EW_TreeDestroyer[Max_Index] = (Last created unit)
      • Unit - Add EW_DestroyTreeAbil to EW_TreeDestroyer[Max_Index]
      • Unit - Add a EW_Range[Max_Index] second Generic expiration timer to EW_TreeDestroyer[Max_Index]
      • Animation - Change EW_Dummy[Max_Index]'s animation speed to EW_Animation_Speed% of its original speed
      • Animation - Play EW_Dummy[Max_Index]'s EW_Animation animation
      • Custom script: call RemoveLocation(udg_TempPoint3)
      • Custom script: set udg_UndamageGroup[udg_Max_Index] = CreateGroup()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Max_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Elemental Wave Loop <gen>
        • Else - Actions
  • Elemental Wave Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Current_Index) from 1 to Max_Index, do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of EW_Dummy[Current_Index])
          • Set TempPoint2 = (TempPoint offset by (EW_Speed[EW_Level[Current_Index]] x 0.03) towards EW_Angle[Current_Index] degrees)
          • Unit - Move EW_Dummy[Current_Index] instantly to TempPoint2
          • Special Effect - Create a special effect at TempPoint using EW_SFX[1]
          • Special Effect - Destroy (Last created special effect)
          • Set DamageGroup[Current_Index] = (Units within EW_AoE[EW_Level[Current_Index]] of TempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of EW_Caster[Current_Index])) Equal to True) and ((((Matching unit) is A structure) Not equal to True and ((((Matching unit) is in unDamageGroup[Current_Index]) Not equal to True and ((((Matching unit) is Magic Immune Not equal to True
          • Unit Group - Pick every unit in DamageGroup[Current_Index] and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • Unit - Cause EW_Caster[Current_Index] to damage TempUnit, dealing Damage[(Level of EW_Ability for EW_Caster[Current_Index])] damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect attached to the chest of TempUnit using EW_SFX[2]
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Add TempUnit to UndamageGroup[Current_Index]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EW_DestroyTree Equal to True
            • Then - Actions
              • Unit - Order EW_TreeDestroyer[Current_Index] to Human Blood Mage - Flame Strike TempPoint
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (EW_Dummy[Current_Index] is dead) Equal to True
            • Then - Actions
              • Custom script: call DestroyGroup(udg_UndamageGroup[udg_Current_Index])
              • Unit - Remove EW_Dummy[Current_Index] from the game
              • Set EW_Dummy[Current_Index] = EW_Dummy[Max_Index]
              • Set EW_Dummy[Max_Index] = No unit
              • Set EW_Caster[Current_Index] = EW_Caster[Max_Index]
              • Set EW_Caster[Max_Index] = No unit
              • Set EW_Angle[Current_Index] = EW_Angle[Max_Index]
              • Set EW_Angle[Max_Index] = 0.00
              • Set Current_Index = (Current_Index - 1)
              • Set Max_Index = (Max_Index - 1)
            • Else - Actions
          • Custom script: call DestroyGroup(udg_DamageGroup[udg_Current_Index])
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Max_Index Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
you can see i use this
Custom script: set udg_UndamageGroup[udg_Max_Index] = CreateGroup()
in cast TRIGGER
 
Status
Not open for further replies.
Top