• 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.

[SYSTEM] custom damage system

Status
Not open for further replies.
Level 8
Joined
Nov 9, 2011
Messages
326
So for my map i use custom damage system (triggered)
custom armor, physical/magical damage, magic resistance. However

For the physical damage my hero has 1-1 Base damage. Now i use damage detection system by looking_for_help and i know how to make him deal more damage depending on the 'physical damage increase' (triggered) based on items/buffs.

Main problem here is when hero attacks another hero he deals PhysicalDamage[PlayerNumberofOwnerofDamageDealer] so he deals for example 50 physical damage. (if hero 50 pd x armor(reduction))

Now i have spells that also deal physical damage (example 140+60% of hero's physical damage(also all triggered)). But, in spell when i deal damage to the target it goes back to the trigger above and deals just 50pd x armor. How do i turn off that trigger function for the spells???

Also can i make a dummy for each player or at least 1 to change owner every time its about to make damage and hide it and in the 1st trigger (50pd x armor) to set a condition that the triggering unit isn't a dummy type unit?

Will that work whatsoever? (p.s. i know that hero won get the killing blow but at least it will be player based so what the hell)

Sorry for long post i hope someone understands what i want :p. Peace
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
to set a condition that the triggering unit isn't a dummy type unit?
you can give your dummy units a unit class like undead or whatever. in the trigger you can check if the unit is undead or not.

Main problem here is when hero attacks another hero he deals PhysicalDamage[PlayerNumberofOwnerofDamageDealer] so he deals for example 50 physical damage. (if hero 50 pd x armor(reduction))

Now i have spells that also deal physical damage (example 140+60% of hero's physical damage(also all triggered)). But, in spell when i deal damage to the target it goes back to the trigger above and deals just 50pd x armor. How do i turn off that trigger function for the spells???

send triggers.

i also used this dds, but i swapped to bribe's because its much more user friendly in my opinion :) when i used looking_for_hepl's it always clashed with other triggers and stuff and i had to fix it all the time (maybe i'm just too stupid), but i would still recommend bribe's one. it includes unit indexer, so you dont have to do that:
[PlayerNumberofOwnerofDamageDealer]
 
Level 8
Joined
Nov 9, 2011
Messages
326
you can give your dummy units a unit class like undead or whatever. in the trigger you can check if the unit is undead or not.



send triggers.

i also used this dds, but i swapped to bribe's because its much more user friendly in my opinion :) when i used looking_for_hepl's it always clashed with other triggers and stuff and i had to fix it all the time (maybe i'm just too stupid), but i would still recommend bribe's one. it includes unit indexer, so you dont have to do that:

triggers are still beta
this is when hero attacks and yes creeps have 30% basic damage resistance
  • physical dmg
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PDD_PHYSICAL Equal to PDD_damageType
          • PDD_amount Greater than 0.00
          • (Unit-type of PDD_source) Not equal to TEST_dummyunit
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of PDD_source) Equal to Player 1 (Red)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (PDD_target is A Hero) Equal to True
                • Then - Actions
                  • Set PDD_amount = ((1.00 - Damage_PReduction) x Damage_Physical)
                  • Game - Display to (All players) the text: (String(PDD_amount))
                • Else - Actions
                  • Set PDD_amount = (0.70 x Damage_Physical)
                  • Game - Display to (All players) the text: (String(PDD_amount))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of PDD_source) Equal to Neutral Hostile
                • Then - Actions
                  • Set PDD_amount = ((1.00 - Damage_PReduction) x PDD_amount)
                  • Game - Display to (All players) the text: (String(PDD_amount))
                • Else - Actions
        • Else - Actions




Now here it is a spell that i was talking about + when it deals damage by the 'dummy'

  • TEST spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Set TEST_tempUnit1 = (Triggering unit)
      • Set TEST_tempUnit2 = (Target unit of ability being cast)
      • Unit - Unhide TEST_Dummy
      • Unit - Unpause TEST_Dummy
      • Unit - Change ownership of TEST_Dummy to (Owner of TEST_tempUnit1) and Change color
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TEST_tempUnit2 is A Hero) Equal to True
        • Then - Actions
          • Unit - Cause TEST_Dummy to damage TEST_tempUnit2, dealing (((Damage_Physical x 0.60) + 140.00) x (1.00 - Damage_PReduction)) damage of attack type Hero and damage type Normal
        • Else - Actions
          • Unit - Cause TEST_Dummy to damage TEST_tempUnit2, dealing ((140.00 + (0.60 x Damage_Physical)) x 0.70) damage of attack type Hero and damage type Normal
      • Unit - Pause TEST_Dummy
      • Unit - Hide TEST_Dummy
      • Unit - Change ownership of TEST_Dummy to Neutral Passive and Change color


  • physical dmg dummy
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PDD_PHYSICAL Equal to PDD_damageType
          • PDD_amount Greater than 0.00
          • (Unit-type of PDD_source) Equal to TEST_dummyunit
        • Then - Actions
          • Game - Display to (All players) the text: (String(PDD_amount))
        • Else - Actions


Pls note that i know there are leaks and i tend to fix it as soon as i get this to work (tho its working fine right now)
 
Level 8
Joined
Nov 9, 2011
Messages
326
fist of all, you can put the first and the third trigger into one trigger, and i dont get it, why do you need a dummy that deals the damage?

bcz

Example:
Hero deals damage 70*0.7 (70%) for creeps
The first trigger finds that damage
Now in spell if i deal damage with hero it will still find the damage so it will be same damage 70*0.7
With dummy it wont find it and will work properly i mean i could merge triggers but its easier modding it this way.
 
How do i turn off that trigger function for the spells???

Just turn off the trigger, deal the damage, and then turn it back on. For example, if your trigger that adjusts the unit's damage is named "HeroDamage", you would just do:
  • Trigger - Disable HeroDamage
  • Unit - Cause <Unit> to damage <target> for ...
  • Trigger - Enable HeroDamage
It should be as simple as that. Better yet, you can always use a "signal" variable. In your "HeroDamage" trigger (the one that modifies the damage), only set the damage to 50 if the signal variable is false (use an if/then/else). Then you can do a similar thing like the trigger above:
  • Set DamageSignal = True
  • Unit - Cause <Unit> to damage <target> for ...
  • Set DamageSignal = False
In your other trigger, you'll do something like:
  • If - Conditions
    • (DamageSignal) Equal to False
  • Then - Actions
    • Set DamageVariableDDS = 50
  • Else - Actions
That is a rough sketch. I don't remember what lfh's system looks like. If you post your trigger for setting the hero's damage, I might be able to give you a more accurate example.
 
Level 8
Joined
Nov 9, 2011
Messages
326
Just turn off the trigger, deal the damage, and then turn it back on. For example, if your trigger that adjusts the unit's damage is named "HeroDamage", you would just do:
  • Trigger - Disable HeroDamage
  • Unit - Cause <Unit> to damage <target> for ...
  • Trigger - Enable HeroDamage
It should be as simple as that. Better yet, you can always use a "signal" variable. In your "HeroDamage" trigger (the one that modifies the damage), only set the damage to 50 if the signal variable is false (use an if/then/else). Then you can do a similar thing like the trigger above:
  • Set DamageSignal = True
  • Unit - Cause <Unit> to damage <target> for ...
  • Set DamageSignal = False
In your other trigger, you'll do something like:
  • If - Conditions
    • (DamageSignal) Equal to False
  • Then - Actions
    • Set DamageVariableDDS = 50
  • Else - Actions
That is a rough sketch. I don't remember what lfh's system looks like. If you post your trigger for setting the hero's damage, I might be able to give you a more accurate example.


Pls ignore melee stuff i needed that for vision and ''stuff''
So this is a like u said sketch of a settings (basic settings when u pick a hero for example) so idk what u get much with that (btw the in-build hero damage is set to 1-1 and armor to 0 for custom dmg/armor system)

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Use melee time of day (for all players)
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
      • Melee Game - Set starting resources (for all players)
      • Melee Game - Remove creeps and critters from used start locations (for all players)
      • Melee Game - Create starting units (for all players)
      • Melee Game - Run melee AI scripts (for computer players)
      • Set Damage_Physical = 23.00
      • Set Damage_Magical = 10.00
      • Set Damage_Armor = 2.50
      • Set Damage_PReduction = ((Damage_Armor x 0.02) / (1.00 + (Damage_Armor x 0.02)))
      • Set Damage_MReduction = 0.05
      • Set Damage_actuallMRed = (1.00 - Damage_MReduction)
      • Set TEST_dummyunit = dummy
      • Unit - Create 1 TEST_dummyunit for Neutral Passive at (Center of (Playable map area)) facing Default building facing degrees
      • Set TEST_Dummy = (Last created unit)
      • Unit - Hide TEST_Dummy
      • Unit - Pause TEST_Dummy
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
So if I understand your problem correctly:

The damage event is kept being fired everytime you deal new calculated damage.

I can suggest you one solution:

LFH's dds (afaik) has a feature called GetDamageType() or something like that. Damage types are PHYSICAL, SPELL, and CODE. You can utilize this feature to stop damage event from being fired by:
- Use lfs's custom deal damage function called UnitDealDamageEx() (check out his documentation)
- At your damage trigger, give it condition:
JASS:
if DAMAGE_TYPE not equal to CODE then
    call DealDamageEx(source, target, ...)
    // Using that function, dealt damage type will become CODE. So that deal damage FC will not be recalled.
    // And you can add other actions afterward
endif

And
Also can i make a dummy for each player or at least 1 to change owner every time its about to make damage and hide it and in the 1st trigger (50pd x armor) to set a condition that the triggering unit isn't a dummy type unit?
I believe you can. But for what? The damage must come from spell's caster.
 
Status
Not open for further replies.
Top