• 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.

[Solved] How to store an ability in a hashtable?

Status
Not open for further replies.
Level 7
Joined
Jan 28, 2012
Messages
266
change it to an integer var like this
  • Custom Script: set udg_Int = udg_abil
than save that with the hastable, and when you load it do the reverse,
  • Custom Script: set udg_abil = udg_Int
Explanation: Why it works, ability vars are integers(basically) gui just doesn't recognize this.
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
  • Custom script: call SaveInteger(udg_AbilityHash,'Hamg',1,'AHbz')

Thank you. I'll try that.

EDIT :
  • AI Herp Learn Skill
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Owner of (Triggering unit)) controller) Equal to Computer
    • Actions
      • Custom script: set udg_TempAbility = LoadIntegerBJ(GetHandleIdBJ(GetUnitsOfTypeIdAll(GetUnitTypeId(GetTriggerUnit()))), GetHeroLevel(GetTriggerUnit()), udg_AbilityHash)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Hero level of (Triggering unit)) Less than or equal to 3
              • (Hero level of (Triggering unit)) Equal to 6
        • Then - Actions
          • Unit - Add TempAbility to (Triggering unit)
        • Else - Actions
          • Unit - Set level of TempAbility for (Triggering unit) to ((Level of TempAbility for (Triggering unit)) + 1)
      • Custom script: set udg_TempAbility = 0
This won't work. Why???
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
GetUnitsOfTypeIdAll returns a group, so you will never get the right handle ID there. I think you meant to get a unit who corresponds to that type ID, right?

Yes, I'll try that.

EDIT :
  • Custom script: set udg_TempAbility = LoadIntegerBJ(GetHandleIdBJ(GetUnitTypeId(GetTriggerUnit())),GetHeroLevel(GetTriggerUnit()), udg_AbilityHash)
Won't work. I WE will say that it is wrong.
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
You can't do GetHandleId(GetUnitTypeId(GetTriggerUnit())). Do you mean to store the data TO the triggering unit?

I want to save an ability with
Key1 : Unit type of Blademaster
Key2 : Level to learn the ability

Then load it with
Event - Unit gains a level
Load ability
Key1 : Unit type of (Triggering unit)
Key2 : Level of triggering unit
Then make unit learn the saved ability.

Is it possible to do that?
 
Level 14
Joined
Jul 25, 2011
Messages
1,065
Then don't use GetHandleId, just use GetUnitTypeId directly.

Thank you for your help. I'll try that.

EDIT : This maybe a noob question but..
  • Custom script: set udg_TempAbility = LoadInteger( GetUnitTypeId(GetTriggerUnit()), GetHeroLevel(GetTriggerUnit()), udg_AbilityHash)
What's wrong with this custom script? WE won't let me use it.
 
Status
Not open for further replies.
Top