Variable Setting

Jazradel

Helping people do more by doing less.
Reaction score
102
I have two triggers that summons a pattern of flame(in a 8 armed spiral pattern) and moves them to follow my hero. My problem is the variable spinpoints[0] isn't setting it self in the Spin trigger. This means the ability will not do anything the first time and the other will create the flames at the position the flames were moved too. Whats the problem?
Code:
Spin
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Spin Storm 
    Actions
        Set cast = (Casting unit)
        Set spinpoints[0] = (Position of cast)
        Set spinno = 1
        For each (Integer A) from 0 to 7, do (Actions)
            Loop - Actions
                For each (Integer B) from 0 to 5, do (Actions)
                    Loop - Actions
                        Set spinpoints[spinno] = (spinpoints[0] offset by (((Real((Integer B))) x 50.00) + 100.00) towards (((Real((Integer A))) x 45.00) + ((Real((Integer B))) x 10.00)) degrees)
                        Set spinno = (spinno + 1)
                        Unit - Create 1 SpinUnit for (Owner of cast) at spinpoints[spinno] facing Default building facing degrees
                        Set spinunits[spinno] = (Last created unit)
        Trigger - Turn on spinupdate <gen>
        Wait 5.00 game-time seconds
        Trigger - Turn off spinupdate <gen>
        For each (Integer A) from 1 to 48, do (Actions)
            Loop - Actions
                Unit - Remove spinunits[(Integer A)] from the game
and
Code:
SpinMove
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        Set spinpoints[0] = (Position of cast)
        Set spinno = 1
        For each (Integer A) from 0 to 7, do (Actions)
            Loop - Actions
                For each (Integer B) from 0 to 5, do (Actions)
                    Loop - Actions
                        Set spinpoints[spinno] = (spinpoints[0] offset by (((Real((Integer B))) x 50.00) + 100.00) towards (((Real((Integer A))) x 45.00) + ((Real((Integer B))) x 10.00)) degrees)
                        Unit - Order spinunits[spinno] to Move To spinpoints[spinno]
                        Set spinno = (spinno + 1)
 

Grurf

Ultra Cool Member
Reaction score
30
You are setting spinno to spinno + 1 before creating the unit. This means that first the point is created, then spinno moves on to the next point (which is empty at the first cast), and then creates the unit at the spinno point.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top