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

Increase unit damage/armor without + symbol

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

Is there a way to increase a unit's damage or armor without invoking the "+" symbol i.e. the increase would appear as it would if a unit's attack was upgraded or a hero leveled up.

So if my unit did 10-10 damage, I'd like to be able to change 10-10 to say 12-12 without doing "10-10 + 2 damage," but rather just "12-12 damage."
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
I'm not sure... though remember too that upgrades cannot be undone...

I won't need to undo them since they'll act as another attribute.

But I found out you can hide the level of them if you set the upgrade class to None! But since players would likely want to know what level their "attack" or "defense" attribute is, I will not hide it. But good to know you can.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
I just realized using upgrades would not be feasible, since it would upgrade all your heroes' damage/armor, rather than just one hero which leveled up.

I suppose there's no way to give a single footman lvl 3 iron swords (so it's not possible for player 1 to command 12 footman which are 0/0, but say 5 which are 3/3). I think this is right, but I wish it were wrong.

In which case I would need to make two upgrades per hero, but that won't work, because it's possible to get multiples of the same hero, in which case I would need to dynamically create new upgrades, which I don't think you can do.

So for my case using upgrades, which were really clean, just won't work...

So do any of these other systems increase the units damage/armor, but without any + symbols, so when attack goes up by 2, the damage goes from "16 - 16" to "18-18" rather than "16 - 16 + 2." ???
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
To increase damage you can just use the +Damage foliant ability ('AIaa'). Just add the ability to the unit and make it permanent. Works perfectly. To reduce the damage you can set the abilities damage value to something negative.

For armor there is no foliant ability, which makes the whole thing a bit more complicated. I know its possible to modity armor by morphing the unit, changing the armor (e.g. by changing the agility) and then morphing it back. But you might have to play around with it a bit since im not 100% sure how to do it to keep the other attributes as they are and avoid bugs...
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
To increase damage you can just use the +Damage foliant ability ('AIaa'). Just add the ability to the unit and make it permanent. Works perfectly. To reduce the damage you can set the abilities damage value to something negative.

For armor there is no foliant ability, which makes the whole thing a bit more complicated. I know its possible to modity armor by morphing the unit, changing the armor (e.g. by changing the agility) and then morphing it back. But you might have to play around with it a bit since im not 100% sure how to do it to keep the other attributes as they are and avoid bugs...

So to increase attack I can just add the damage via that tome ability? Do I just apply it, or do I have to make levels of it?
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Well, either you make 1 ability with +1 damage and apply it 35 times to get +35 damage, or you make more abilities so you dont have to add that many. But doesnt really make a difference.

To keep it simple just make an ability with +1 damage and add it in a loop till you have the right bonus.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Well, if you want to add 100000 by adding +1 damage 100000 times its probably a better idea to make more than one ability (e.g. +1, +10, +100, +1000, ...). But yea, for smaller damage bonuses +1/-1 seems ok (for the sake of simplicity).

(btw: I dont think filesize is that important, but abilities with many levels are slower)
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Alright well it will generally be +1 anyways.

So what is the object editor set up I need, e.g. the ability, the ability effect, and whether it's on the hero as an ability?

How could I add the ability multiple times?

I know what the logic behind it is, but how do I set it up in the object editor?
 
Last edited:
Level 14
Joined
Jun 27, 2008
Messages
1,325
To add it multiple times just use a loop. In GUI its called "For integer A from 1 to 27 do: .. Action: add ability". (Adds 27 Damage)

though I think most bonus mod uses powers of 2

so 2,4,8,16,32 etc

thats because they dont use foliant abilities but normal item abilities. The problem with those is that you cannot add them twice. So an ability is either added or not added (level 0 or 1). -> Powers of 2.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
To add it multiple times just use a loop. In GUI its called "For integer A from 1 to 27 do: .. Action: add ability". (Adds 27 Damage)



thats because they dont use foliant abilities but normal item abilities. The problem with those is that you cannot add them twice. So an ability is either added or not added (level 0 or 1). -> Powers of 2.

Right so you're saying this will add 6 damage to any hero unit:

JASS:
call UnitAddAbility(u, 'AIaa')
call UnitAddAbility(u, 'AIaa')

if u is some unit I got a handle to, and AIaa is the item ability which adds 3 permanent damage.

I haven't tried this yet, but I tried manually adding it, and it didn't increase the damage of the hero at all (in unit abilities - add ability - add AIaa).

Also this does not resolve the armor issue--I don't think a hero transformation would be feasible (how would it work for higher levels of armor anyway, unless I chained them) because then the amount of units I would need would be linear (as I have about 200 unique heroes).

So is there any way at all to increase armor without having a + symbol (and I can't use armor upgrade for reasons I mentioned above)?, with armor acting as another hero attribute (that I manage of course), so it's a unique amount per hero instance, and unique across all heroes, even if they are the same unit type and owned by the same player.
 
Last edited:
Level 14
Joined
Jun 27, 2008
Messages
1,325
Right so you're saying this will add 6 damage to any hero unit:

JASS:
call UnitAddAbility(u, 'AIaa')
call UnitAddAbility(u, 'AIaa')

if u is some unit I got a handle to, and AIaa is the item ability which adds 3 permanent damage.
Correct.

I haven't tried this yet, but I tried manually adding it, and it didn't increase the damage of the hero at all (in unit abilities - add ability - add AIaa).
That doesnt work, you have to add it by trigger.

Also this does not resolve the armor issue--I don't think a hero transformation would be feasible (how would it work for higher levels of armor anyway, unless I chained them) because then the amount of units I would need would be linear (as I have about 200 unique heroes).

So is there any way at all to increase armor without having a + symbol (and I can't use armor upgrade for reasons I mentioned above)?, with armor acting as another hero attribute (that I manage of course), so it's a unique amount per hero instance, and unique across all heroes, even if they are the same unit type and owned by the same player.

Read my post again, you dont have to create a new hero for every armor value.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Correct.

Read my post again, you dont have to create a new hero for every armor value.


From what I read from that post I guess I could relegate agility to increase just armor, and then make a new stat for attack speed, which is a foliant item ability? But regardless attack speed modifications don't show up as "+" anywhere.

Would this transformation technique add any significant performance decreases though? It just seems like a lot of overhead for adding armor to a unit permanently.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
No. Chaos morphing is bugged. For example when you add stats to a unit via item abilities and morph a unit the stats get applied permanently (and when you morph again they get added again and again ... pretty messy). But it also bugs when you morph a hero, then change its armor value by adjusting the agility, morphing it back and reseting the agility value (the armor will still be increased but the agility is normal again).
I know it doesnt make much sense, thats because its a bug, but it can be abused to modify armor values. However its a bit messy and you screw up other stats quite easily... Just try it.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
No. Chaos morphing is bugged. For example when you add stats to a unit via item abilities and morph a unit the stats get applied permanently (and when you morph again they get added again and again ... pretty messy). But it also bugs when you morph a hero, then change its armor value by adjusting the agility, morphing it back and reseting the agility value (the armor will still be increased but the agility is normal again).
I know it doesnt make much sense, thats because its a bug, but it can be abused to modify armor values. However its a bit messy and you screw up other stats quite easily... Just try it.

I think I'll just use agility for armor and make attack speed the new agility stat. Is there an equivalent way to increase attack speed as you showed me for damage, or do I have to do something a bit trickier?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
There is no attackspeed tome, but you can add the item ability of "gloves of haste" to the hero. Here you should use several abilities with 1 level each and the values 1, 2, 4, 8, 16, .... (This is how BonusMod does it).

In this case you would just add the item ability attack speed the same way we did damage, except we would have to add different levels of it, e.g.

If we wanted +1% attack speed, we just add Attack Speed level 1

Then if we wanted say attacked speed level 7%, we would add
Attack Speed level 1
Attack speed level 2
and Attack speed level 3

= 1 + 2 + 4.

But if attack speed is accumulative like that, then could we not make 100 levels of it (all +1% attack speed) assuming I just put a cap on it (I'm not going to be giving heroes arbitrary attack speed bonuses).
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Abilities with many levels are slow. Thats why you use multiple abilities with 1 level each.

Also keep in mind that this way to realize a maximum bonus of m you only need log_2(m) abilities. But if you used a single ability you need m levels.

Example: With only 9 Abilities of 1 level each you can create bonuses from 1 to 1023 (+1, +2, +4, +8, +16, +32, +128, +256, +512).
With 1 Ability you need 1023 (!!) levels to get the same bonuses.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
So it holds that these bonus abilities do stack if they are different levels?

When you say "slow," does this mean loss of performance?

I understand that using the binary representation makes the number of ability levels logarithmic with respect to the maximum level, but that will still require some additional overhead (it doesn't come for free). I'm tempted to just do the naive approach, and if I find a reason to have to assign units arbitrary attack speeds, etc. then I would definitely use such a system.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
High levels work slow in both the editor and in-game I believe... at least I'm sure about the editor side...

plus the multiple abilities method is far more versatile than using a single ability with levels...

Alright but what do I do if I want to have a icon on the command card that tells players their attributes (e.g. Spell Resistance lvl 15 is 15% reduction, but lvl 40 might just be 35% or something)? Wouldn't you need a linear amount of levels to represent that information on the unit command card?

I mean I guess I can just have them type a command, like "-spell resistance" when they select a hero.
 
Though the abilities that you want to use doesn't show by default on the command UI AFAIK... so you'd probably need to make a dummy skill for that... but IMHO, these customized things are better shown using other methods... like typing commands etc...

if you go with typing, then I suggest saving the current value whenever you add/remove a bonus from the unit to a variable so that you can fetch it afterwards...

Like

Unit - Add Ability ATK+1
Set ATK[UnitId] = ATK[UnitID] + 1
Unit - Add Ability ATK+4
Set ATK[UnitId] = ATK[UnitID] + 4

then use the value of the variable when you want to show it to the user...
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Though the abilities that you want to use doesn't show by default on the command UI AFAIK... so you'd probably need to make a dummy skill for that... but IMHO, these customized things are better shown using other methods... like typing commands etc...

if you go with typing, then I suggest saving the current value whenever you add/remove a bonus from the unit to a variable so that you can fetch it afterwards...

Like

Unit - Add Ability ATK+1
Set ATK[UnitId] = ATK[UnitID] + 1
Unit - Add Ability ATK+4
Set ATK[UnitId] = ATK[UnitID] + 4

then use the value of the variable when you want to show it to the user...

I agree with this now then, it will make the command card look nicer and potentially room for more abilities.

But can anyone confirm if having 100 levels of ability actually affects in game performance?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
item ability AIaa not increasing damage

I tried out using AIaa (the tome of permanent damage increase item) but it did not increase my guy's damage. Here is the snippet of code.

JASS:
call UnitAddAbility(u, 'AIaa')

where u is the unit handle (e.g. the specific instance of a unit) and 'AIaa' is the ability id for the permanent damage tome.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Edit: I figured it out.

All you need to do is just use UnitAddItemById and then have the unit add the tome of permanent damage. This will increase its damage permanently.

Now if only there were tomes of armor, mana, etc.
 
Last edited:
Status
Not open for further replies.
Top