• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Saving/Loading ability in/from hashtable

Status
Not open for further replies.
Level 12
Joined
Mar 24, 2011
Messages
1,081
So I need to save and load abilities in hashtable. I found a few threads about this matter but I somehow can't figure the custom scripts.
For saving
  • Skills Copy 2
    • Events
      • Unit - A unit Learns a skill
    • Conditions
    • Actions
      • Set TempInteger = (Player number of (Triggering player))
      • Set TempInteger2 = SkillPlInt[TempInteger]
      • Custom script: set udg_TempSkill = GetLearnedSkillBJ()
      • Custom script: set udg_TempInteger3 = AbilityID(GetLearnedSkillBJ()) //the problem is in this line. It looks like this after numerous changes.
      • For each (Integer Temp_integer) from 1 to TempInteger2, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load TempInteger of Temp_integer from SkillsHash) Equal to TempInteger3
            • Then - Actions
              • Skip remaining actions
            • Else - Actions
      • Set SkillPlInt[TempInteger] = (SkillPlInt[TempInteger] + 1)
      • Hashtable - Save TempInteger3 as TempInteger of TempInteger2 in SkillsHash
      • Game - Display to (All players) the text: (Name of TempSkill)
And what shouls I do for loading ?
 
you want to get it in form of a000 or 176455724(etc)?
Mmm do ppl normaly use not the a000 ? I mean... whats the difference except the first is 4 dig... characters *?* and can be taken from world edit ?

Edit//You see I don't know which I need but I know that ability can't be saved/loaded directly into hashtable so I try as integer as some ppl said in some threads I found around.
 
ascii values are wrapped in ' ' so its like 'Hpal' for paladin etc
also keep in mind you can only do 1 character or 4, using other numbers will give you error
I think to save ability to hashtable, if you want to read that ability you need to use custom script for that
 
Here's an example:
  • Untitled Trigger 081
    • Events
      • Unit - A unit Learns a skill
    • Conditions
    • Actions
      • Custom script: set udg_i1 = GetLearnedSkill()
      • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())
      • Hashtable - Save i1 as 0 of ID in hash
      • Wait 0.00 seconds
      • Set i2 = (Load 0 of ID from hash)
      • Custom script: set udg_abil = udg_i2
      • Game - Display to Player Group - Player 1 (Red) for 2.00 seconds the text: (String((Level of abil for (Triggering unit))))
 
Status
Not open for further replies.
Back
Top