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!
Hello, i created trigger throught i can add 7 random hero abilities to hero. How can i level up this spells? Normal skill points doesnt work. How can i ''save'' added spells somewhere and when hero will gain new level, random skill will be leveled up (to max 6 level)? Also i need this get work for multiple heroes (ingame). Some help? Please
Either use a place holder hero ability that has no icon but levels up the ability when learnt or you will need to think of some other way to level the hero abilities up. It sounds like you choose the latter.
How can i ''save'' added spells somewhere and when hero will gain new level, random skill will be leveled up (to max 6 level)?
Integer (ability type in GUI) variables can store the ability type identifiers of all abilities learnt. An array could be used for convenience so that the 6 abilities can be accessed more easily. A 2D mapping of the array could be used so that multiple indices for different 6 abilities can be referenced.
When the hero gains a level you get his ability array index (hashtable? Maybe per player?) and then choose randomly one of the 6 abilities (random int from 0 to 5) and level it up. You could use a local array to create a set of abilities that are not level 6 or you could try the easy approach of if the random ability chosen is level 6 then choose the lowest index ability that is not level 6 and level that (not really random but you are probably struggling enough if you cannot generate a subset of the abilities that are not level 6 and choose one randomly).
Integer (ability type in GUI) variables can store the ability type identifiers of all abilities learnt. An array could be used for convenience so that the 6 abilities can be accessed more easily. A 2D mapping of the array could be used so that multiple indices for different 6 abilities can be referenced.
When the hero gains a level you get his ability array index (hashtable? Maybe per player?) and then choose randomly one of the 6 abilities (random int from 0 to 5) and level it up. You could use a local array to create a set of abilities that are not level 6 or you could try the easy approach of if the random ability chosen is level 6 then choose the lowest index ability that is not level 6 and level that (not really random but you are probably struggling enough if you cannot generate a subset of the abilities that are not level 6 and choose one randomly).
I'm going to try to make something like Dr Super Good suggested so you can try and see what he means, then edit this post, hold on.
EDIT: Turns out, not being able to enumerate abilities really makes this job a LOT harder.
Well, here it is, works even if heroes level up and enter region 000 (which would be, uh, your arena? well, you can replace that event with whenever you want your heroes to get their 7 random abilities, just make sure it isn't triggered twice for the same hero) at the same time.
I have to say though, this is definitely not the cleanest or best method by any means, I'm sure someone more experienced can make something better and wipe it in my face. Maybe in Jass with hashtables, both of which I know nothing about, and I assume neither do you.
In any case, here are the triggers, for the 7 ability randomizer:
Ability Randomizer Switch
Events
Unit - A unit enters Region 000 <gen>
Conditions
((Triggering unit) is in HeroesGroup) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroCount Less than 100
Then - Actions
Set HeroCount = (HeroCount + 1)
Else - Actions
Set HeroCount = 0
Set Hero[HeroCount] = (Triggering unit)
Trigger - Run Ability Randomizer <gen> (ignoring conditions)
Ability Randomizer
Events
Conditions
Actions
Set RandomLearningInteger = (Random integer number between 1 and NumberOfSpellsAvailable)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomLearningInteger Equal to 1
AbilitiesLearnedSoFar Less than 7
(Level of Acid Bomb for Hero[HeroCount]) Less than 1
Then - Actions
Unit - Add Acid Bomb to Hero[HeroCount]
Set AbilitiesLearnedSoFar = (AbilitiesLearnedSoFar + 1)
Set HeroAbility[(AbilityCount[HeroCount] + 1)] = Acid Bomb
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomLearningInteger Equal to 2
AbilitiesLearnedSoFar Less than 7
(Level of Animate Dead for Hero[HeroCount]) Less than 1
Then - Actions
Unit - Add Animate Dead to Hero[HeroCount]
Set AbilitiesLearnedSoFar = (AbilitiesLearnedSoFar + 1)
Set HeroAbility[(AbilityCount[HeroCount] + 1)] = Animate Dead
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomLearningInteger Equal to 3
AbilitiesLearnedSoFar Less than 7
(Level of Attribute Bonus for Hero[HeroCount]) Less than 1
Then - Actions
Unit - Add Attribute Bonus to Hero[HeroCount]
Set AbilitiesLearnedSoFar = (AbilitiesLearnedSoFar + 1)
Set HeroAbility[(AbilityCount[HeroCount] + 1)] = Attribute Bonus
Else - Actions
-------- So on and so forth for ALL spells available. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AbilitiesLearnedSoFar Equal to 7
Then - Actions
Set AbilitiesLearnedSoFar = 0
Else - Actions
Trigger - Run (This trigger) (ignoring conditions)
And for the random ability level up...
Ability Level Up Switch
Events
Unit - A unit Gains a level
Conditions
((Triggering unit) is in HeroesGroup) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
LevellingHeroCount Less than 100
Then - Actions
Set LevellingHeroCount = (LevellingHeroCount + 1)
Else - Actions
Set LevellingHeroCount = 0
Set LevellingHero[LevellingHeroCount] = (Triggering unit)
Trigger - Run Ability Level Up <gen> (ignoring conditions)
Ability Level Up
Events
Conditions
Actions
Set RandomLevellingInteger = (Random integer number between 1 and 7)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of HeroAbility[RandomLevellingInteger] for LevellingHero[LevellingHeroCount]) Less than 6
Then - Actions
Unit - Set level of HeroAbility[RandomLearningInteger] for LevellingHero[LevellingHeroCount] to ((Level of HeroAbility[RandomLevellingInteger] for LevellingHero[LevellingHeroCount]) + 1)
Else - Actions
Trigger - Run (This trigger) (ignoring conditions)
If you want, I can embed the map or try to explain something better. It gets a little convoluted storing an ability integer for an ability of the hero integer of the hero. Heugh. Cracked my head a bit.
EDIT2: Now that I think about it and reread Super Good's post, yeah, this would be a lot simpler if you used ability IDs (available with JASS and/or hashtables.)... Oh well. Sucks not having an ability type variable. Integer Arrays are really overkill.
I'm going to try to make something like Dr Super Good suggested so you can try and see what he means, then edit this post, hold on.
EDIT: Turns out, not being able to enumerate abilities really makes this job a LOT harder.
Well, here it is, works even if heroes level up and enter region 000 (which would be, uh, your arena? well, you can replace that event with whenever you want your heroes to get their 7 random abilities, just make sure it isn't triggered twice for the same hero) at the same time.
I have to say though, this is definitely not the cleanest or best method by any means, I'm sure someone more experienced can make something better and wipe it in my face. Maybe in Jass with hashtables, both of which I know nothing about, and I assume neither do you.
In any case, here are the triggers, for the 7 ability randomizer:
Ability Randomizer Switch
Events
Unit - A unit enters Region 000 <gen>
Conditions
((Triggering unit) is in HeroesGroup) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HeroCount Less than 100
Then - Actions
Set HeroCount = (HeroCount + 1)
Else - Actions
Set HeroCount = 0
Set Hero[HeroCount] = (Triggering unit)
Trigger - Run Ability Randomizer <gen> (ignoring conditions)
Ability Randomizer
Events
Conditions
Actions
Set RandomLearningInteger = (Random integer number between 1 and NumberOfSpellsAvailable)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomLearningInteger Equal to 1
AbilitiesLearnedSoFar Less than 7
(Level of Acid Bomb for Hero[HeroCount]) Less than 1
Then - Actions
Unit - Add Acid Bomb to Hero[HeroCount]
Set AbilitiesLearnedSoFar = (AbilitiesLearnedSoFar + 1)
Set HeroAbility[(AbilityCount[HeroCount] + 1)] = Acid Bomb
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomLearningInteger Equal to 2
AbilitiesLearnedSoFar Less than 7
(Level of Animate Dead for Hero[HeroCount]) Less than 1
Then - Actions
Unit - Add Animate Dead to Hero[HeroCount]
Set AbilitiesLearnedSoFar = (AbilitiesLearnedSoFar + 1)
Set HeroAbility[(AbilityCount[HeroCount] + 1)] = Animate Dead
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomLearningInteger Equal to 3
AbilitiesLearnedSoFar Less than 7
(Level of Attribute Bonus for Hero[HeroCount]) Less than 1
Then - Actions
Unit - Add Attribute Bonus to Hero[HeroCount]
Set AbilitiesLearnedSoFar = (AbilitiesLearnedSoFar + 1)
Set HeroAbility[(AbilityCount[HeroCount] + 1)] = Attribute Bonus
Else - Actions
-------- So on and so forth for ALL spells available. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AbilitiesLearnedSoFar Equal to 7
Then - Actions
Set AbilitiesLearnedSoFar = 0
Else - Actions
Trigger - Run (This trigger) (ignoring conditions)
And for the random ability level up...
Ability Level Up Switch
Events
Unit - A unit Gains a level
Conditions
((Triggering unit) is in HeroesGroup) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
LevellingHeroCount Less than 100
Then - Actions
Set LevellingHeroCount = (LevellingHeroCount + 1)
Else - Actions
Set LevellingHeroCount = 0
Set LevellingHero[LevellingHeroCount] = (Triggering unit)
Trigger - Run Ability Level Up <gen> (ignoring conditions)
Ability Level Up
Events
Conditions
Actions
Set RandomLevellingInteger = (Random integer number between 1 and 7)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of HeroAbility[RandomLevellingInteger] for LevellingHero[LevellingHeroCount]) Less than 6
Then - Actions
Unit - Set level of HeroAbility[RandomLearningInteger] for LevellingHero[LevellingHeroCount] to ((Level of HeroAbility[RandomLevellingInteger] for LevellingHero[LevellingHeroCount]) + 1)
Else - Actions
Trigger - Run (This trigger) (ignoring conditions)
If you want, I can embed the map or try to explain something better. It gets a little convoluted storing an ability integer for an ability of the hero integer of the hero. Heugh. Cracked my head a bit.
EDIT2: Now that I think about it and reread Super Good's post, yeah, this would be a lot simpler if you used ability IDs (available with JASS and/or hashtables.)... Oh well. Sucks not having an ability type variable. Integer Arrays are really overkill.
No problem, though you should probably consider looking up hashtables because i'm pretty sure this would be a little easier if you stored ability IDs and used those. Glad to have helped!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.