• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Regular Attacks Damage Triggerable?

Status
Not open for further replies.
Level 8
Joined
Dec 9, 2009
Messages
397
I'd like to set up: (Dont' know Jass btw)

Normal attacks have a chance to crit for defined by a variable (So equipment can change it) also set the crit bonus % by a variable.
also, chance to dodge by variable


I assume I need a Damage Detection system?

Is there a way to make a trigger for regular attacks?

example:
unit hits unit
if random number 1/10 <= Dodge Chance
then
Deal no damage
else
if random number 1/10 <= CritChance
have unit deal (normal damage + CritBonus)
else
do normal damage


once setup, It's an RPG, so not a ton of fighting is going on at once, shouldn't lag map should it?
 
Level 10
Joined
Jun 6, 2007
Messages
392
There's a way to make it without damage detection, although it has its limits. Let's say, the highest possible damage multiplier is 10 (could be anything else), and the smallest possible bonus is 0.1. In that case, you would have an item critical strike ability with 101 levels, level 1 with 1x normal damage, level 2 with 1.1x normal damage ... level 101 with 10x normal damage. Every level would have 100% chance. Use this trigger to give a unit critical strike, when it attacks:

  • Critical Strike
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to CritChance
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Critical Strike (item-based) for (Attacked unit)) Greater than 0
            • Then - Actions
              • Unit - Set level of Critical Strike (item-based) for (Attacking unit) to CritBonus
            • Else - Actions
              • Unit - Add Critical Strike (item-based) to (Attacking unit)
              • Unit - Set level of Critical Strike (item-based) for (Attacking unit) to CritBonus
        • Else - Actions
          • Unit - Remove Critical Strike (item-based) from (Triggering unit)
Evasion can be done the same way, but it's easier to make.
 
yes you can.

No, you can't. At least to public knowledge. There is no bug free way to do detect if it is actual physical damage or if it was dealt from a spell. You could use orb buffs, like Nestharus does in Advanced Damage Event, but it fails miserably because it crashes artillery units and disallows units with bouncing attacks to actually attack.

You would have to trigger all spell damage in your map, and then if the damage was not triggered then it was a physical attack.
 
Level 4
Joined
Apr 15, 2011
Messages
108
No, you can't. At least to public knowledge. There is no bug free way to do detect if it is actual physical damage or if it was dealt from a spell. You could use orb buffs, like Nestharus does in Advanced Damage Event, but it fails miserably because it crashes artillery units and disallows units with bouncing attacks to actually attack.

You would have to trigger all spell damage in your map, and then if the damage was not triggered then it was a physical attack.

the system I have(not written by me) is somewhat similiar, tho its much shorter it still uses buffs.
it shows bounces as spell and artilely as spell too, cleave or splash attack works fine tho.
so as you said, there is no bug free way but counting bounces as spell etc. is not so horrible.
 
Level 8
Joined
Dec 9, 2009
Messages
397
Well, I've figured out a way to do it, but having some trouble with the hashtable to save data, (Key (Attacked unit)) When i click on it I get something to pick a variable I can't pick, attacked unit, picked unit....

To get attacked unit I had to paste it over from my other map :/

Once I have it workin i'll post a test map

Hash.jpg


Thats what i get when i click attacked unit. (using newest JNGP)
 
Level 8
Joined
Dec 9, 2009
Messages
397
Well, I don't know jass, so I can't do much about that...

I can explain the way my system would work.

I also wanted armor to work as it did in SC where 1 armor = -1 dmg and I can add that to this system easily.

And Adding a threat system is also possible

It requires a lot of setup, but will let you do pretty much anything relating to damage.
First off, need a Damage Detection System, I was going to use this

Need a hashtable, to save stats, which is most of the setup, these values would need to be saved:
Minimum Damage
Max Damage
Armor
Crit Chance
Crit Bonus
Dodge Chance
as these can't be pulled off the unit.
(I was thinking of setting the supply taken of the unit same as the armor value, because it can be retrieved by the trigger, only useable for creeps as they won't have items.)

Each unit gets a disabled spellbook with an altered version of Hardened Skin that cancels out 99999 damage, to a minimum of .01 damage.
When a unit is hit for .01 damage you do whatever math you want, to do the actual damage

So
if random number between 1-100 <= DodgeChance
then
Display Missed
else
if random number between 1-100 <= crit chance
set Damage to ((Rand number between, Load min dmg - load max dmg) + bonus dmg from stats/items)) x crit bonus - (load armor)
if Damage < 10
set Damage = 10 (Set your own minimum damage)
else
If HP of Damaged unit < Damage
Kill unit
else
Set HP of damaged unit to hp of damaged unit - Damage
else (crit doesn't happen)
set Damage to ((Rand number between, Load min dmg - load max dmg) + bonus dmg from stats/items)) - (load armor)
if Damage < 10
set Damage = 10 (Set your own minimum damage)
If HP of Damaged unit < Damage
Kill unit
else
Set HP of damaged unit to hp of damaged unit - Damage

Not the best looking of posts, but I hope you understand what I was trying to accomplish.


@Adiktuz I wasn't planning on using attacked unit, wanted it to be key of the unit variable Damaged unit but i can't change it to ANYTHING

Another idea, can a trigger read the gold/lumber value of a unit? if so set minimum damge to gold, max to wood

A an issues I see that other people could help with, How to give the kill to the unit that did last hit.
 
Last edited:
This has all you need:

http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-201016/

It lets you set a single variable called DamageEventAmount, arbitrarily, say, multiplying it by a factor of four or setting it to 0 or a negative number. The engine automatically adjusts to handle extra damage or reduced damage so your effort is just a simple variable assignment (Set DamageEventAmount = DamageEventAmount x 10).

Installing Damage Engine also requires copying GUI Unit Indexer into your map which allows you to do actually use (Custom value of Unit), meaning this will also remove your dependency on hashtables which is a benefit for you mainly here because they are not working so well in Jass NewGen Pack.
 
Level 8
Joined
Dec 9, 2009
Messages
397
The custom value of a unit, is being used by other systems in my map, if it is what must assign the custom value it won't work.

The hashtable was going to hold data for a specific unit type, not for every single unit on map.
 
Level 8
Joined
Dec 9, 2009
Messages
397
I have systems in my map that need it.

Why would saving something by unit type, be harder than saving something for every individual unit on the map?
 
Level 8
Joined
Dec 9, 2009
Messages
397
The other hashtables i use in the map don't require custom script, why can't I pick, a unit variable instead of attacked unit? I can't even pick attacked unit again if i click on it.
 
Level 8
Joined
Dec 9, 2009
Messages
397
But in my picture, you can see Key (attacked unit) is there, but when I click on it, I can't pick anything, How did we get (attacked unit) there in the first place?
 
Level 8
Joined
Dec 9, 2009
Messages
397
Ok, I thought of a different method,
Set your heroes attack type to do 99.99% reduced damage to your creep armor type.
Have a skill that is auto cast on attack
Every time auto cast goes off
unit deals calculated damage to unit, of a type that does full damage.

This trigger can use the unit deals damage to unit without triggering off itself
It also solves the issue of killer of unit.
and no DDS required.

though, where can i find the % reduced to certian armor types, can't find that.
and will an auto cast skill be triggered in a disabled spellbook?

And if hashtables are slow, i'll just use arrays and save the first 1-10 custom value of unit for the player heroes. and in my init trigger I'll just add the stats to save while it goes through saving position and things for my respawn.

side question: What do I press to to see the ability / item / unit ID's that were set when i made them?
 
Level 8
Joined
Dec 9, 2009
Messages
397
I'll just keep that in mind and not have those skills in map.

What does AGI have to do with it?

Hmm, can't seem to find an auto cast on attack skill that is dected :/
Is there one?
 
Last edited:
Level 8
Joined
Dec 9, 2009
Messages
397
Ok, so I couldn't find a way to detect an auto cast on attack spell, but I did figure it out,

Here is test map:
http://www.hiveworkshop.com/forums/pastebin_data/vy8kck/_files/Test Trigger Damage.w3x

Set 99.99% damage reduction on hero attack, and normal attack,
used DDS
Added a condition to the attack trigger so it won't trigger off itself.
added a stone skin to absorb the 1 dmg your attack is reduced to and it became .01 dmg.

Test map is VERY BASIC, it is just to show the method and performance.

Your hero has a chance to dodge of 10% and chance to crit of 10%, set crit bonus to 30%

A lot more math could be done for damage calc

To reduce setup of units min/max damage for each type, for creeps because food means nothing, set food used as min damage, and food given for max damage.
and Point value if you want to set something like armor/creep crit chance into your calculation.

What do you guys think?
 
Level 8
Joined
Dec 9, 2009
Messages
397
That system you made may be GUI, but it's so long and so much custom script it might as well be Jass

I understand Weep's more, just from his example of use trigger.

I tested your system with it's test map, and the peasent was doing 1 dmg, and water eles didn't heal the mage.

EDIT: I'd like to hear some opinions...

Also changing the minimum damage taken for stone skin to 0 still triggers the effect.

In my actual map, i changed the number it absorbs from 1 to 5, and in damage calc, i just add 5 dmg to bypass the stoneskin.
Easily changed higher if I need to.
 
Last edited:
Level 8
Joined
Dec 9, 2009
Messages
397
I re DL'd your test map, and got same results, peasant was hurting mage, and eles were hurting mage.

Peasant did 0 dmg to footman, but footman hp max shot up to 500420 while he was getting wacked.

mortar team damage was only displayed on units other than archmage.

dmg.jpg
 
I'll have a look into this thanks for giving this feedback.

I am using the same system for blocking damage as every other vJass damage engine is doing, so I am not sure why it flickers like that or maybe those other systems have the same glitch.

Can I ask are you using a Mac or PC? I have tested this one Windows 7. The only thing I have noticed is that very rarely the HP bar might flicker but I don't actually see the HP change.
 
Level 8
Joined
Dec 9, 2009
Messages
397
PC, windows XP 64 bit. I edited my last post with a pic if you didn't catch it look.

You look at my map yet?

I didn't reup my test map since i found the few things to improve it.
 
Level 8
Joined
Dec 9, 2009
Messages
397
In my actual map I made the system pretty nice, i'll import my improved triggers into the test map.

UPDATED TEST MAP:
http://www.hiveworkshop.com/forums/pastebin_data/fpabcl/_files/Test Trigger Damage.w3x

10% chance to crit
30% bonus to crits
10% chance to Parry (changed from dodge as the sound of being hit is still there)
Armor is calculated as 1 armor = -1dmg
Doesn't add skill bonus in current calc. (devotion aura)
More STR you have, more damage you do
More AGI you have, more armor you have, less damage you take.

Will be improved a lot in my actual map, still doing tests.

Seems the way the GUI math is done isn't proper math rules. This system would prolly really benefit from being in Jass
or atleast the calcs being in custom script.
 
Last edited:
Status
Not open for further replies.
Top