• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Force Unit to cast spell?

Status
Not open for further replies.
Level 11
Joined
Jul 25, 2005
Messages
573
The spell is actually the Meat Hook ability from DoTa, however a computer AI doesn't cast it as the spell itself has no real affect since it is all triggered. I thought maybe I could use a different dummy spell for it however it wasn't pulling the unit to the caster when I tried this for some reason.
 
Level 11
Joined
Jul 25, 2005
Messages
573
  • MH Cast
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Meat Hook
    • Actions
      • Set MH_Level = (Level of Meat Hook for (Triggering unit))
      • Set MH_Angle = (Angle from (Position of (Triggering unit)) to (Target point of ability being cast))
      • Set MH_Unit[1] = (Triggering unit)
      • Trigger - Turn on MH Extend <gen>
  • MH Extend
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MH_Links Less than (5 + (6 x MH_Level))
        • Then - Actions
          • Set MH_Links = (MH_Links + 1)
          • Unit - Create 1 Chain Link for (Owner of MH_Unit[1]) at ((Position of MH_Unit[1]) offset by (Real((40 x MH_Links))) towards MH_Angle degrees) facing MH_Angle degrees
          • Set MH_Link[MH_Links] = (Last created unit)
          • Set Temp_Group = (Units within 115.00 of (Position of MH_Link[MH_Links]) matching (((Matching unit) is alive) Equal to True))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MH_Links Greater than 3
            • Then - Actions
              • Set MH_Unit[2] = (Random unit from Temp_Group)
              • Custom script: call DestroyGroup(udg_Temp_Group)
              • Custom script: set udg_Temp_Group = null
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (MH_Unit[2] belongs to an ally of (Owner of MH_Unit[1])) Equal to False
                • Then - Actions
                  • Unit - Cause MH_Unit[1] to damage MH_Unit[2], dealing (500.00 x (Real(MH_Level))) damage of attack type Spells and damage type Normal
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MH_Unit[2] Not equal to No unit
            • Then - Actions
              • Trigger - Turn on MH Retract <gen>
              • Trigger - Turn off (This trigger)
            • Else - Actions
        • Else - Actions
          • Trigger - Turn on MH Retract <gen>
          • Trigger - Turn off (This trigger)
  • MH Retract
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit - Move MH_Unit[2] instantly to (Position of MH_Link[MH_Links])
      • Unit - Remove MH_Link[MH_Links] from the game
      • Set MH_Links = (MH_Links - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MH_Links Equal to 0
        • Then - Actions
          • Custom script: set udg_MH_Unit[2] = null
          • Custom script: set udg_MH_Unit[1] = null
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Status
Not open for further replies.
Top