Is there a way to get the base damage of a non-specific unit for calculation purposes? Like a function that returns the base damage of a unit that causes the trigger to run. How about the bonus damage?
To be more specific: I am working on a trigger that causes a certain unit damage another unit via. "Damage target" action. BUT the actual damage depends on the damage that a third unit is capable to do(the one that made the trigger to run). Also, if that unit has damage bonuses, those should be taken into account as well.
Thanks PurplePoot, I see what you mean. Unfortunately, I cant use that solution, because the third unit won't cause actual damage. Thats why I would need to get the base damage along with the bonuses (from buffs) to calculate with.
Now, I imagine that the idea of a unit attacking, but not causing damage sounds weird... Well, here's my concept:
In my map, units are organized into "squads". The individual squadmembers cannot be ordered separately, instead, each squad has a "squadleader". When the player orders the leader to do something, the whole squad is ordered to do the same. Now. When a squad enters combat, I want it to take casualties gradually, say one unit in approximately every 5 seconds (the casualty rate would depend on the opponents' strenght of course). With the base WC3 combat system, units continually take damage, so casualties occur slowly at first, then at the end, many units die in a short period, sometimes almost simulteniously. In other words, casualties are not distributed along time. This is bad, because players cannot really see, who's winning, and order a retreat in time. So I decided to create the following system.
The squadmembers attack each other, but they don't do any damage. Instead, whenever a squadmember attacks, the squadleader damages the enemy squadleader (Damage target action), with the amount of damage the attacking unit would do. When a squadleader has lost a certain percentage of its HP, a trigger kills one squadmember.
I actually have working triggers, but they are rather complex, and they restrict me to have to have squads with a single unit type each (mixed squads would have mixed damage values). It would be much simpler to just get the data every time a unit attacks, put it into a variable, and use it.
im having a similar problem, how can i get the GetDamage Event described before? i searched the reals, integers and strings, all i found was EventResponse Damage Taken and when i tested it to check if it worked with this trigger: ---------------- Unit - A unit Is attacked ------------------ Game - Display to (All players) for 30.00 seconds the text: ((String((Damagetaken))) + AGaga) ------------------ The resulting message is 0.00 AGaga is there anyway you can get the damage taken from attacks?
The Warehouse is there anyway you can get the damage taken from attacks?
I have done extensive search on that topic, here's what I found out:
EventResponse Damage Taken refers to Event: takes damage only. That means you can only refer to the damage taken if the trigger has the above event. Otherwise the function returns zero. Since this event can only be used for specific units, it is not a solution to the problem. The only GUI solution I managed to find about this topic is described here: http://www.wc3sear.ch/viewtopic.php?p=107517#107517
However, I don't think that is a good solution in case of many units. If you want to display damage for Heros only, it might work for you. About the function PurplePoot posted above, I believe, it is a JASS function.
well, i know what you mean, but my solution should still work.
First, detect the fact that the squadleader was attacked.(i hope you know how to do that, bcause i wont be explaining it here)
Second, order the unit attacking the squadleader to, instead of attacking it, attack the dummy that you create with the stats i described above
Third, register when the dummy takes the damage, and use the JASS function GetEventDamage() (you can use custom script for this) and store it to a real variable
Fourth, use DamageTarget( GetAttacker(), (some var u store the squadleader to ), ( your real var ), ATTACK_TYPE_UNIVERSAL, DAMAGE_TYPE_PIERCE )