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

Disabling ability leveling / Item for leveling ability

Status
Not open for further replies.
Level 3
Joined
Aug 23, 2014
Messages
35
Hello
I am trying to make some triggers...
I want heroes to be able to level up their abilities up to, say, 3 level. But they can get it to level 4 by getting a certain item in their inventory. The problem is I have A LOT of heroes and abilities, so making copies of abilities with only level 4 and adding them to hero instead of level 1-3 ability is not an option.
I can't also detect what ability has been learned and I don't know a way to disable leveling of ability after it reaches certain level.
Any help will be appreciated.
 
Level 3
Joined
Aug 23, 2014
Messages
35
Oh, I forgot about this method, but how the hell do I disable leveling ability after certain level, with it still being usable and without making copies?
 
Level 3
Joined
Aug 23, 2014
Messages
35
Make the spells require a unit-dummy type that remove when the hero levels an ability up to 3, when they then equip the item you create the dummy-unit-type again for that player.

I thought about that, but then again, I have to create such unit for every ability and, as I said, I have A LOT of them. So, the ways I know will take... about forever to achieve my goals and that is why I asked you, guys to help me. Anyway, thanx those who already posted good advices.
 
Level 3
Joined
Sep 7, 2013
Messages
47
This is very easy. I think. As you just have to detect whenever the hero upgrades a skill to level 4, and detect whenever the hero has the item requirement or not. If the hero tries to level up an ability to level 4 while not having the item, you just have to decrease the ability for that unit and add back the skill point spent on it.

add: you may even display an error message if the hero tries to level ability to 4 like "Cannot upgrade this ability. *insertyouritem* is required."
 
Level 3
Joined
Aug 23, 2014
Messages
35
This is very easy. I think. As you just have to detect whenever the hero upgrades a skill to level 4, and detect whenever the hero has the item requirement or not. If the hero tries to level up an ability to level 4 while not having the item, you just have to decrease the ability for that unit and add back the skill point spent on it.

add: you may even display an error message if the hero tries to level ability to 4 like "Cannot upgrade this ability. *insertyouritem* is required."

Yes, it's quite simple. But still, is there a way to disable leveling ? If I won't find any, I will do this then.
 
Level 3
Joined
Aug 23, 2014
Messages
35
Your goal is fully achievable but the only way I can think of is dummy abilities. Btw, how many dummy abilities do you need to make based on your estimation?

Hm...
See, I have 12 units now and plan on making more in future. And each of them has at least 3 normal abilities and 1 ultimate (some of them have more). So I have to make about 60 dummy abilities/units and a longass or multiple triggers for each hero/ability to disable leveling.
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
Hm...
See, I have 12 units now and plan on making more in future. And each of them has at least 3 normal abilities and 1 ultimate (some of them have more). So I have to make about 60 dummy abilities/units and a longass or multiple triggers for each hero/ability to disable leveling.

Ahh I see then this is a big problem. I honestly am curious about the best solution to this (perhaps other users can solve this) . If you happen to know Dota, it also have a mechanics almost similar to yours but only for 1 ability so the author creates a lot of dummy abilities. Btw, it has more than a hundred heroes but that was still his solution.
 
Level 3
Joined
Sep 7, 2013
Messages
47
Well I exactly did what I have stated above in my own map. My heroes cannot upgrade skills past level 5 if the hero is below lv.16. Which, I thought that way was the most appropriate solution. What the problem only is, is if you have some spells that trigger when learning. ex: Every upgrade of a spell increases damage by x
If that is what are you worrying about, you just have to trigger the learning effect to. But I think not many people create spells like that.
 
Level 3
Joined
Aug 23, 2014
Messages
35
Well I exactly did what I have stated above in my own map. My heroes cannot upgrade skills past level 5 if the hero is below lv.16. Which, I thought that way was the most appropriate solution. What the problem only is, is if you have some spells that trigger when learning. ex: Every upgrade of a spell increases damage by x
If that is what are you worrying about, you just have to trigger the learning effect to. But I think not many people create spells like that.

The only thing I am worrying about is wasting a lot of time just because I don't know a better way to do this.
 
Level 3
Joined
Sep 7, 2013
Messages
47
You may code that only around 2 mins.

you may do this...
  • Events
    • Unit - A unit Learns a skill
  • Conditions
    • (Learned skill level) Greater than > 3
  • Actions
    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Triggering unit) has an item of type YOUR_ITEM) Equal to False
      • Then - Actions
        • Custom script: call DecUnitAbilityLevelSwapped( GetLearnedSkillBJ(), GetTriggerUnit() )
        • Hero - Modify unspent skill points of (Triggering unit): Add 1 points
      • Else - Actions
Then display an error message if you want
 
Level 3
Joined
Aug 23, 2014
Messages
35
You may code that only around 2 mins.

you may do this...
  • Events
    • Unit - A unit Learns a skill
  • Conditions
    • (Learned skill level) Greater than > 3
  • Actions
    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Triggering unit) has an item of type YOUR_ITEM) Equal to False
      • Then - Actions
        • Custom script: call DecUnitAbilityLevelSwapped( GetLearnedSkillBJ(), GetTriggerUnit() )
        • Hero - Modify unspent skill points of (Triggering unit): Add 1 points
      • Else - Actions
Then display an error message if you want

Thank you so very much, I'll use this.
 
Level 3
Joined
Sep 7, 2013
Messages
47
You might want to change the DecUnitAbilityLevelSwapped( GetLearnedSkillBJ(), GetTriggerUnit() ) to DecUnitAbilityLevel(whichUnit, GetLearnedSkill()) for better performance. Well it may not be noticeable but its good practice to use native functions than BJ functions/

Yes. Bj's are evil. I just didn't notice because I was just converting the code from gui to JASS. Anyways, that code will be better.
 
Status
Not open for further replies.
Top