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

[General] changing damage based on % of current hp

Status
Not open for further replies.

Deleted member 242951

D

Deleted member 242951

I want to know that how can I change a units hp percentage to damage. Like 80 % hp = 80 dmg

Also I want 2 know is there a way to do it without CSS.

Thnx in advance. :as:
 

Deleted member 242951

D

Deleted member 242951

Damage is not an integer but acreal, still theres bo way that I can see to modify it
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
There is a possible solution. Firstly, you'll have to create a skill based on Item Damage Bonus (+1) and let it have 100 levels (level 1 = 1 damage, level 2 = 2 damage, level 3 = 3 damage etc...). Give this skill to your unit then you set the level of the skill to the percentage life of the units using this trigger:

  • Update HP
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit - Set level of Item Damage Bonus (+1) for [Your Unit] to (Integer((Percentage life of [Your Unit])))
If there are multiple units, assign the units to a unit group, pick every unit in that groupn replace [Your Unit] with (Picked unit), destroy the group and that's all. I can't think of other solutions.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
at that point, he can just use some form of bonus mod with multiple abilities(for this, 9 will do), because afaik 9 abilities load a lot faster than 1 ability with 100 lvls(depends on how much stuff you change in it of course)
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
at that point, he can just use some form of bonus mod with multiple abilities(for this, 9 will do), because afaik 9 abilities load a lot faster than 1 ability with 100 lvls(depends on how much stuff you change in it of course)

I'm aware that a skill with 100 levels takes much time to load but if it's going to be the only skill with so many levels, I guess it can be acceptable and not interfere too much with the loading times.
 

Deleted member 242951

D

Deleted member 242951

Problem still not solved.

@Daffa and Weitol, whats the Bonus mod, u mean CSS ?

@Shadow fury, Maybe Ill have to do that if I dont find a better solution. Thanks BTW

@Arad MNk, actually Ive seen that but I didnt get how it works in saving the damage and stats of items.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Bonus creats a few buffs for your map and applies them to a unit. Buffs represent 1's in binary, so any number can be achieved with minimal buffs. 10 abils can go up to 2^10 - 1, or 1023. The attack will show with +damage green text.

To change precise attack, you can use tomes. Same deal.

To change damage output without showing attack, you can modify the damage as it is applied to a unit. You can still show the attack via an item with item charges in an inventory.
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
There are two ways:
1. Upgrades: (Obvious IMO)
Upgrades are limited. You can increase level of an upgrade, however you cannot decrease it. Hence you are limited here.


Item Damage Bonus (+1) and let it have 100 levels ...
No need for that much. All you need is actually 2 abilities, one with 10 levels that increases damage by 0-9 and other with 11 levels that increases damage by multiples of 10: 0, 10, 20, ..., 90, 100.

Then you have this:
  • Set hp = Integer(Percentage hp of unit)
  • Set bigger_bonus_level = (hp / 10) + 1
  • Set lower_bonus_level = mod(hp, 10) + 1
  • Unit - set level of stronger_boost to bigger_bonus_level
  • Unit - set level of weaker_boost to lower_bonus_level
E.g. % Hp of unit: 82.75%
hp = Int(%hp) = 82
bigger_bonus = hp/10 + 1 = 9
lower_bonus = mod(hp, 10) + 1 = (82 % 10) + 1 = 3

bigger_level = 9 = 80% (remember, you start at level 1 with 0 dmg bonus)
lower_level = 3 = 2% (remember, you start at level 1 with 0 dmg bonus)
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Nichilus, if your max damage is 100 or 109 or something, you can accomplish the same thing with 7 abilities. 7 abilities will be able to produce any value between 0 and 127. Keep in mind that every level on an ability is like another full ability (well, close enough). 7 abilities is a lot less than 21 levels of abilities ; ).
 
Status
Not open for further replies.
Top