How do i use "Array" Variables?

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
array variables just let you set the one variable to multiple things.

as an example...

A player has 1 hero on your map, and you want to set that hero to a unit variable for triggering purposes so you create the variable Hero_variable.

But then you realise you have 5 players on your map, each with one hero.... and you want to use the same trigger for each player's hero.

What you do then is make the unit variable an array. 5 heroes means you want to set the variable array to 5.

Now you can set the players heroes to each number of the array of the same variable. eg set hero_variable[1] to red's hero, set hero_variable[2] to blue's hero... etc (if the heroes are placed before the map starts, you can set this at initialisation, if the heroes are selected by the player, you can set it as the last created unit)

Now when you make your trigger, you can use the 1 variable to work for all of the heroes on the map. It'd work like this -

Event - A unit enters death_rect

Condition - unit is equal to hero_variable[(player number of (owner of triggering unit))]

Action - kill triggering unit

by setting the variable number to the player number of the units owner, the trigger will automatically detect which players hero unit has just set it off, and the resulting actions will occur to that unit
 
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