• 🏆 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!

Help me. Choice Ability Hero.

Status
Not open for further replies.
Level 3
Joined
Jan 7, 2023
Messages
12
Hello guy.
Please help me. I'm trying to create a Hero that can select different skills (Ability Hero). I don't know what to call it, so I'll give my specific example.

for example: Hero has 11 skills but can only choose 4 of them.
Skill 1: I set it to Q.
skill 2: I set it to W.
Skill 3: I set it to E and the ultimate skill to R.

Skill 1: there are 3 choices: I set it to Q1, Q2 and Q3.
And now what I want to do: Hero can only learn 1 of 3 skills Q1, Q2 or Q3.
_ If my Hero learns skill Q1 then my Hero won't be able to learn skill Q2 and Q3. And vice versa.
_skill Q2 and Q3 will disappear or almost the same.

Sorry for my bad English. I have to ask google translate for help. Hope everyone understands.
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
Put all 12 abilities in the unit's spell list in the Object Editor.
  • Set QSkill[1] = Firebolt
  • Set QSkill[2] = Storm Bolt
  • Set QSkill[3] = Shadow Strike
  • Set WSkill[1] = Whatever
  • Set WSkill[2] = Whatever Else
  • Set WSkill[3] = Third W Option
  • -------- same for E and R --------
  • Events
    • Unit - A unit learns a skill
  • Conditions
  • Actions
    • Set LEARNED = (Learned hero skill)
  • -------- check Q skills --------
    • For each (Integer A) from 1 to 3 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to QSkill[(Integer A)]
          • Then - Actions
            • For each (Integer B) from 1 to 3 do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to QSkill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability QSkill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true //leave loop early since we did what we needed to do
          • Else - Actions
    • -------- check W skills --------
    • For each (Integer A) from 1 to 3 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to WSkill[(Integer A)]
          • Then - Actions
            • For each (Integer B) from 1 to 3 do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to WSkill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability WSkill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true
          • Else - Actions
    • -------- check E skills --------
    • For each (Integer A) from 1 to 3 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to ESkill[(Integer A)]
          • Then - Actions
            • For each (Integer B) from 1 to 3 do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to ESkill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability ESkill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true
          • Else - Actions
    • -------- check R skills --------
    • For each (Integer A) from 1 to 3 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to RSkill[(Integer A)]
          • Then - Actions
            • For each (Integer B) from 1 to 3 do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to RSkill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability RSkill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true
          • Else - Actions
You could use a single array for all the hero skills (Skill[1] through Skill[12]) if you wanted and compact the trigger:
  • Events
    • Unit - A unit learns a skill
  • Conditions
  • Actions
    • Set LEARNED = (Learned hero skill)
    • For each (Integer A) from 1 to 12 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to Skill[(Integer A)]
          • Then - Actions
            • Set START = ((Integer A) - 1) //subtraction, then integer division, and then multiplication; order matters here
            • Set START = (START / 3)
            • Set START = (START x 3)
            • Set START = (START + 1)
            • For each (Integer B) from START to (START + 2) do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to Skill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability Skill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true //leave loop early since we did what we needed to do
          • Else - Actions
This will try to disable all the other Q skills every time a Q skill is leveled up. That shouldn't matter for performance, since the check is relatively uncommon and not resource-intensive.
 
Last edited:
Level 3
Joined
Jan 7, 2023
Messages
12
Put all 12 abilities in the unit's spell list in the Object Editor.
  • Set QSkill[1] = Firebolt
  • Set QSkill[2] = Storm Bolt
  • Set QSkill[3] = Shadow Strike
  • Set WSkill[1] = Whatever
  • Set WSkill[2] = Whatever Else
  • Set WSkill[3] = Third W Option
  • -------- same for E and R --------
  • Events
    • Unit - A unit learns a skill
  • Conditions
  • Actions
    • Set LEARNED = (Learned hero skill)
  • -------- check Q skills --------
    • For each (Integer A) from 1 to 3 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to QSkill[(Integer A)]
          • Then - Actions
            • For each (Integer B) from 1 to 3 do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to QSkill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability QSkill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true //leave loop early since we did what we needed to do
          • Else - Actions
    • -------- check W skills --------
    • For each (Integer A) from 1 to 3 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to WSkill[(Integer A)]
          • Then - Actions
            • For each (Integer B) from 1 to 3 do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to WSkill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability WSkill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true
          • Else - Actions
    • -------- check E skills --------
    • For each (Integer A) from 1 to 3 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to ESkill[(Integer A)]
          • Then - Actions
            • For each (Integer B) from 1 to 3 do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to ESkill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability ESkill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true
          • Else - Actions
    • -------- check R skills --------
    • For each (Integer A) from 1 to 3 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to RSkill[(Integer A)]
          • Then - Actions
            • For each (Integer B) from 1 to 3 do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to RSkill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability RSkill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true
          • Else - Actions
You could use a single array for all the hero skills (Skill[1] through Skill[12]) if you wanted and compact the trigger:
  • Events
    • Unit - A unit learns a skill
  • Conditions
  • Actions
    • Set LEARNED = (Learned hero skill)
    • For each (Integer A) from 1 to 12 do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • LEARNED equal to Skill[(Integer A)]
          • Then - Actions
            • Set START = ((Integer A) - 1) //subtraction, then integer division, and then multiplication; order matters here
            • Set START = (START / 3)
            • Set START = (START x 3)
            • Set START = (START + 1)
            • For each (Integer B) from START to (START + 2) do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Then actions) else do (Else actions)
                  • If - Conditions
                    • LEARNED Not equal to Skill[(Integer B)]
                  • Then - Actions
                    • Unit - For (Triggering unit), Ability Skill[(Integer B)], Disable ability: True, Hide UI: True
                  • Else - Actions
            • Custom script: exitwhen true //leave loop early since we did what we needed to do
          • Else - Actions
This will try to disable all the other Q skills every time a Q skill is leveled up. That shouldn't matter for performance, since the check is relatively uncommon and not resource-intensive.
Tks you so much.
 
Warcraft 3 only supports 5 Learnable skills. So this needs big effort or one accepts less.
For the Skill selection you could have for each SkillChoice a spellbook('Aspb') with the options when you cast any option in the spellbook the unit gains a skill and loses the spellbook.
For the learning part you could have 4 dummy skills which you morph using Engineering Upgrade ('ANeg') to the wanted skills. Or you skip the morphing and just levelup the dummy skills which then powerup the choosen skill when learned.


Or One could use custom UI. But Probably not.
 
Status
Not open for further replies.
Top