Trigger - Increase damage taken - Please Help

ChaosWarlock

New Member
Reaction score
7
I am creating an ability that increases the damage that a unit takes from attacks by a certain percent. If someone could help with a couple issues I am having that would be greatly appreciated.

1. I don't really understand "Damage taken" it seems. I thought it would refer to the damage that the triggering unit just took from the attack but it seems that is not the case. I added a message to see how much "Damage taken" was and it comes up as 0.00 every time. I want to have the unit that is being attacked to take an extra 25% damage from all attacks (but not spells) when it has this buff.

2. I would like the attack type and the damage type to match that of the attacking unit. I didn't see any options for setting this. I even tried to use a variable but when you set the variable it only allows presets.

Code:
Open Wound Damage
    Events
        Unit - A unit Is attacked
    Conditions
        ((Triggering unit) has buff Open Wound ) Equal to True
               
    Actions
        [COLOR="Red"]Game - Display to (All players) the text: (String((Damage taken)))[/COLOR]
        Set Trig_Unit = (Triggering unit)
        Set Point1 = (Position of Trig_Unit)
        Set Atk_Unit = (Attacking unit)
        Set Owner_Atk_Unit = (Owner of Atk_Unit)
        Unit - Create 1 Dummy for Owner_Atk_Unit at Point1 facing Default building facing degrees
        Set Last_Unit = (Last created unit)
        Unit - Cause Last_Unit to damage Trig_Unit, dealing (0.25 x [COLOR="Red"](Damage taken)[/COLOR]) damage of [COLOR="RoyalBlue"]attack type Hero and damage type Normal[/COLOR]
        Unit - Add a 3.00 second Generic expiration timer to Last_Unit
        Set Trig_Unit = No unit
        Custom script:   call RemoveLocation(udg_Point1)
        Set Atk_Unit = No unit
        Set Owner_Atk_Unit = (Picked player)

Thanks in advance!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EDIT: Here are the solutions I have found from this thread. Thank you to everyone who contributed!

1.
Damage taken only applies to the event Unit takes damage

2.
Possible solution is using "Point Values" which I know nothing about.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The solution I have found to work for the ability I was working on is below. The ability has a chance on attack to open a deep wound causing the affected unit to take increased damage from attacks for a short period of time. The first trigger is the one I was having trouble with but I added the second one here in case anyone wanted the whole spell.

Trigger:
  • Open Wound Attacker
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set Trig_Unit = (Triggering unit)
      • Set Atk_Unit = (Attacking unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Trig_Unit has buff Open Wound ) Equal to False
        • Then - Actions
          • Unit - Remove Open Wound (Attacker) from Atk_Unit
        • Else - Actions
          • Unit - Add Open Wound (Attacker) to Atk_Unit
      • Set Trig_Unit = No unit
      • Set Atk_Unit = No unit


Trigger:
  • Open Wound Buff
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Open Wound for (Attacking unit)) Greater than 0
    • Actions
      • Set Atk_Unit = (Attacking unit)
      • 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 (8 + (3 x (Level of Open Wound for Atk_Unit)))
        • Then - Actions
          • Set Trig_Unit = (Triggering unit)
          • Set Point1 = (Position of Trig_Unit)
          • Set Owner_Atk_Unit = (Owner of Atk_Unit)
          • Unit - Create 1 Dummy for Owner_Atk_Unit at Point1 facing Default building facing degrees
          • Set Last_Unit = (Last created unit)
          • Unit - Add Open Wound (Buff) to Last_Unit
          • Unit - Set level of Open Wound (Buff) for Last_Unit to (Level of Open Wound for Atk_Unit)
          • Unit - Order Last_Unit to Neutral Fire Lord - Soul Burn Trig_Unit
          • Unit - Add a 3.00 second Generic expiration timer to Last_Unit
          • Set Trig_Unit = No unit
          • Custom script: call RemoveLocation(udg_Point1)
          • Set Owner_Atk_Unit = (Picked player)
        • Else - Actions
      • Set Atk_Unit = No unit
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
1. Damage taken only applies to the event Unit takes damage

Code:
Open Wound Damage
    Events
        Unit - YourUnit Takes Damage [COLOR="Red"](You probably want to use this event with generic unit. To do this, you will need a second trigger (see below)[/COLOR]
    Conditions
        ((Triggering unit) has buff Open Wound ) Equal to True
               
    Actions
        Game - Display to (All players) the text: (String((Damage taken)))
        Set Trig_Unit = (Triggering unit)
        Set Point1 = (Position of Trig_Unit)
        Set Atk_Unit = (Attacking unit)
        Set Owner_Atk_Unit = (Owner of Atk_Unit)
        Unit - Create 1 Dummy for Owner_Atk_Unit at Point1 facing Default building facing degrees
        Set Last_Unit = (Last created unit)
        Unit - Cause Last_Unit to damage Trig_Unit, dealing (0.25 x (Damage taken)) damage of attack type Hero and damage type Normal
        Unit - Add a 3.00 second Generic expiration timer to Last_Unit
        Set Trig_Unit = No unit
        Custom script:   call RemoveLocation(udg_Point1)
        Set Atk_Unit = No unit
        Set Owner_Atk_Unit = (Picked player)
Code:
AddEvent
    Events
        Unit - A unit enters (Playable map area)
    Conditions
    Actions
        Trigger - Add to Open Wound Damage <gen> the event (Unit - (Entering unit) Takes damage)
2. I'll check that out to see if i can help you

Edit: Okay, all i can see is that you use Point Values depending on the attack type

Lets say you use the Footman in your map. Its attack type is Normal, so set his point value to 1
If you use a rifleman, piercing attack, use 2, etc.

If you already use point values for something, ask somebody else, i dont really know how to help you
 

ChaosWarlock

New Member
Reaction score
7
Damage taken only applies to the event Unit takes damage

Thank you that clears up my confusion with Damage taken.

Code:
 Unit - YourUnit Takes Damage (You probably want to use this event with generic unit. To do this, you will need a second trigger (see below)

I am not sure how to get it to say "YourUnit" I used a footman (Footman 0001 <gen>) from my map because all I was able to do was select a unit or have "no unit". I tested it this way and it did not work. The display text never showed up.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
I am not sure how to get it to say "YourUnit" I used a footman (Footman 0001 <gen>) from my map because all I was able to do was select a unit or have "no unit". I tested it this way and it did not work. The display text never showed up.

I didn't mean that... I mean that you need to replace YourUnit by w/e unit you want to

and if you want it to work for any units, and not specific units that already are on the map, use that code i wrote in last post:
Code:
AddEvent
    Events
        Unit - A unit enters (Playable map area)
    Conditions
    Actions
        Trigger - Add to Open Wound Damage <gen> the event (Unit - (Entering unit) Takes damage)

This will make any unit that is created after the map starts be affected by your open wound trigger
 

Pharaoh_

The epic journey will soon begin... Prepare!
Reaction score
136
Trigger:
  • UnitTakeDamage Init
    • Events
      • E.g. (A unit starts the effect of an ability) or Map initialization
    • Conditions
    • Actions
      • Set UnitsEnterMap = (Units in (Playable map area))
      • Unit Group - Pick every unit in UnitsEnterMap and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Trigger - Add to UnitTakeDamage &lt;gen&gt; the event (Unit - (Picked unit) Takes damage)

Trigger:
  • UnitTakesDamage EnterMap
    • Events
    • Unit - A unit enters (Entire map)
    • Conditions
    • ((Triggering unit) is in UnitsEnterMap) Equal to False
    • Actions
    • Set TempUnit = (Triggering unit)
    • Unit Group - Add TempUnit to UnitsEnterMap
    • Trigger - Add to UnitTakesDamage &lt;gen&gt; the event (Unit - TempUnit Takes damage)

Trigger:
  • UnitTakesDamage
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set TempUnit2 = (Damage Source)
      • Set Point1 = (Position of (TempUnit2)
      • Set Damage = (Damage Taken) (Real Variable)
      • Game - Display to (All players) the text: (String(Damage))
      • Unit - Create 1 Dummy for (Owner of TempUnit2 at Point1 facing Default building facing degrees
      • Unit - Cause (Last created unit) to damage TempUnit, dealing ([place your amount here. e.g. 2] x (Damage taken)) damage of attack type Hero and damage type Normal
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_Point1)
      • Custom script: call DestroyGroup (udg_UnitsEnterMap)
 

ChaosWarlock

New Member
Reaction score
7
Pharaoh_

The code you gave lags until the game crashes. It starts lagging when i start attacking the unit. I think the problem is that when the last created unit does its damage initiates the trigger again which then initiates it again and again... but I could be wrong here.


bOb666777

This will make any unit that is created after the map starts be affected by your open wound trigger

Sorry I didnt realize the units had to be created after the map started. I was testing on units that already existed.

I tested on units that were created after the start of the game and only worked partially. I'm still getting spammed with the message 0.000 and every so often a number like 35.216 will pop up but it is gone before I can fully read it because of the spaming 0.000.

Here is the code I have at the moment.

Code:
Open Wound Damage
    Events
    Conditions
        ((Triggering unit) has buff Open Wound ) Equal to True
    Actions
        Game - Display to (All players) the text: (String((Damage taken)))
        Set Trig_Unit = (Triggering unit)
        Set Point1 = (Position of Trig_Unit)
        Set Atk_Unit = (Attacking unit)
        Set Owner_Atk_Unit = (Owner of Atk_Unit)
        Unit - Create 1 Dummy for Owner_Atk_Unit at Point1 facing Default building facing degrees
        Set Last_Unit = (Last created unit)
        Unit - Cause Last_Unit to damage Trig_Unit, dealing (0.25 x (Damage taken)) damage of attack type Hero and damage type Normal
        Unit - Add a 3.00 second Generic expiration timer to Last_Unit
        Set Trig_Unit = No unit
        Custom script:   call RemoveLocation(udg_Point1)
        Set Atk_Unit = No unit
        Set Owner_Atk_Unit = (Picked player)



Thank you both for your efforts so far.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Here is the code I have at the moment.

Code:
Open Wound Damage
    Events
    Conditions
        ((Triggering unit) has buff Open Wound ) Equal to True
    Actions
        Game - Display to (All players) the text: (String((Damage taken)))
        Set Trig_Unit = (Triggering unit)
        Set Point1 = (Position of Trig_Unit)
        Set Atk_Unit = (Attacking unit)
        Set Owner_Atk_Unit = (Owner of Atk_Unit)
        Unit - Create 1 Dummy for Owner_Atk_Unit at Point1 facing Default building facing degrees
        Set Last_Unit = (Last created unit)
        Unit - Cause Last_Unit to damage Trig_Unit, dealing (0.25 x (Damage taken)) damage of attack type Hero and damage type Normal
        Unit - Add a 3.00 second Generic expiration timer to Last_Unit
        Set Trig_Unit = No unit
        Custom script:   call RemoveLocation(udg_Point1)
        Set Atk_Unit = No unit
        Set Owner_Atk_Unit = (Picked player)

First off, it is not attacking unit when using Unit Takes Damage, its Damage Source

And for the spamming, idk what could cause it... ill look into that
 

Pharaoh_

The epic journey will soon begin... Prepare!
Reaction score
136
Yes, i forgot to add the action Trigger - Turn off (This trigger) in the third Trigger i gave you. Add as first action this. Check the third trigger again - i edited it :)
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Yes, i forgot to add the action Trigger - Turn off (This trigger) in the third Trigger i gave you. Add as first action this. Check the third trigger again - i edited it :)

I don't understand why you have to turn it off...?
 

Pharaoh_

The epic journey will soon begin... Prepare!
Reaction score
136
It will prevent it by repeating itself, since it has a solid event.
 

ChaosWarlock

New Member
Reaction score
7
First off, it is not attacking unit when using Unit Takes Damage, its Damage Source

Thats what I thought so I changed it to damage source and as soon as I attacked the game closed. :( I tried it 3 times with the same result then changed it back to attacking unit and got the results I mentioned in my previous post.


Yes, i forgot to add the action Trigger - Turn off (This trigger) in the third Trigger i gave you. Add as first action this. Check the third trigger again - i edited it :)

OK I have tested it and now it does not spam. But... lol there always seems to be a but with this spell. It only displays the text one time so I think it is only running once because of the turn off trigger. Doesn't it need to be turned back on? I'm really not sure where to turn the trigger back on that wont make it spam again.


EDIT:

I added this trigger to turn it back on and it is now working for every attack on the unit only one time. The problem is that the first text display is a number like 40.153 and then every other one after that is 0.000. Any idea how to fix this part?
Code:
UnitTakesDamage Attacked
    Events
        Unit - A unit Is attacked
    Conditions
        ((Triggering unit) has buff Open Wound ) Equal to True
    Actions
        Trigger - Turn on UnitTakesDamage <gen>
 

Leazy

You can change this now in User CP.
Reaction score
50
Alright, I haven't read the whole tread, so I don't know if this would help but;
Use berserk, it increases the DMG taken :)
 

ChaosWarlock

New Member
Reaction score
7
Berzerk increased all damage taken. I only want to increase the damage taken from attacks and not from spells.
 

Leazy

You can change this now in User CP.
Reaction score
50
Oh, alright :) Although, you could add a dummy skill that reduces spell DMG taken for the same amount the DMG taken is increased under the duration of the berserk based skill?
 

ChaosWarlock

New Member
Reaction score
7
Alright, I haven't read the whole tread, so I don't know if this would help but;
Use berserk, it increases the DMG taken

Another problem you will face when using berserk is that the unit you give the spell to is going to have to activate it which is not hard to do. All you have to do is issue it an order through the trigger to cast that spell. But it does have one significant drawback. If the Attacked unit is channeling a spell and you issue it an order to use a different spell it will stop channeling the spell it was channeling. I do not want this spell to interrupt spell casts.

Another problem you may face would be the fact that the Attacked unit may have an ability based off of Berserk already. This will then cause problems with which one of their spells goes off when you issue them the order to cast Berserk.

I do thank you though for posting your ideas. You have sparked some ideas of my own that I am exploring right now. Sometimes you just need to come at a problem from a whole different angle. I am going to try to add an ability based off of critical strike to the Attacker and then remove it after the attack. Critical strike has percent damage modifier which is perfect and also does not need to be turned on so I don't believe it will interfere with any other spells.

I'll update once I have tested this. And of course I am still taking any suggestions that any of you may have.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EDIT: I have updated the original post with the solution. Thank you to everyone for the help on this!
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
I know you found a way to do it, but I thought you'd like to know how to use point values anyways :)
 

ChaosWarlock

New Member
Reaction score
7
Thank you! Even though I don't need to use it for this spell, now that I know what it is I will probably use it for something in future.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top