Variable attack?

Status
Not open for further replies.
Level 4
Joined
Jul 1, 2009
Messages
65
can you make an attack of a unit change...... if so....can u change it with a variable...like based on the amount of kills the unit has?
 
Level 4
Joined
Jul 1, 2009
Messages
65
oh yea sorry.....yes amount of damage attack....like after 5 kills he gets +1 attack or sumthin...but from a variable so its easier too manage
 
Well, you can make an item based off "Item Damage Bonus", give it some levels, up to the effect you want, each increasing damage by 1/2/3/4/...
Then, the trigger
  • Damage
  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • Set PlayerKills[Player Number of (Owner of (Killing unit))] = ((PlayerKills[Player Number of (Owner of (Killing unit))]) + 1)
    • If (Conditions) are true then do (Actions) Else do (Actions)
      • If - Conditions
        • PlayerKills[Player Number of (Owner of (Killing unit))] Equal to 5
      • Then - Actions
        • Set PlayerKills[Player Number of (Owner of (Killing unit))] = 0
        • Unit - Set (Item attack damage bonus) for (Killing unit) to ((Level of (Item attack damage bonus) for (Killing unit)) + 1)
      • Else - Actions
Add the ability in the unit through the Object Editor, Units Tab, go to your unit and Abilities - Normal. For the level 1 of ability, give 0 damage (so that it won't affect the unit's damage output from the beginning).
 
Level 4
Joined
Jul 1, 2009
Messages
65
hmmm those are both good ideas....my main thing was i didnt want to make 100 items....but 1 item with levels could be good...

ive seen in some TD's and other maps where you can keep up with how many kills a certain unit has....how...and im talking about multiple units like each tower and you have like 50....for each player..... would you know how to do this?
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,272
You add a tome of damage every time you upgrade the attack.

What part of that do you not understand... The tome gets used up and damage is permantly increased. No multiple items. In the case of the TDs, each kill simply adds one tome to the tower.

If the inventory is the problem, simply add the hero inventory, add the tome and then remove it. No one will see anything graphically and the unit will gain permant attack.

Also works for HP as well with causing no instabilities at all, but hero stats will cause a crash.
 
Level 4
Joined
Jul 1, 2009
Messages
65
lolz i understood that.... the comment about 1 item with levels was directed at the other guy... I like your idea too.... and the rest of that post


ive seen in some TD's and other maps where you can keep up with how many kills a certain unit has....how...and im talking about multiple units like each tower and you have like 50....for each player..... would you know how to do this?

It was a new question saying how do they keep up with kills from each tower instead of kills from each player.....
 
Level 9
Joined
Nov 28, 2008
Messages
704
Unit User Data if you are in JASS, or Custom Ddata or whatever it's called in GUI. Just increase it by 1 each time it kills something.

Alternatively, pro vJass struct it.
 
Well, i made it for Players (Player Number of (Owner of (Killing unit))). For multiple units, use
Unit - Set custom value of (Killing unit) to (((Custom value of (Killing unit)) + 1).
Then, the same if then else, but the condition will be (Integer Comparison):
  • Unit Deaths Kills
  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • Unit - Set custom value of (Killing unit) to (((Custom value of (Killing unit)) + 1)
    • If (Conditions) are true then do (Actions) and do (Actions)
      • If - Conditions
        • (Custom value of (Killing Unit)) Equal to 5
      • Then - Actions
        • Unit - Set the custom value of (Killing unit) to 0
        • Unit - Set level of (Item damage bonus) for (Killing unit) to (((Level of (Item attack bonus) for (Killing unit)) + 1)
 
Level 4
Joined
Jul 1, 2009
Messages
65
wow that is good...i just read about custom values in units....didnt think about using it that way.... thanks +REP
 
Status
Not open for further replies.
Top