Local Arrays

N2o)

Retired.
Reaction score
51
I have a unit array in my trigger-enhanced spell and i wanted to local it i tried "local unit udg_Dummy[0]" and "local unit udg_Dummy[1]" but they came up with errors. How do i localise an array properly in GUI custom script, and null it?
 

SFilip

Gone but not forgotten
Reaction score
634
local unit array udg_Dummy
Of course this means the entire array. As for nulling you can simply Set Dummy[0] = No unit in GUI for example.
 

N2o)

Retired.
Reaction score
51
Tried that then it tells me i am attempting to index a non-array variable and disables my trigger
 

N2o)

Retired.
Reaction score
51
Code:
Combo Right
    Events
        Player - Player 1 (Red) Presses the Right Arrow key
    Conditions
    Actions
        Custom script:   local location udg_Point
        Custom script:   local location udg_Position
        Custom script:   local group udg_Group
        Custom script:   local unit array udg_Dummy
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ComboInt Equal to 4
                (Mana of Hero) Equal to (Max mana of Hero)
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of Hero) Equal to Footman
                    Then - Actions
                        Unit - Set mana of Hero to 0.00
                        Set ComboInt = 0
                        Set Position = (Position of Hero)
                        Set Group = (Units within 250.00 of Position matching ((((Matching unit) is dead) Equal to False) and ((Matching unit) Not equal to Hero)))
                        Unit Group - Pick every unit in Group and do (Actions)
                            Loop - Actions
                                Set Point = (Position of (Picked unit))
                                Special Effect - Create a special effect at Point using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
                                Special Effect - Destroy (Last created special effect)
                                Custom script:   call RemoveLocation (udg_Point)
                                Unit - Explode (Picked unit)
                        Custom script:   call DestroyGroup (udg_Group)
                        Custom script:   call RemoveLocation (udg_Position)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of Hero) Equal to Blademaster
                    Then - Actions
                        Unit - Set mana of Hero to 0.00
                        Set ComboInt = 0
                        Set Position = (Position of Hero)
                        Unit - Create 1 Blademaster Image for Player 1 (Red) at Position facing Default building facing degrees
                        Set Dummy[0] = (Last created unit)
                        Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
                        Unit - Order (Last created unit) to Orc Blademaster - Bladestorm
                        Set Point = (Position offset by 1000.00 towards 0.00 degrees)
                        Unit - Order (Last created unit) to Move To Point
                        Custom script:   call RemoveLocation (udg_Point)
                        Unit - Create 1 Blademaster Image for Player 1 (Red) at Position facing Default building facing degrees
                        Set Dummy[0] = (Last created unit)
                        Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
                        Unit - Order (Last created unit) to Orc Blademaster - Bladestorm
                        Set Point = (Position offset by 1000.00 towards 180.00 degrees)
                        Unit - Order (Last created unit) to Move To Point
                        Custom script:   call RemoveLocation (udg_Point)
                        Custom script:   call RemoveLocation (udg_Position)
                        Wait 2.00 game-time seconds
                        Special Effect - Create a special effect attached to the chest of Dummy[0] using Abilities\Spells\Orc\MirrorImage\MirrorImageDeathCaster.mdl
                        Special Effect - Destroy (Last created special effect)
                        Special Effect - Create a special effect attached to the chest of Dummy[1] using Abilities\Spells\Orc\MirrorImage\MirrorImageDeathCaster.mdl
                        Special Effect - Destroy (Last created special effect)
                        Unit - Remove Dummy[0] from the game
                        Unit - Remove Dummy[1] from the game
                    Else - Actions
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ComboInt Equal to 1
            Then - Actions
                Set ComboInt = 2
            Else - Actions
                Set ComboInt = 0
        Custom script:   set udg_Point = null
        Custom script:   set udg_Position = null
        Custom script:   set udg_Group = null
        Set Dummy[0] = No unit
        Set Dummy[1] = No unit
my trigger code at the moment.
edit - OMG i need to read. I changed to unit array udg_Dummy but now it expects a name.
 

SFilip

Gone but not forgotten
Reaction score
634
AFAIK you can't have more than one "fake" local in a trigger...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top