• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Unit's Base Damage

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
You notice the 10 - 25 in-game ?
That's the damage, I want to detect.

However, in my game, it uses a damage of 1 - 1 or 30 - 30 so it'll be easier I think

Ok here's the problem:
My unit has a spell, the name is Strike.

When I cast Strike on a targeted enemy unit, the damage dealt would be 100 + <CurrentUnitBaseDamage>

That bold letter is my problem (the damage is based from Caster, not the Target)

As you can see, what I'm trying to do now is to detect unit's current damage when he cast that spell, any scripts can do that ?

Be it JASS (that can be pasted in Trigger Editor) or GUI, all is welcome :)
 
Level 35
Joined
Feb 5, 2009
Messages
4,561
unless you create the damage via triggers, it is impossible to determine the damaging stats of a unit AS FAR AS I KNOW, and i have discussed this matter in the chat with Dr Super Good who is not aware of any system for doing this

if indeed a system IS figured out, then i will be very happy, but yeah, i've tried this before for calculating the DPS of a unit
 
If you do make a system, it will most likely have to be map specific. The easiest way to do it is to create a database. All you basically have to do is add data to a hashtable for damage for a specific unit type id. This basically will be the amount of minimum damage and the amount of maximum damage (save 2 separate pieces of data) that the unit deals without any items, attributes, or any other modifiers. If it is a hero, you also need to save the unit's primary attribute.

Then, you just retrieve it and factor in the primary attribute and bonuses. (and upgrades if any) Primary attributes adds 1 damage if I recall correctly (per point, unless you changed it for your map) So it would basically be (minimum Damage [or maximum Damage] + primary Attribute points, include bonuses) Then also check for any items/upgrades that your map uses. If you don't have any that increase damage, then it isn't something to worry about. If you don't want to factor in damage bonuses at all, then it is no problem.

Yeah, it is lengthy, but it works like a charm. :) If you need me to, I can whip up a sample if I have time.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Here's a system I created quite a long time ago: Link

It doesn't factor in buffs.

It works by creating n copies of the unit around a dummy unit. The copies attack the dummy and damage taken is detected. Min and max values are stored.

For example I create 8 dummy units and they all attack the target. When a total of 100 (configurable value) hits are recorded, the dummies are hidden. Min and max damage values are stored for the original unit.
 
Status
Not open for further replies.
Top