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

Check if array is empty

Status
Not open for further replies.

V

V

Level 7
Joined
Jan 13, 2019
Messages
284
I have an ability array, the indices of the abilities are the values of the levels at which the hero will learn the skill.

Example

spells[15] = Flame
spells[40] = Flame of Ice

I check when a unit gain a level and later add spells[level of triggering unit], but always add the spells to the unit.

How can i check if spells[level of triggering unit] have an ability assigned?

I have thought fill the other indices (1 to 14) with some dummy ability and check the ability that will be assigned before add to the hero, if is dummy dont do nothing.

I know is to possible check the level and later add the spell, but i thought this is more easy method.

  • SETTING VARIABLES
    • Acontecimientos
      • Map initialization
    • Condiciones
    • Acciones
      • -------- PALADIN --------
      • -------- HABILIDADES GRUPO A --------
      • For each (Integer A) from 1 to 100, do (Actions)
        • Bucle: Acciones
          • Set lista_habilidades_paladin_a[(Integer A)] = NO LEARN
      • Set lista_habilidades_paladin_a[3] = Grupo A PALADIN 03
      • Set lista_habilidades_paladin_a[12] = Grupo A PALADIN 12
      • Set lista_habilidades_paladin_a[17] = Grupo A PALADIN 17
      • Set lista_habilidades_paladin_a[21] = Grupo A PALADIN 21
      • Set lista_habilidades_paladin_a[26] = Grupo A PALADIN 26
      • Set lista_habilidades_paladin_a[33] = Grupo A PALADIN 33
      • Set lista_habilidades_paladin_a[35] = Grupo A PALADIN 35
      • Set lista_habilidades_paladin_a[45] = Grupo A PALADIN 42
      • Set lista_habilidades_paladin_a[46] = Grupo A PALADIN 46
      • Set lista_habilidades_paladin_a[51] = Grupo A PALADIN 51
      • Set lista_habilidades_paladin_a[55] = Grupo A PALADIN 55
  • GAIN LEVEL
    • Acontecimientos
      • Unidad - A unit Gana un nivel
    • Condiciones
    • Acciones
      • Partida - Display to (All players) the text: (String((Level of (Triggering unit))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si: Condiciones
          • lista_habilidades_paladin_a[(Level of (Triggering unit))] No igual a NO LEARN
        • Entonces: Acciones
          • Unidad - Add lista_habilidades_paladin_a[(Level of (Triggering unit))] to jugador_heroe
        • Otros: Acciones
 
Last edited:
Status
Not open for further replies.
Top