• 🏆 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!

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

Status
Not open for further replies.
Level 12
Joined
Dec 11, 2014
Messages
662
  • 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.
 
Level 12
Joined
Dec 11, 2014
Messages
662
I managed to do it. I think I successfully made it MUI too.

  • 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
 
Status
Not open for further replies.
Top