• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] How make heroes spend skill points automatically.

Status
Not open for further replies.
Level 1
Joined
Nov 16, 2019
Messages
3
In my map i can buy a hero from the tavern.
After i bought a hero, he changes the player from me to a Computer player.
But when gets level up, he is not using any abilities.

How can i fix that?
 
Level 1
Joined
Nov 16, 2019
Messages
3
Weclome th the Hive!

  • Hero - Learn skill for (Triggering unit): Human Archmage - Blizzard
Use this action.

Triggering unit is the hero. Be aware that the hero must have more levels to learn every ability. So every time the hero levels up you need to use this action again

But then the hero will skill the same ability every time when i start the game.
Isn't there an option to skill a random ability while having an unused skill point?
I mean without programing a lot for each unique hero?^^
 
Level 9
Joined
Sep 20, 2015
Messages
385
You can store abilities in array variables.

Ability[1], Ability[2], ability[3] and so on.

Then every time the ero levels up you use that action with the variable and a random number.

  • Hero - Lean skill for (Triggering Unit) : Ability[Random number between 1 and 3]
You can also check what ability the hero has leveled up. With an if then else.

  • IF -
  • Condition - Level of ability for Triggering Unit greater than 0 then
  • Actions -
  • Hero - Learn Skill for Triggerin Unit
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Beware that level skip requirements (if they exist in your map) will make it impossible to level up certain skills at certain levels. If you randomly choose such a skill the point will be wasted. You can avoid this by counting the number of unused skill points before and after ordering. If it's the same then have it learn another random skill. Repeat until it learns something.

  • Set SP = (Unspent skill points for (Triggering Unit))
  • For each (Integer A) from 1 to 100 do (Actions) //100 is a reasonable number of times to try and then give up, but it could be far less and still work
    • Loop - Actions
      • Hero - Learn RandomSkill[(Random integer between 1 and 3)] for (Triggering Unit)
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • (Unspent skill points for (Triggering Unit)) less than SP
        • Then - Actions
          • Custom script: exitwhen true //end the loop early
        • Else - Actions
 
Status
Not open for further replies.
Top