• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] How do you retrieve the index as an integer from an array?

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
I am making a system where the heroes in my map have 6 spells. 5 of the spells are chosen, and 1 is intrinsic to the hero. This 1 spell I have set as a UNIT ability, and it is going to automatically level up every 4 levels. In order to do this, I have 2 variable arrays:

Unit Type array (each unit type has its own index)
Ability array (each hero's intrinsic skill has its own index)

The index of the unit type and ability correspond. So Unit Type [1] has Ability [1] as its unit ability.

My trigger goes like this:

  • Events
  • - A unit gains a level
  • Conditions
  • - Or, multiple conditions
    • - Level of (triggering unit) = 4
    • - Level of (triggering unit) = 8
    • - Level of (triggering unit) = 12
    • - Level of (triggering unit) = 16
    • - Level of (triggering unit) = 20
  • Actions
  • - Set level of (Ability [index of unit type of (triggering unit)]) for (triggering unit) = (level of (triggering unit) / 4 + 1)
I can't figure out how to use the index number of the unit type to identify the index of the ability! Does anyone know how to do this?

I want this trigger to work this way so I don't have to make a trigger for every single hero.
 
Status
Not open for further replies.
Top