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.

[Solved] Detect which ability the caster threw [Damage Engine]

Discussion in 'Triggers & Scripts' started by DaneTheBeast, Dec 27, 2017.

  1. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • ThunderBolt
      • Events
        • Game - DamageEvent becomes Equal to 1.00
      • Conditions
        • IsDamageSpell Equal to True
        • (Unit-type of DamageEventSource) Equal to Zeus
      • Actions
        • Set TempUnit = DamageEventSource
        • Set TempPlayer = (Owner of TempUnit)
        • Set TempPoint = (Position of DamageEventSource)
        • Special Effect - Create a special effect at TempPoint using Abilities\Weapons\Bolt\BoltImpact.mdl
        • Special Effect - Destroy (Last created special effect)
        • Custom script: call RemoveLocation(udg_TempPoint)
        • Sound - Play LightningBolt <gen> at 100.00% volume, located at TempPoint with Z offset 0.00
        • Set TempPoint = (Position of DamageEventTarget)
        • Unit - Move TempUnit instantly to TempPoint
        • Unit - Create 1 DummyEarthElem for TempPlayer at TempPoint facing 0.00 degrees
        • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        • Unit - Set level of ThunderClapDummy for (Last created unit) to (Level of (Ability being cast) for TempUnit)
        • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
        • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
        • Special Effect - Destroy (Last created special effect)
        • Custom script: call RemoveLocation(udg_TempPoint)
        • Sound - Play ThunderClapCaster <gen> at 100.00% volume, attached to TempUnit
        • Set TempUnit = No unit


    This trigger works except one small problem, it will fire no matter which skill Zeus throws. Is there a way to detect from which ability the damage came? I tried using the Order(thunderbolt) condition but it will only fire if he's still doing the animation for throwing it so that won't work.
     
  2. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,408
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    No, you have to trigger spells, instead of detecting where damage came from. If you want more control over spells and their damage, then work for it, wc3 engine is unfortunately not going to help you.
     
  3. -Manuel-

    -Manuel-

    Joined:
    Oct 4, 2016
    Messages:
    204
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Try to create a unique dummy for the spell that cast a dummy ability that deal damage and catch these damage in your posted trigger, but replacing condition value of Zeus to Your dummy.
     
  4. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I managed to do it. I think I successfully made it MUI too.
    Mah spell

    • Thunder Bolt
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Thunder Bolt
        • (Unit-type of (Triggering unit)) Equal to Zeus
      • Actions
        • Set TB_Caster[0] = (Triggering unit)
        • Set TB_Target[0] = (Target unit of ability being cast)
        • Custom script: set udg_TB_ID = GetUnitUserData( udg_TB_Target[0])
        • -------- - --------
        • Set TB_Caster[TB_ID] = TB_Caster[0]
        • Set TB_SpellLevel[TB_ID] = (Level of Thunder Bolt for TB_Caster[TB_ID])
        • Set TB_Target[TB_ID] = TB_Target[0]
        • Set TB_CasterLoc[TB_ID] = (Position of TB_Caster[TB_ID])
        • Set TB_TargetLoc[TB_ID] = (Position of TB_Target[TB_ID])
        • Set TB_CasterOwner[TB_ID] = (Owner of TB_Caster[TB_ID])
        • Set TB_Distance[TB_ID] = (Distance between TB_CasterLoc[TB_ID] and TB_TargetLoc[TB_ID])
        • Set TB_WaitTime[TB_ID] = (TB_Distance[TB_ID] / 1000.00)
        • -------- - --------
        • Unit Group - Add TB_Target[TB_ID] to TB_UnitGroup
        • -------- - --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Thunder Bolt Loop <gen> is on) Equal to False
            • (Number of units in TB_UnitGroup) Greater than 0
          • Then - Actions
            • Trigger - Turn on Thunder Bolt Loop <gen>
          • Else - Actions


    • Thunder Bolt Loop
      • Events
        • Time - Every 0.05 seconds of game time
      • Conditions
      • Actions
        • Unit Group - Pick every unit in TB_UnitGroup and do (Actions)
          • Loop - Actions
            • Set TB_Unit = (Picked unit)
            • Custom script: set udg_TB_ID = GetUnitUserData( udg_TB_Unit)
            • Set TB_WaitTime[TB_ID] = (TB_WaitTime[TB_ID] - 0.05)
            • -------- - --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (TB_Unit is dead) Equal to True
              • Then - Actions
                • Unit Group - Remove TB_Unit from TB_UnitGroup
                • -------- - --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Number of units in TB_UnitGroup) Equal to 0
                  • Then - Actions
                    • Trigger - Turn off (This trigger)
                  • Else - Actions
              • Else - Actions
                • -------- - --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • TB_WaitTime[TB_ID] Less than or equal to 0.00
                  • Then - Actions
                    • Special Effect - Create a special effect at TB_TargetLoc[TB_ID] using war3mapImported\LightningWrath.mdx
                    • Special Effect - Destroy (Last created special effect)
                    • Sound - Play LightningBolt <gen> at 100.00% volume, located at TB_TargetLoc[TB_ID] with Z offset 0.00
                    • -------- - --------
                    • Unit - Move TB_Caster[TB_ID] instantly to TB_TargetLoc[TB_ID]
                    • -------- - --------
                    • Unit - Create 1 DummyThunderBolt for TB_CasterOwner[TB_ID] at TB_TargetLoc[TB_ID] facing 0.00 degrees
                    • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                    • Unit - Set level of ThunderClapDummy for (Last created unit) to TB_SpellLevel[TB_ID]
                    • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
                    • -------- - --------
                    • Sound - Play ThunderClapCaster <gen> at 100.00% volume, attached to TB_Caster[TB_ID]
                    • Unit Group - Remove TB_Unit from TB_UnitGroup
                    • -------- - --------
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Number of units in TB_UnitGroup) Equal to 0
                      • Then - Actions
                        • Trigger - Turn off (This trigger)
                      • Else - Actions
                  • Else - Actions
     
  5. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,408
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    • Time - Every 0.05 seconds of game time


    just.... why...
     
  6. DaneTheBeast

    DaneTheBeast

    Joined:
    Dec 11, 2014
    Messages:
    608
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well damn, didnt mean to annoy you with my 0.05 :alol:
    Ill change it to 0.03