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

Hero Skills Help (Multiple Questions)

Status
Not open for further replies.
Level 4
Joined
Jul 11, 2015
Messages
58
Hey, i'm working on the map right now and got stuck somewhere, anyway my questions are:

1. How to make a Hero auto learn an ability when picked (like neutral creeps)
2. How to make a spell, when you click it upgrades your agility or strenght permanently but requires Gold (pls dont item dummy or something, we're 2015) More Details: You Click it and it takes you to another tab like Learning Ability or Building Tower and you have 2 options there, buy str, buy agi or go back.

PS: I have enough dummies Chuck Norris to train entire life on them from help. Tnx!

I only ask for help when i really need it, i was searching for 4 hours and The Google engine itself didn't even know what i'm searching for hours.
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
1. How to make a Hero auto learn an ability when picked (like neutral creeps)

I don't quite get the underlined part. How can abilities be "picked"? However, I think you want this:

  • Hero - Learn skill for (Your Hero): The skill
This can be found in the Hero category of the Actions. It's the first function you get when you open that category.

2. How to make a spell, when you click it upgrades your agility or strenght permanently but requires Gold (pls dont item dummy or something, we're 2015) More Details: You Click it and it takes you to another tab like Learning Ability or Building Tower and you have 2 options there, buy str, buy agi or go back.

No need for dummies but you'll need triggers. First of all, to create the button, use the ability "Spell Book" then create 3 different skills based on skills like Berserk and Fan of Knives (but of course by removing all their effects) called Gain Strength/Agility/Intelligence.

  • Gain Strength
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Owner of (Triggering unit)) Current gold) Greater than or equal to (The gold you should pay for the attribute)
    • Actions
      • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - The gold you should pay for the attribute)
      • Hero - Modify Strength of (Triggering unit): Add (The value you want
      • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIsm\AIsmTarget.mdl
      • Special Effect - Destroy (Last created special effect)
Repeat this trigger for the other two attributes by swapping strength with agility and intelligence respectively and it's done.
 
Level 4
Joined
Jul 11, 2015
Messages
58
I don't quite get the underlined part. How can abilities be "picked"? However, I think you want this:

  • Hero - Learn skill for (Your Hero): The skill
This can be found in the Hero category of the Actions. It's the first function you get when you open that category.



No need for dummies but you'll need triggers. First of all, to create the button, use the ability "Spell Book" then create 3 different skills based on skills like Berserk and Fan of Knives (but of course by removing all their effects) called Gain Strength/Agility/Intelligence.

  • Gain Strength
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Owner of (Triggering unit)) Current gold) Greater than or equal to (The gold you should pay for the attribute)
    • Actions
      • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - The gold you should pay for the attribute)
      • Hero - Modify Strength of (Triggering unit): Add (The value you want
      • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIsm\AIsmTarget.mdl
      • Special Effect - Destroy (Last created special effect)
Repeat this trigger for the other two attributes by swapping strength with agility and intelligence respectively and it's done.

I didn't get the "spell book thing" and bro Unit - a unit start the effect of an ability, it confuses other spells
 
Level 4
Joined
Jul 11, 2015
Messages
58
The Spell Book works similarly to the Hero Abilities button (the + sign when you click on a hero). It gives you a list of abilities but the only difference is that you do not learn them, you use them directly as normal skills. It's like having more skills to use.

he posted very useful trigger regarding the ability but its not finished, If he dont have for example the amount of gold for the skill send message

oh its you i tought second coment was other person
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
No need for dummies but you'll need triggers. First of all, to create the button, use the ability "Spell Book" then create 3 different skills based on skills like Berserk and Fan of Knives (but of course by removing all their effects) called Gain Strength/Agility/Intelligence.
I would recommend using the "Channel" ability instead and modify it. It's meant for these things and it's fool-proof to unforeseen behavior. For example I remember helping numerous people with their issue of permanent (and continuous) FPS drops after casting an ability and the problem was they based their abilities on shockwave and nulled its fields.

Also, the trigger you posted should have a condition that checks which ability has been cast.

I didn't get the "spell book thing" and bro Unit - a unit start the effect of an ability, it confuses other spells
The "Spell Book" ability can be found under item category.
 
Level 4
Joined
Jul 11, 2015
Messages
58
I would recommend using the "Channel" ability instead and modify it. It's meant for these things and it's fool-proof to unforeseen behavior. For example I remember helping numerous people with their issue of permanent (and continuous) FPS drops after casting an ability and the problem was they based their abilities on shockwave and nulled its fields.

Also, the trigger you posted should have a condition that checks which ability has been cast.


The "Spell Book" ability can be found under item category.

english pls, i mean how do i do that?
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
Forgot to mention Channel.
Oh right, also forgot that you need to add this condition (amnesia really...)

  • (Ability being cast) Equal to Gain Strength/Agility/Intelligence
As for the message, you may use If/Then/Else in this way:

  • Gain Strength
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Gain Strength
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) Current gold) Greater than or equal to (The gold you should pay for the attribute)
        • Then - Actions
          • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - The gold you should pay for the attribute)
          • Hero - Modify Strength of (Triggering unit): Add (The value you want
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIsm\AIsmTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Set CasterPlayer = (Owner of (Triggering Unit))
          • Custom script: if GetLocalPlayer() == udg_CasterPlayer then
          • Game - Display to (All players) for 5.00 seconds the text: Not enough gold.
          • Custom script: endif
CasterPlayer is a Player variable. You may also set CasterPlayer = (Owner of (Triggering Unit)) as the first trigger so that you can use it in the Then actions. These are just the base triggers you need to work on.
 
Level 4
Joined
Jul 11, 2015
Messages
58
Forgot to mention Channel.
Oh right, also forgot that you need to add this condition (amnesia really...)

  • (Ability being cast) Equal to Gain Strength/Agility/Intelligence
As for the message, you may use If/Then/Else in this way:

  • Gain Strength
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Gain Strength
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) Current gold) Greater than or equal to (The gold you should pay for the attribute)
        • Then - Actions
          • Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - The gold you should pay for the attribute)
          • Hero - Modify Strength of (Triggering unit): Add (The value you want
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Items\AIsm\AIsmTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
          • Set CasterPlayer = (Owner of (Triggering Unit))
          • Custom script: if GetLocalPlayer() == udg_CasterPlayer then
          • Game - Display to (All players) for 5.00 seconds the text: Not enough gold.
          • Custom script: endif
CasterPlayer is a Player variable. You may also set CasterPlayer = (Owner of (Triggering Unit)) as the first trigger so that you can use it in the Then actions. These are just the base triggers you need to work on.

I really dont use variables, i barely set up one for timewindow, what kind of variable?
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
I really dont use variables, i barely set up one for timewindow, what kind of variable?

Told you, it's "Player".
I'll give you the exact instructions you should follow.
Open the trigger editor ---> Ctrl + B ---> Ctrl + N ---> Type CasterPlayer in front of Variable Name ---> Select Player for Variable Type ---> Click OK ---> Click again OK ---> Finish!
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
english pls, i mean how do i do that?
When you create a copy of the "Spell Book" ability and select it in object editor, you can see that one field contains a list of abilities. You can replace those abilities for your own.
There are also fields for minimum and maximum number of abilities, if they share cooldown, etc.
I think those fields are pretty self explanatory.

Once you are done with adding abilities, you should change the flag from "Is item ability" (or something like that). Unchecking that box will make it a unit ability instead, meaning you can give it description, etc.
Next add the spell book ability to unit. You can test it in game and your unit should have the spell book ability. When you click the ability a list of the abilities you set for that spellbook will appear.

There are some problems with this imo.
1) Error messages - there is no way to create a native message like "Not enough gold". All you can do is to imitate it through triggers but it comes at a cost (the imitated error message is standard "Game - Show message" command).
2) Str/Agi/Int abilities - there is no way to make an ability show anything beside mana cost (if any). There are exceptions to this (like the undead Sacrifice ability) but these are hardcoded, meaning you cannot modify it. For the standard abilities you can only use mana. The solution here is that you would write the cost in the spell's description.

Also, here's a tutorial that might be of an interest to you: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/mysteries-spellbook-33039/
 
Level 4
Joined
Jul 11, 2015
Messages
58
When you create a copy of the "Spell Book" ability and select it in object editor, you can see that one field contains a list of abilities. You can replace those abilities for your own.
There are also fields for minimum and maximum number of abilities, if they share cooldown, etc.
I think those fields are pretty self explanatory.

Once you are done with adding abilities, you should change the flag from "Is item ability" (or something like that). Unchecking that box will make it a unit ability instead, meaning you can give it description, etc.
Next add the spell book ability to unit. You can test it in game and your unit should have the spell book ability. When you click the ability a list of the abilities you set for that spellbook will appear.

There are some problems with this imo.
1) Error messages - there is no way to create a native message like "Not enough gold". All you can do is to imitate it through triggers but it comes at a cost (the imitated error message is standard "Game - Show message" command).
2) Str/Agi/Int abilities - there is no way to make an ability show anything beside mana cost (if any). There are exceptions to this (like the undead Sacrifice ability) but these are hardcoded, meaning you cannot modify it. For the standard abilities you can only use mana. The solution here is that you would write the cost in the spell's description.

Also, here's a tutorial that might be of an interest to you: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/mysteries-spellbook-33039/

Thank you very much bro i found the way but there is only one problem

I cant add hero spells to the spell book. http://i.epvpimg.com/H3Tsh.jpg
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
I cant add hero spells to the spell book.
But that is logical of course. A hero ability differs from unit ability only in that it is not available immediately, but can be learned by spending ability point on it and that it has 1 more description field (the description when you are about to learn the spell).
Once learned, the actual ability shows itself in your unit's command card.

There is no need to learn the Str/Agi/Int ability, but more like what you need is to just cast them. When you cast them, a trigger (that Shadow Fury posted) detects that and increases the stat for that unit.

Unless you want it to work like attribute bonus ability (but then again, you could just add that heroic ability to the unit itself instead of going around with spell books)

What about (Owner of (Triggering unit)) Current gold) Greater than or equal to (The gold you should pay for the attribute) I cant find the current gold
I think it's under Integer comparison: Player - Property
 
Level 4
Joined
Jul 11, 2015
Messages
58
But that is logical of course. A hero ability differs from unit ability only in that it is not available immediately, but can be learned by spending ability point on it and that it has 1 more description field (the description when you are about to learn the spell).
Once learned, the actual ability shows itself in your unit's command card.

There is no need to learn the Str/Agi/Int ability, but more like what you need is to just cast them. When you cast them, a trigger (that Shadow Fury posted) detects that and increases the stat for that unit.

Unless you want it to work like attribute bonus ability (but then again, you could just add that heroic ability to the unit itself instead of going around with spell books)


I think it's under Integer comparison: Player - Property

Sorry for bothering you but i have no idea where to find that and how to configurate it exactly with the gold thing
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
Integer Comparison ---> Click on (Number of units in (Units in (Playable map area))) ---> Press "P" ---> Click on Player 1 (Red) ---> Function ---> Select Owner of Unit ---> Press Enter twice ---> Swap Equal to with Greater than or equal to ---> Click on 0 ---> Type the gold cost
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
I can't save the map after adding your triggers bro, JassHelper shows errors and bugs the world editor(i tried once again without the triggers and saved nicely)

http://i.epvpimg.com/pQs0e.jpg

Be wary of the spelling. You must type EXACTLY this if GetLocalPlayer() == udg_CasterPlayer then in the first custom script and EXACTLY this endif in the second one. If you swap a capital letter for a small letter or miss even one letter, the whole thing bugs.
Also make sure the variable is written as CasterPlayer where the letters C and P are both capital.
 
Level 4
Joined
Jul 11, 2015
Messages
58
Be wary of the spelling. You must type EXACTLY this if GetLocalPlayer() == udg_CasterPlayer then in the first custom script and EXACTLY this endif in the second one. If you swap a capital letter for a small letter or miss even one letter, the whole thing bugs.
Also make sure the variable is written as CasterPlayer where the letters C and P are both capital.


I totally forgot the endif, thank you for helping bro i will release the map in 3 days its going to be amazing, NaZi Zombies Assault ( NaZi Zombies vs Soviet Union)

This works bro only 1 thing fails, it sets the current gold to 150, not removes the current cold by 150
 
Level 4
Joined
Jul 11, 2015
Messages
58
But that is logical of course. A hero ability differs from unit ability only in that it is not available immediately, but can be learned by spending ability point on it and that it has 1 more description field (the description when you are about to learn the spell).
Once learned, the actual ability shows itself in your unit's command card.

There is no need to learn the Str/Agi/Int ability, but more like what you need is to just cast them. When you cast them, a trigger (that Shadow Fury posted) detects that and increases the stat for that unit.

Unless you want it to work like attribute bonus ability (but then again, you could just add that heroic ability to the unit itself instead of going around with spell books)


I think it's under Integer comparison: Player - Property

Upgrading agility strenght and inleligence is important to my map and i'm doing this because i need to balance it, for example the pyro have high attack speed so he needs less attack while Solder with rocket launcher is different
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
Why am I so forgetful today? :thumbs_down:
Damn, another thing I forgot is that you should use the Arithmetic function to do this. You set Value to (Owner of (Triggering Unit)) Current gold then swap + with - and replace 1 with 150.
A simpler method I remember would be this:

  • Player - Add -150 to (Owner of (Triggering unit)) Current gold
This is the second function of the Player list. Be aware that I used a negative sign for the 150 to substract gold and not add it.
 
Status
Not open for further replies.
Top