• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Damage Bonus

Status
Not open for further replies.
Level 8
Joined
Aug 13, 2018
Messages
338
I'm using damage bonus for attacks but all attacks do full damage. Why?
(I did set all armours to 0 but I tried to solve the problem by add some armour values but it didn't work)
Untitled.png
 
Level 8
Joined
Aug 13, 2018
Messages
338
Dr Super Good, I know what the problem is but I don't know how to solve it.
Problem: When you use the "spirit link", damage bonuses doesn't affect units affected by "spirit link" and I do't like this. How to solve it?
 
Level 9
Joined
Jul 30, 2018
Messages
445
Seems to work fine for me. As already said: post the map, because you must have done something else to degate the damage modifier. Also, the amount of armor doesn't affect the damage modification from Armor-type.
 
Level 9
Joined
Jul 30, 2018
Messages
445
So what exactly is not working? You have to make a demonstration map where everything is set up so you can see the problem just by running the map. Also, the damage system works just the same whether it's a building or a unit (technically all buildings are units anyway).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Problem: When you use the "spirit link", damage bonuses doesn't affect units affected by "spirit link" and I do't like this. How to solve it?
I have little experience with spirit link but it is possible that it may convert damage to spell damage to be inflicted on each of the shared units. One might need to trigger one's own spirit link using the new damage event response functions.
 
Level 8
Joined
Aug 13, 2018
Messages
338
I don't know what you say dr super good.:) Please say more about it.
I want to travel.
When I'm back, I try to solve the problem.
Edit: I think I understood what you say: you say I must create a single trigger for every attack type?
If this is your opinion I think I can do this. Thanks. Just a qustion: What's the codition of attack-type?
But there isn't any better way to solve problem?
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Edit: I think I understood what you say: you say I must create a single trigger for every attack type?
If this is your opinion I think I can do this. Thanks. Just a qustion: What's the codition of attack-type?
But there isn't any better way to solve problem?
No I was saying that one might need to create a triggered version of spirit link because spirit link might be transforming the damage type and amount in an undesirable way.

The gameplay constant settings for damage bonus do work. If they are not working then something in your map must be making them so.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
Alright, I understand his problem. He's trying to Spirit Link his Structures together so that they share damage.

The issue: You set Spirit Link's "Distributed Damage Factor" to -2.00%. This is incorrect. You want to set it to a positive number. For example, A value of 1.00% will make your units share 100% of all damage dealt to them.

Another thing. If you attack your own units/allied units it doesn't share the damage with Spirit Link. Just an extra thing to note that I learned while testing it out.
 
Last edited:
Level 8
Joined
Aug 13, 2018
Messages
338
The issue: You set Spirit Link's "Distributed Damage Factor" to -2.00%. This is incorrect. You want to set it to a positive number. For example, A value of 1.00% will make your units share 100% of all damage dealt to them.
This is incorrect! If I set it to 1 , then there will be not any damage share. (May be for patch versions we make a mistake. I use 1.26a)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
First, test to see if 0.50 works. That's the default value of the ability so it SHOULD work.

Second, update to the latest version of wc3. Make sure to create backups of your maps before doing so.

And, if updating breaks your map, apologies in advance :p
 
Last edited:
Level 8
Joined
Aug 13, 2018
Messages
338
I want to share full damage, If one of them attacked, other ones takes the same damage. You know what I say? I did it but it removes damage bonus of attack and armour types.
And I can't update my Wc3 version for some reason (my friends).
Also it's not important to fix it, I can write this and solve the problem : <All attacks do full damage to Arcane Towers> But if we can fix it, it's better to do.:)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
I understand. When I tested your map the damage wasn't being shared AT ALL because you had Spirit Link set to -2.00%. Setting it to 1.00% fixed the issue and caused the damage to be shared among all 3 buildings. I tested this with an enemy Footman attacking one of the Arcane structures.

Anyway, let's just assume you solved that first issue. I think I understand your other problem. Are you saying that Spirit Link is causing issues with Damage/Armor types not being applied? Like for example a Demolisher is only dealing 1.00x damage to a Fortified Structure even though Siege Damage is supposed to deal bonus damage?

If that's the problem then I don't know. I assumed Spirit Link calculated all of these things and took them into consideration. I feel like it shouldn't ignore Armor/Damage types.
 
Last edited:
Level 12
Joined
Nov 3, 2013
Messages
989
If I remember correctly how Spirit Link works is that the amount you set it to is how much of the damage is shared by all the spirit linked units (and it's converted to spell damage so it ignores armor) or it could be that it was the amount of damage that's not split. Either one of the two.


Anyway, so if Spirit Link's shared damage is set to 1.00 (or 0.00 depending on how it works) then all of the damage one of the linked units would take is split evenly between all of the units.

If it's set to 0.50, then the unit that's being damaged will take 50% of the damage, then another 50% of the damage is converted into spell damage and split across all of the units (including the one that was originally hurt).


So for example, let's say we have two units that are spirit linked: Unit A and Unit B.

With 100% shared damage both units will take 50% of the damage split as spell damage.

With 50% shared damage, one unit will take 50% of the damage, then the remaining 50% of damage is split equally between the two units, meaning that one unit takes 75% of the damage and the other unit takes 25%.


3 units with 100% shared damage = 33% of damage taken each
3 units with 50% shared damage = one unit takes 50% + 16% (spell) damage, and the other two units take 16% damage each.





And of course, normally all units other than Heroes take 100% damage from spell type, and it ignores armor, so if your buildings are spirit linked and share 100% of the damage then their armor and armor type will be more or less irrelevant.
 
I recently mapped the known damage process of WarCraft 3 and Spirit Link is the raw damage before Mana Shield, Anti Magic Shell, armor and defense calculations are made. So if a Blademaster crits, the full text tag value is distributed over Spirit Link.

The only way for units in a spirit link to take armor into consideration is to change the damagetype using patch 1.31 (using DamageEngine if you are not accustomed to script). So the solution to your problem is to update your WarCraft 3.

Another buggy possibility is to use Damage Engine 3.8 and - when Spell Damage is detected - set the damage to 0 and re-issue the same damage amount as NORMAL damage type (attack type would be unknowable so it would have to remain Spells). This has the undesired side effect of all spell damage being reduced by armor.

There's a more complex option using Damage Engine's AOE damage, and check if the last unit in the AOE sequence does not have spell damage taken, but it will fail if the original damage was caused by a spell.
 
Last edited:
There are many attack types, how to detect what's the orginal attack type?
The attack type would need to be Spells. As I said, you can't know the attack type. Buy a used computer and/or a legitimate copy of WarCraft 3 (ie. Reforged preorder) (depending on whichever is the choking point for your situation) and this will fix your problem.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
Well, I think there is another way of doing it if patching is not an option, although I really recommend getting you and your friends to patch the game. You're missing out on a lot of cool stuff.

Using Bribe's Damage Detection System and Unit Indexer you could do something like this (the variables might be named differently in the older versions):
  • Setup Attack Types
    • Events
    • Conditions
    • Actions
      • -------- Attack Type 1 = Normal --------
      • -------- Attack Type 2 = Hero --------
      • -------- Attack Type 3 = Siege --------
      • -------- - --------
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set UnitAttackType[(Custom value of (Last created unit))] = 1
      • -------- - --------
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set UnitAttackType[(Custom value of (Last created unit))] = 2
      • -------- - --------
      • Unit - Create 1 Mortar Team for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set UnitAttackType[(Custom value of (Last created unit))] = 3
Whenever you create a unit you will want to assign the UnitAttackType[custom value of last created unit] variable to it, using whichever Integer matches their Attack Type. You can define this anyway you'd like, in my example I made 1 = Normal, 2 = Hero, and 3 = Siege.

------------------------------

This next trigger is using the Damage Detection System. But before doing this we must first put all of our Arcane structures into a Unit Group called "ShareDamageUnitGroup". You can do this during Map Initialization.
  • Set ShareDamageUnitGroup = (Units of type Arcane Tower)
------------------------------

Now we can detect the damage and split it among our 3 structures.
  • Damage Share
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventTarget is in ShareDamageUnitGroup) Equal to True
    • Actions
      • Set DamageEventAmount = (DamageEventAmount / 3.00)
      • Trigger - Turn off (This trigger)
      • Unit Group - Pick every unit in ShareDamageUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Not equal to DamageEventTarget
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • UnitAttackType[(Custom value of DamageEventSource)] Equal to 1
                • Then - Actions
                  • Unit - Cause DamageEventSource to damage (Picked Unit), dealing DamageEventAmount damage of attack type Normal and damage type Normal
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • UnitAttackType[(Custom value of DamageEventSource)] Equal to 2
                    • Then - Actions
                      • Unit - Cause DamageEventSource to damage (Picked Unit), dealing DamageEventAmount damage of attack type Hero and damage type Normal
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • UnitAttackType[(Custom value of DamageEventSource)] Equal to 3
                        • Then - Actions
                          • Unit - Cause DamageEventSource to damage (Picked Unit), dealing DamageEventAmount damage of attack type Siege and damage type Normal
                        • Else - Actions
            • Else - Actions
      • Trigger - Turn on (This trigger)
So whenever one of our 3 Arcane structures gets damaged we divide the damage by 3 and deal this reduced damage to the other 2 Structures. And in order to find the Attack Type of the damage dealt we use a few If Then Else Statements to check to see what the "UnitAttackType[]" is set to for our DamageSource. If it's set to 1, then we know to deal Normal damage, if it's 2 then we deal Hero damage, and 3 we deal Siege damage. You can do this for all 7 possible Attack Types.
 
Last edited:
@Bribe

Where can I find versions of your DDS and Unit Indexer that are compatible with patch 1.26? I want to import them to matin45's map and see if I can get this to work.
Damage Engine 3.8.0.0 | HIVE

However your approach in using a Unit Group gives a better idea - how about instead of using the actual Spirit Link buff, strictly use triggers to add the linked units to a group. That way, we avoid all this attack type nonsense and simply distribute the damage across the whole group via Damage Engine.

  • Spirit Link
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
      • DamageEventTarget is in SpiritLinkGroup Equal to True
    • Actions
      • Trigger - Turn off (this trigger)
      • Unit Group - Pick all units in SpiritLinkGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Not Equal to DamageEventTarget
            • Then - Actions
              • Unit - Cause DamageEventSource to damage (Picked unit) using Attack type Spells and Damage Type Universal
            • Else - Actions
      • Trigger - Turn on (this trigger)
This will cause the source unit to damage all the units in the spirit link chain for as much damage as the initial unit took (after armor/defense calculations). Again, without updating WarCraft 3 however, there's no way to know what the pre-defense/armor calculations were, so if the units had different armor or defense, there would be no scaling to match.

So, as long as all units in the link share the same armor and defense types, this approach will work.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
@Bribe
Yeah, that's actually perfect for his map. Now that I think about it, there's no point in worrying about armor/damage types with how his map works since he only wants to share damage between 3 of the same Unit-Types.

@matin45
I uploaded a version of your map with the damage sharing implemented. I also cleaned up all of your leaks (hopefully) and fixed any bugs that I could find. You should look into Memory Leaks

In regards to leaks, here's your Archer trigger that I modified and cleaned up:
  • Archers
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Archers
    • Actions
      • Set Point = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Casting unit)) is an ally of Player 1 (Red)) Equal to True
        • Then - Actions
          • Unit - Create 2 Archer for Player 1 (Red) at Point facing Default building facing degrees
        • Else - Actions
          • Unit - Create 2 Archer for Player 2 (Blue) at Point facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 512.00 of Point) and do (Actions)
        • Loop - Actions
          • If (((Owner of (Picked unit)) is an ally of (Owner of (Casting unit))) Equal to True) then do (Unit Group - Add (Picked unit) to PlayerUnitGroup[(Player number of (Owner of (Casting unit)))]) else do (Do nothing)
      • Custom script: call RemoveLocation(udg_Point)
Originally you were creating the Archers at "Target point of ability being cast". Instead, we want to create them at a Point Variable. In this case I use one that I named "Point". So as you can see I set Point to be "Target point of ability being cast". So it does basically same exact thing as before but now we can clean up that Point and remove it from the game's memory. To do so, we use this:
  • Custom script: call RemoveLocation(udg_Point)
I also use
  • Custom script: set bj_wantDestroyGroup = true
to remove Unit Group leaks. Placing this Custom Script right before our Unit Group will cause the Unit Group to be cleaned up after it's done being used.

Some other things:
-Avoid using Pause/Unpause unit, this can cause problems. I removed the pauses from your Shock Attack trigger and replaced them with a Stun. Not sure if this will cause issues but it shouldn't.

-You were using "A unit begins casting an ability" when you really wanted to use "a unit starts the effect of an ability". Begins casting an ability can be cancelled but the trigger will still go off. So for example if you were to cast the ability, then immediately order your unit to Stop, you'll see that the trigger would happen even though the ability never went on cooldown or spent any mana.

-Avoid using "a unit is attacked" except in some cases (like preventing an attack from happening). This has the same issue as "begins casting" in that you can cancel the attack and the trigger will still go off. I changed your Shock Troopers to use the Damage System instead.

-With Special Effects always "Destroy last created special effect" otherwise you will create a leak.

-I changed it so that you can't cast abilities at all during the 60 second picking phase.

-I changed The Bomb and Cluster Rockets to use Dummy units instead of items. This works a lot better than creating and giving an item to your Hero.

Edit: Fixed some bugs, uploaded v.2
 

Attachments

  • Throne of Dalaran v1.6 beta EDIT 2.w3x
    674.9 KB · Views: 24
Last edited:
Level 8
Joined
Aug 13, 2018
Messages
338
I think that I found the best way to fix the problem without using damage engine or upgrade Wc3
Since I only link specific units together, so I can create a trigger for everyone of them.
something like this:

Untitled Trigger 001
Events
Unit - Scout Tower 0000 <gen> Takes damage
Conditions
Actions
Unit - Cause Dummy 0003 <gen> to damage Scout Tower 0001 <gen>, dealing (Damage taken) damage of attack type Spells and damage type Universal
Unit - Cause Dummy 0003 <gen> to damage Scout Tower 0002 <gen>, dealing (Damage taken) damage of attack type Spells and damage type Universal

(I don't know how to share it as a trigger:peasant-wink:)

@Uncle Thanks for your helps and editing my map but there is a problem: I can't open it in my worldeditor so I use your notes and renew the triggers just how I can do this:
-I changed it so that you can't cast abilities at all during the 60 second picking phase.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
To post it as a trigger type: [*trigger]paste your trigger here[*/trigger] without the *.

And that's unfortunate, I tried to keep it compatible with v1.26 so you could open it. I wonder if it's because i'm on 1.31 that it's causing problems. Or maybe I used an incompatible version of Damage Engine/Unit Indexer.

I uploaded version 3 if you want to test it out. It uses a different version of Damage Engine and Unit Indexer so it might work.

---------------------------------------------------------------------------------
Anyway, if that doesn't work then to answer your question:
First you want to create a Boolean called GameStarted.

Then replace your old Card Casting On trigger with this:
  • Card Casting On
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • GameStarted Equal to False
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Antonidas
          • (Unit-type of (Triggering unit)) Equal to Kael
          • (Unit-type of (Triggering unit)) Equal to Muradin Bronzebeard
          • (Unit-type of (Triggering unit)) Equal to Uther
    • Actions
      • Unit - Order (Triggering unit) to Stop
Then replace your old Timer trigger with this. You didn't need the "Wait - 60.00 seconds" when you had already started a Timer. You can use the Event "Timer Expires" like I do in the trigger below.
  • Timer
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 60.00 seconds
      • Countdown Timer - Create a timer window for Timer with title Picking Time:
Then after your 60 second picking Timer expires set GameStarted to True.
  • Caster Move
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy (Last created timer window)
      • Visibility - Create an initially Enabled visibility modifier for Player 3 (Teal) emitting Visibility across (Playable map area)
      • Visibility - Create an initially Enabled visibility modifier for Player 4 (Purple) emitting Visibility across (Playable map area)
      • Visibility - Create an initially Enabled visibility modifier for Player 5 (Yellow) emitting Visibility across (Playable map area)
      • Visibility - Create an initially Enabled visibility modifier for Player 6 (Orange) emitting Visibility across (Playable map area)
      • Set Point = (Center of Target Teleport Blue <gen>)
      • Unit - Move Antonidas 0012 <gen> instantly to Point
      • Unit - Move Kael 0013 <gen> instantly to Point
      • Custom script: call RemoveLocation(udg_Point)
      • Set Point = (Center of Target Teleport Red <gen>)
      • Unit - Move Uther 0014 <gen> instantly to Point
      • Unit - Move Muradin Bronzebeard 0015 <gen> instantly to Point
      • Custom script: call RemoveLocation(udg_Point)
      • Unit - Set mana of Antonidas 0012 <gen> to 100.00%
      • Unit - Set mana of Kael 0013 <gen> to 100.00%
      • Unit - Set mana of Uther 0014 <gen> to 100.00%
      • Unit - Set mana of Muradin Bronzebeard 0015 <gen> to 100.00%
      • Camera - Apply Blue Place <gen> for Player 3 (Teal) over 0.00 seconds
      • Camera - Apply Blue Place <gen> for Player 5 (Yellow) over 0.00 seconds
      • Camera - Apply Red Place <gen> for Player 4 (Purple) over 0.00 seconds
      • Camera - Apply Red Place <gen> for Player 6 (Orange) over 0.00 seconds
      • Set GameStarted = True
Finally, make sure to set all of your Archer, Shock Trooper, Healer, etc... triggers so that they are Initially On. And if you haven't already, make sure to change the Events for these triggers to "A unit starts the effect of an ability" instead of "a unit begins casting an ability".
 

Attachments

  • Throne of Dalaran v1.6 beta EDIT 3.w3x
    680.3 KB · Views: 23
Last edited:
Status
Not open for further replies.
Top