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

[Solved] Kill Then Get Skill Every Player & Unit

Status
Not open for further replies.
Level 3
Joined
Dec 11, 2012
Messages
43
Hello everyone I am trying to make a trigger for a melee map that any unit created on the map if that unit kills something its health goes up by 2 & continues with every kill. When the unit gets 20 kills it gets a skill added to it. If the unit has mana it would be nice if the mana went up by 2 as well.

The trigger i'm trying to make here is to make units stronger for killing more and I do not want this to apply to heroes only units. Any pointers on how to make this apply to every unit on all forces?
 

Deleted member 219079

D

Deleted member 219079

Use unit indexer so you can store the amount of kills into an integer (array). Find item that increase your hp, make custom version of it which has as many levels as you need.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
If he wants no maximum there's no way to do it with 1 ability like that, especially since that ability is bugged and only ever adds the bonus from the 1st level no matter what you set it to (see this thread). You have to abuse the bug by adding and removing the ability which removes (what would have been) the appropriate amount of health. With that in mind, make a copy of Item Life Bonus (any) in the OE and change it to have these properties:

Levels: 2
Health bonus level 1: 0
Health bonus level 2: -2 (you may need to shift click the field when entering this to get a negative value)

When a unit dies, add the ability to the killing unit, set its level to 2 and then remove it from the unit. Health should go up by 2. Trigger conditions check to make sure it's not a hero.
 
Level 3
Joined
Dec 11, 2012
Messages
43
No maximum on adding +2hp every kill. The skill is just one time and that's it. I will look into this bonus mod and take into your guys advice I will let you know as soon as I try it out.
 
Level 3
Joined
Dec 11, 2012
Messages
43
Yes the custom value can serve as the kill counter for that particular unit but how do I make that apply to every unit on the map?
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
IN your 'unit dies' trigger where you add the health to the unit:
  • Set CV_Var = Custom value of (killing unit)
  • Set CV_Var = CV_Var+1
  • Set Custom value of (killing unit) to CV_Var
  • If (all conditions) do (actions) else do (actions)
    • If - Conditions
      • CV_Var equal to 20
    • Then - Actions
      • Unit - Add <your ability> to (killing unit)
      • Custom Script: call UnitMakeAbilityPermanent(GetKillingUnit(), true, 'A001') //Change A001 to the rawcode of the ability you're adding to the units
    • Else - Actions
The reason for the jass call at the end is that the ability you added won't stay if the unit transforms (robo goblin, upgrades, bear form, etc.) and there's no GUI equivalent function so you have to use the script:
JASS:
native UnitMakeAbilityPermanent takes unit whichunit, boolean permanent, integer abilityid returns boolean
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
I was going off by the first suggestion made by jondrean. If DeMoN100 doesn't want to import a unit indexer, then they would have to use hashtables to store the kill counter to specific units. However, considering that there are a huge number of systems / spells in the Hive database that require a unit indexer, I see no reason to not want to import it.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
I see no reason to not want to import it.
Unless of course one uses custom values for different purposes, as some maps have done in the past. I do agree that it certainly is something to recommend.

If using an old-fashioned attribute system which uses binary incremented bonus abilities rather than modifier exploit then one could technically return the current bonus (kill count) from the combination of abilities removing the need for keeping track of kills. However this would restrict the system to only be used by the kill bonus system and also is probably slower than a unit indexer or hashtable approach.
 
Level 3
Joined
Dec 11, 2012
Messages
43
Would the hashtables be better because with the unit indexer wouldn't that mean I have to set a custom id number for every single guy in the game?
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
I believe he is saying that he doesn't want to take on the "load" of monitoring units he does not care about. So he was asking if hashtables containing only the proper units was better. To which I replied that he can just have the unit indexer ignore units that do not need monitoring.
 
Level 3
Joined
Dec 11, 2012
Messages
43
So which way would you think would be the better way since its a melee map with every default race and custom units and this adding +2hp, +2mp if they have mp and the ability at 20 kills is applying to all units only?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
So which way would you think would be the better way since its a melee map with every default race and custom units and this adding +2hp, +2mp if they have mp and the ability at 20 kills is applying to all units only?
Unit indexer will work fine. It only breaks after around 8192 units being alive concurrently, by which time WC3 is likely unplayable.
 
Status
Not open for further replies.
Top