1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Ability IDs Help

Discussion in 'World Editor Help Zone' started by thegodfather9, Aug 31, 2016.

  1. thegodfather9

    thegodfather9

    Joined:
    Jul 20, 2016
    Messages:
    11
    Resources:
    0
    Resources:
    0
    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?
     
  2. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,683
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    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
     
  3. thegodfather9

    thegodfather9

    Joined:
    Jul 20, 2016
    Messages:
    11
    Resources:
    0
    Resources:
    0
    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.
     
  4. Erkki2

    Erkki2

    Joined:
    Jun 6, 2007
    Messages:
    382
    Resources:
    7
    Skins:
    6
    Spells:
    1
    Resources:
    7
    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".