1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Deal damage after 3rd attack

Discussion in 'World Editor Help Zone' started by Norris, Mar 8, 2020.

  1. Norris

    Norris

    Joined:
    Mar 1, 2020
    Messages:
    22
    Resources:
    0
    Resources:
    0
    I want create a passive spell like title.
    Every 3rd attack, hero will cause more damage to target. I dont know how to count the number of attack. So... Thank for your help (and sorry for my bad english XD)
     
  2. Sh4d

    Sh4d

    Joined:
    Mar 5, 2020
    Messages:
    10
    Resources:
    0
    Resources:
    0
    Hey Norris,
    I think you can create a variable called : NumberOfAttack and increments it each time your hero is doing an attack.
    Like this :

    upload_2020-3-9_11-21-17.png

    There is not event : A unit is attacking, so you have to use "a unit is attacked".

    In order :
    - Create an integer variable and set it initial value to 0
    - Create the trigger where the event detected is : "A unit is attacked" in Unit
    - Set your condition to the attacker equals your Hero
    - Increment the NumberOfAttack in Action
    - Create a If/then/else
    - Add condition : Every X attack
    - In unit, select the action you want. You can use a buff and remove it, deal specific damages with the amount you want
    - Reset NumberOfAttack if it reaches 3
     
    Last edited: Mar 9, 2020
  3. Norris

    Norris

    Joined:
    Mar 1, 2020
    Messages:
    22
    Resources:
    0
    Resources:
    0
    Very detailed and easy to understand. Thank you
     
  4. Strydhaizer

    Strydhaizer

    Joined:
    Feb 28, 2013
    Messages:
    1,832
    Resources:
    5
    Models:
    1
    Maps:
    1
    Template:
    2
    Tutorials:
    1
    Resources:
    5
    This have two mistakes, first of all use Damage Engine by Bribe, with "Unit is attacked" the trigger will still fire regardless if the unit attacked or the attack command has been canceled by the attacker.

    Here's a multi unit version, this utilize UnitIndexer and DamageEngine both made by Bribe. Test map included.


    • Attack Counter
      • Events
        • Game - DamageEvent becomes Equal to 1.00
      • Conditions
      • Actions
        • Set AT_DamageSourceID = (Custom value of DamageEventSource)
        • Set AT_DamageUnitNew[AT_DamageSourceID] = DamageEventSource
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • AT_DamageUnitNew[AT_DamageSourceID] Equal to AT_DamageUnitPrev[AT_DamageSourceID]
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • AT_Counter[AT_DamageSourceID] Greater than or equal to 2
              • Then - Actions
                • Set DamageEventAmount = (DamageEventAmount x 25.00)
                • Set AT_Counter[AT_DamageSourceID] = 0
              • Else - Actions
                • Set AT_Counter[AT_DamageSourceID] = (AT_Counter[AT_DamageSourceID] + 1)
          • Else - Actions
            • Set AT_Counter[AT_DamageSourceID] = 1
        • Game - Display to (All players) the text: (String(AT_Counter[AT_DamageSourceID]))
        • Set AT_DamageUnitPrev[AT_DamageSourceID] = DamageEventSource


    This is tested and working properly.

    Notes:
    - Change the 25.00 to 3.00 since you want it to deal three times the damage every third attack

    If you want the counter to reset every time the source unit changes the target unit you can just switch

    • AT_DamageUnitNew[AT_DamageSourceID] = DamageEventSource
    and
    • AT_DamageUnitPrev[AT_DamageSourceID] = DamageEventSource


    to

    • AT_DamageUnitNew[AT_DamageSourceID] = DamageEventTarget
    and
    • AT_DamageUnitPrev[AT_DamageSourceID] = DamageEventTarget


    Edit:
    I realized the trigger 'Attack Init' isn't necessary at all, just remove/ignore this trigger. I removed it at v4.

    • Attack Init
      • Events
        • Map initialization
      • Conditions
      • Actions
        • For each (Integer A) from 1 to 8196, do (Actions)
          • Loop - Actions
            • Set AT_Counter[(Integer A)] = 1
     

    Attached Files:

    Last edited: Mar 12, 2020
  5. Norris

    Norris

    Joined:
    Mar 1, 2020
    Messages:
    22
    Resources:
    0
    Resources:
    0
    I don't think it will be that complicated XD. I will try this one. Thanks everyone
     
  6. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,545
    Resources:
    2
    Maps:
    2
    Resources:
    2
    You can just spam interrupt to deal huge amounts of damage with the first solution. There might be other issues with small interrupt intervals (for example when "moving" a unit with triggers). I'd highly recommend you to use Strydhaizers solution
     
  7. Norris

    Norris

    Joined:
    Mar 1, 2020
    Messages:
    22
    Resources:
    0
    Resources:
    0
    Yes. In sh4d's trigger, looks like the damage was caused before the projectile touched the target. I don't know why ^^
     
  8. FeelsGoodMan

    FeelsGoodMan

    Joined:
    Dec 13, 2018
    Messages:
    1,681
    Resources:
    6
    Maps:
    3
    Template:
    1
    Ported Models:
    2
    Resources:
    6
    Because you're using the event "A unit is attacked". @Strydhaizer literally explained it to you. Use a damage engine, it will make your life easier.
     
  9. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,481
    Resources:
    0
    Resources:
    0
    "A unit is attacked" happens before a unit takes damage, therefore a player can exploit this. It's similar to how the Event "A unit begins casting an ability" works, as that can be canceled (issue a "stop" order in response) and the trigger will still go off despite the fact that the ability was never used.

    These two Events are the biggest traps for newcomers when it comes to mapmaking. The solution to "A unit is attacked" is a Damage Engine like the others have said, which is a system you can import into your map that once mastered will open up a lot of possibilities in regards to manipulating damage. The solution to "A unit begins casting an ability" is to use the "A unit starts the effect of an ability" Event instead, as this one runs when the ability would go on cooldown/spend mana.