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

[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