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

Ability IDs Help

Status
Not open for further replies.
Level 2
Joined
Jul 20, 2016
Messages
9
So I'm trying to save abilities that a unit has that aren't ever learned by the unit except through triggers. Is there a custom script function that can convert the ability into an integer so i can save and then load it through CodeGen?
 
Store the abilities in an array, then do a lookup. The array index is the value you should save.

  • Set Ablity[0] = Flame Strike
  • Set Ability[1] = Blizzard
  • For (Integer A) 0 through 1 do (actions)
    • If (Unit level of Ability[(Integer A)] is greater than 0 then do (actions)
      • Set AbilityIntegerVal[Counter] = (Integer A)
      • Set Counter = Counter + 1
 
Level 2
Joined
Jul 20, 2016
Messages
9
Ah perfect, the author of CodeGen repsonds. Thanks so much for this system btw its awesome! :)

So the problem I'm running into is that I need the abilities to be saved in a precise order. I have given each ability that the unit learns its own variable called CustomAbilityX[playernumber] (X being 1-8. 8 different array variables). If it runs the lookup like you created for the CodeGen, it might not spit out the abilities in the right order and then then CustomAbility4[playernumber] might become CustomAbility1[playernumber] which would kinda screw up the spell "experience system" i have made for my map. Because as you learn an ability, it becomes CustomAbilityX[playernumber] depending on the order you learn them in so the order you learn them in might not be the same order the CodeGen looks them up.

Is there a way to just say something like "Get AbilityID of udg_CustomAbility1[udg_playernumber]" and just have it repeat that for all my variables so that it saves and loads them in the right order? Or am i just going to have to rethink my spell experience system.
 
Level 10
Joined
Jun 6, 2007
Messages
392
Basically abilities are (stored as) integers. I'm assuming that you use gui, else you wouldn't even have an ability type and would store abilities in an integer array. You may use a custom script to set an ability into an integer variable: "custom script: set udg_intVar = udg_abilityVar".
 
Status
Not open for further replies.
Top