Saving hero & skills into a variable

XeRo13g

New Member
Reaction score
3
Lets assume a hero level 20 that is pre-placed on the map. His level and his abilities are set by double clicking on the image etc.

Is it possible to copy this hero WITH his abilities via storing it into a variable or by using any kind of trigger?
When I tried that, it created a hero of the correct type and level but with no abilities.

ps. Setting each ability for each individual hero via trigger isn't what I'm looking for.
EDIT: Unless there is a way for a trigger to catch the first, second, third (and so on) skills of the character

Thanks in advance.
 

akuzaid93

New Member
Reaction score
3
I can't find such action. You cannot learn an ability through triggers.

but I'm not 100% sure.
 

evilwolf

Member
Reaction score
11
I can't find such action. You cannot learn an ability through triggers.

but I'm not 100% sure.

Hmmm....
Try this, its an example:
In my map, i have a Paladin
All of his abilities are at max level and he is level 10
And I want to create a Hero exactly like him
So how do I do it?
Heres the answer:
Code:
Hero Spells
    Events
        Map initialization
    Conditions
    Actions
        Unit - Create 1 (Unit-type of Paladin 0000 <gen>) for Player 1 (Red) at (Random point in (Playable map area)) facing Default building facing degrees
        Hero - Set (Last created unit) Hero-level to 10, Hide level-up graphics
        Hero - Learn skill for (Last created unit): Holy Light
        Hero - Learn skill for (Last created unit): Holy Light
        Hero - Learn skill for (Last created unit): Holy Light
        Hero - Learn skill for (Last created unit): Divine Shield
        Hero - Learn skill for (Last created unit): Divine Shield
        Hero - Learn skill for (Last created unit): Divine Shield
        Hero - Learn skill for (Last created unit): Devotion Aura
        Hero - Learn skill for (Last created unit): Devotion Aura
        Hero - Learn skill for (Last created unit): Devotion Aura
        Hero - Learn skill for (Last created unit): Resurrection
Increasing the hero level automatically gives you 10 skill points. So you don't need to give it anymore skill points.
It works too!
 

tommerbob

Minecraft. :D
Reaction score
110
Lets assume a hero level 20 that is pre-placed on the map. His level and his abilities are set by double clicking on the image etc.

Is it possible to copy this hero WITH his abilities via storing it into a variable or by using any kind of trigger?
When I tried that, it created a hero of the correct type and level but with no abilities.

ps. Setting each ability for each individual hero via trigger isn't what I'm looking for.
EDIT: Unless there is a way for a trigger to catch the first, second, third (and so on) skills of the character

Thanks in advance.

You need to save the abilities and levels to variables, then add those abilities again to the new hero.
 

XeRo13g

New Member
Reaction score
3
Thanks for the reply, guys.

To Evilwolf: That would require me to set up each individual ability for each individual Hero which doesn't worth the effort if there are more than a few heroes.

To Tommerbob: Can you please elaborate?
Unless there is a way to save the 1st ability of a hero to a variable, I don't see how this can help?!
 

evilwolf

Member
Reaction score
11
Thanks for the reply, guys.

To Evilwolf: That would require me to set up each individual ability for each individual Hero which doesn't worth the effort if there are more than a few heroes.

To Tommerbob: Can you please elaborate?
Unless there is a way to save the 1st ability of a hero to a variable, I don't see how this can help?!

Don't use a variable, use a hastable
Use the save/load ability handle to save/load ability...
I'm sorry I can't post you a trigger because World Editor keeps on crashing when I click on the save ability handle function. =(
You probably can't either because that is only avaliable in JASS I think...
Just you used the method I showed you, if it is only a few(1-10) then it is not a big deal...
Or try this:
Code:
Hero
    Events
        Map initialization
    Conditions
    Actions
        Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
        Selection - Select (Last created unit) for Player 1 (Red)
        Hero - Set (Last created unit) Hero-level to 10, Hide level-up graphics
        If ((Level of Holy Light for Paladin 0000 <gen>) Equal to 1) then do (Hero - Learn skill for (Last created unit): Human Paladin - Holy Light) else do (Do nothing)
        If ((Level of Holy Light for Paladin 0000 <gen>) Equal to 2) then do (Hero - Learn skill for (Last created unit): Human Paladin - Holy Light) else do (Do nothing)
        If ((Level of Holy Light for Paladin 0000 <gen>) Equal to 3) then do (Hero - Learn skill for (Last created unit): Human Paladin - Holy Light) else do (Do nothing)
        If ((Level of Divine Shield for Paladin 0000 <gen>) Equal to 1) then do (Hero - Learn skill for (Last created unit): Human Paladin - Divine Shield) else do (Do nothing)
        If ((Level of Divine Shield for Paladin 0000 <gen>) Equal to 2) then do (Hero - Learn skill for (Last created unit): Human Paladin - Divine Shield) else do (Do nothing)
        If ((Level of Divine Shield for Paladin 0000 <gen>) Equal to 3) then do (Hero - Learn skill for (Last created unit): Human Paladin - Divine Shield) else do (Do nothing)
        If ((Level of Devotion Aura for Paladin 0000 <gen>) Equal to 1) then do (Hero - Learn skill for (Last created unit): Human Paladin - Devotion Aura) else do (Do nothing)
        If ((Level of Devotion Aura for Paladin 0000 <gen>) Equal to 2) then do (Hero - Learn skill for (Last created unit): Human Paladin - Devotion Aura) else do (Do nothing)
        If ((Level of Devotion Aura for Paladin 0000 <gen>) Equal to 3) then do (Hero - Learn skill for (Last created unit): Human Paladin - Devotion Aura) else do (Do nothing)
        If ((Level of Resurrection for Paladin 0000 <gen>) Equal to 1) then do (Hero - Learn skill for (Last created unit): Human Paladin - Resurrection) else do (Do nothing)
This trigger creates a Paladin...
Then checks the skill of the original Paladin then learns it...
It works too...
Although its better to store it in a Ability array, checks the level of the ability for the original Paladin, then learns the skill..
 

XeRo13g

New Member
Reaction score
3
I've never touched Hashtables so far, maybe it's time to do so.

Even though this is a crude way to deal with the problem at hand, it surely broaden my perspective and -it is- a solution. THANKS!!! +rep


There will be around >50 heroes, each got 5 abilities (all custom) with 16 levels for each ability. So, I will still be looking for a different way to deal with it. Anyone who comes up with an idea, please post here or PM me.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top