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

[Spell] Grab, Throw & Drop Help

Status
Not open for further replies.
Hello, with my Grab, Throw & Drop spell system I am having two issues that I cannot figure out how to resolve.

With this system, you Grab a unit and you can then Throw them toward the targeted location. If you do not throw them in time, they will be Dropped.

The two issues I am having are -

When you cast Grab, it creates a timer for the Drop to occur. Casting Throw will stop that Drop timer. However, if you cast Throw right as the timer for Drop is about to occur, you will still Throw the bag and the grabbed unit will be dropped. This causes the thrown bag to still be visible. I have added a expiration timer to the bag, but would rather the caster to not be able to cast Throw at all if the unit is being dropped.

The second issue is that the bag sfx attachment will remain visible at the caster while Throw is being cast. I have attempted to have the bag attachment be removed from the caster when they cast Throw, but the engine does not remove it fast enough.

Any help is greatly appreciated.

Triggers:
  • Grab Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Level of Throw for (Matching unit)) Equal to 1)) and do (Actions)
        • Loop - Actions
          • Unit - For (Picked unit), Ability Throw , Disable ability: True, Hide UI: True
  • Grab Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Grab
    • Actions
      • -------- This part sets the different variables for making the spell MUI. --------
      • Set VariableSet Grab_Index = (Grab_Index + 1)
      • Set VariableSet Grab_Caster[Grab_Index] = (Triggering unit)
      • Set VariableSet Grab_Counter[Grab_Index] = 0.00
      • Set VariableSet Grab_Boolean[Grab_Index] = True
      • Set VariableSet Grab_Target[Grab_Index] = (Target unit of ability being cast)
      • -------- This part is needed in order to remove the caster from the index. --------
      • Unit Group - Add Grab_Caster[Grab_Index] to Grab_UG
      • -------- This part protects the target while in limbo from being dropped or thrown. --------
      • Unit - Hide Grab_Target[Grab_Index]
      • Unit - Make Grab_Target[Grab_Index] Invulnerable
      • Unit - Pause Grab_Target[Grab_Index]
      • -------- This part disables Grab, Enables throw and then sets Throw to the same level. --------
      • Unit - For Grab_Caster[Grab_Index], Ability Throw , Disable ability: False, Hide UI: False
      • Unit - Set level of Throw for Grab_Caster[Grab_Index] to (Level of Grab for Grab_Caster[Grab_Index])
      • Unit - For Grab_Caster[Grab_Index], Ability Grab , Disable ability: True, Hide UI: True
      • -------- Here is the bag special effect. --------
      • Special Effect - Create a special effect attached to the left hand of Grab_Caster[Grab_Index] using Bag_1.MDX
      • Set VariableSet GrabSFX_Array[Grab_Index] = (Last created special effect)
      • Special Effect - Set Scale of GrabSFX_Array[Grab_Index] to 3.00
      • -------- This part creates the dummy caster to give the grabbing unit the throw buff to indicate when they are able to cast throw. --------
      • Set VariableSet DummyPing = (Position of (Triggering unit))
      • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at DummyPing facing Default building facing degrees
      • Unit - Add Throw Buff Giver to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Triggering unit)
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_DummyPing)
      • -------- -------------------------------------------------------------------------------------------------- --------
      • -------- -------------------------------------------------------------------------------------------------- --------
      • -------- This is the text that will appear stating who grabbed what. Delete this if you do not want it showing in game. --------
      • Game - Display to (All players) the text: (((Name of Grab_Caster[Grab_Index]) + grabbed ) + (Name of Grab_Target[Grab_Index]))
      • -------- -------------------------------------------------------------------------------------------------- --------
      • -------- -------------------------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Grab_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Grab and Drop Loop <gen>
        • Else - Actions
  • Grab and Drop Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Grab_Loop_Integer) from 1 to Grab_Index, do (Actions)
        • Loop - Actions
          • Set VariableSet Grab_Counter[Grab_Loop_Integer] = (Grab_Counter[Grab_Loop_Integer] + 0.10)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Grab_Counter[Grab_Loop_Integer] Greater than (5.10 + ((Real((Level of Grab for Grab_Caster[Grab_Loop_Integer]))) x 1.00))
            • Then - Actions
              • -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------
              • -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------
              • -------- The above condition determines how long the caster is able to hold onto the target. --------
              • -------- The below lines has the caster drop the target and resume as normal. --------
              • -------- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ --------
              • -------- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ --------
              • Special Effect - Set Scale of GrabSFX_Array[Grab_Loop_Integer] to 0.01
              • Special Effect - Destroy GrabSFX_Array[Grab_Loop_Integer]
              • Set VariableSet Grab_Boolean[Grab_Loop_Integer] = False
              • Set VariableSet DummyPing = (Position of Grab_Caster[Grab_Loop_Integer])
              • Unit - Unhide Grab_Target[Grab_Loop_Integer]
              • Unit - Make Grab_Target[Grab_Loop_Integer] Vulnerable
              • Unit - Unpause Grab_Target[Grab_Loop_Integer]
              • Unit - Move Grab_Target[Grab_Loop_Integer] instantly to DummyPing
              • Unit Group - Remove Grab_Caster[Grab_Loop_Integer] from Grab_UG.
              • Custom script: call RemoveLocation(udg_DummyPing)
              • Unit - For Grab_Caster[Grab_Loop_Integer], Ability Throw , Disable ability: True, Hide UI: True
              • Unit - For Grab_Caster[Grab_Loop_Integer], Ability Grab , Disable ability: False, Hide UI: False
              • -------- This part removes the Throw buff. --------
              • Unit - Remove Throw buff from Grab_Caster[Grab_Loop_Integer]
              • -------- -------------------------------------------------------------------------------------------------- --------
              • -------- -------------------------------------------------------------------------------------------------- --------
              • -------- This is the text that will appear stating who dropped what. Delete this if you do not want it showing in game. --------
              • Game - Display to (All players) the text: (((Name of Grab_Caster[Grab_Loop_Integer]) + dropped ) + (Name of Grab_Target[Grab_Loop_Integer]))
              • -------- -------------------------------------------------------------------------------------------------- --------
              • -------- -------------------------------------------------------------------------------------------------- --------
              • Set VariableSet GrabSFX_Array[Grab_Loop_Integer] = GrabSFX_Array[Grab_Index]
              • Set VariableSet Grab_Caster[Grab_Loop_Integer] = Grab_Caster[Grab_Index]
              • Set VariableSet Grab_Target[Grab_Loop_Integer] = Grab_Target[Grab_Index]
              • Set VariableSet Grab_Counter[Grab_Loop_Integer] = Grab_Counter[Grab_Index]
              • Set VariableSet Grab_Index = (Grab_Index - 1)
              • Set VariableSet Grab_Loop_Integer = (Grab_Loop_Integer - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Grab_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
  • Throw Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Throw
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Throw_Skip Equal to 0
        • Then - Actions
          • Trigger - Turn on Throw Loop <gen>
        • Else - Actions
      • Set VariableSet Throw_Times = (Throw_Times + 1)
      • Set VariableSet Throw_Skip = (Throw_Skip + 1)
      • Set VariableSet Throw_Off[Throw_Times] = True
      • -------- Caster/Point Configuration --------
      • Set VariableSet Throw_Caster[Throw_Times] = (Triggering unit)
      • Set VariableSet Throw_Level[Throw_Times] = (Level of Throw for Throw_Caster[Throw_Times])
      • Set VariableSet Throw_Point[0] = (Position of Throw_Caster[Throw_Times])
      • Set VariableSet Throw_Point[1] = (Target point of ability being cast)
      • -------- Throw Stats Configuration --------
      • Set VariableSet Throw_Angle[Throw_Times] = (Angle from Throw_Point[0] to Throw_Point[1])
      • Set VariableSet Throw_AoeSelect[Throw_Times] = 120.00
      • Set VariableSet Throw_AoeFinal[Throw_Times] = 350.00
      • Set VariableSet Throw_Distance[Throw_Times] = 800.00
      • Set VariableSet Throw_Fly[Throw_Times] = 0
      • Set VariableSet Throw_Height[Throw_Times] = 100.00
      • Set VariableSet Throw_Speed[Throw_Times] = 20.00
      • Set VariableSet Throw_Damage[Throw_Times] = ((80.00 + ((Real((Level of Grab for Throw_Caster[Throw_Times]))) x 20.00)) + ((Real((Strength of Throw_Caster[Throw_Times] (Include bonuses)))) x 0.60))
      • -------- Bag Creation --------
      • Unit - Create 1 Bag Dummy for (Owner of (Casting unit)) at Throw_Point[0] facing Throw_Angle[Throw_Times] degrees
      • Set VariableSet Throw_Dummy[Throw_Times] = (Last created unit)
      • Unit - Add a 3.00 second Generic expiration timer to Throw_Dummy[Throw_Times]
      • Unit - Add Crow Form to Throw_Dummy[Throw_Times]
      • Unit - Remove Crow Form from Throw_Dummy[Throw_Times]
      • -------- Leak Cleanup --------
      • Custom script: call RemoveLocation(udg_Throw_Point[0])
      • Custom script: call RemoveLocation(udg_Throw_Point[1])
  • Throw Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Throw_Loop_Integer) from 1 to Throw_Times, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Throw_Off[Throw_Loop_Integer] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Throw_Distance[Throw_Loop_Integer] Less than or equal to 0.00
                • Then - Actions
                  • Set VariableSet Throw_Point[2] = (Position of Throw_Dummy[Throw_Loop_Integer])
                  • Special Effect - Create a special effect at Throw_Point[2] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Set VariableSet Throw_Group[Throw_Loop_Integer] = (Units within Throw_AoeFinal[Throw_Loop_Integer] of Throw_Point[2] matching ((((Matching unit) belongs to an ally of (Owner of Throw_Caster[Throw_Loop_Integer]).) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) is Magic I
                  • Custom script: set bj_wantDestroyGroup = true
                  • Unit Group - Pick every unit in Throw_Group[Throw_Loop_Integer] and do (Actions)
                    • Loop - Actions
                      • Unit - Cause Throw_Caster[Throw_Loop_Integer] to damage (Picked unit), dealing Throw_Damage[Throw_Loop_Integer] damage of attack type Hero and damage type Demolition
                  • Set VariableSet Throw_Skip = (Throw_Skip - 1)
                  • Set VariableSet Throw_Off[Throw_Loop_Integer] = False
                  • Custom script: call DestroyGroup(udg_Throw_Group[udg_Throw_Loop_Integer])
                  • Custom script: call RemoveLocation(udg_Throw_Point[2])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Throw_Skip Equal to 0
                    • Then - Actions
                      • Set VariableSet Throw_Times = 0
                      • Animation - Change Throw_Dummy[Throw_Loop_Integer] flying height to 0.00 at 99999.00
                      • Unit Group - Remove Throw_Caster[Throw_Loop_Integer] from Grab_UG.
                      • For each (Integer Grab_Loop_Integer) from 1 to Grab_Index, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Grab_Caster[Grab_Loop_Integer] is in Grab_UG.) Equal to False
                            • Then - Actions
                              • Set VariableSet Grab_Boolean[Grab_Loop_Integer] = False
                              • Special Effect - Set Scale of GrabSFX_Array[Grab_Loop_Integer] to 0.01
                              • Special Effect - Destroy GrabSFX_Array[Grab_Loop_Integer]
                              • Unit - For Grab_Caster[Grab_Loop_Integer], Ability Grab , Disable ability: False, Hide UI: False
                              • Unit - For Grab_Caster[Grab_Loop_Integer], Ability Throw , Disable ability: True, Hide UI: True
                              • Set VariableSet DummyPing = (Position of Throw_Dummy[Throw_Loop_Integer])
                              • Unit - Unhide Grab_Target[Grab_Loop_Integer]
                              • Unit - Make Grab_Target[Grab_Loop_Integer] Vulnerable
                              • Unit - Move Grab_Target[Grab_Loop_Integer] instantly to DummyPing
                              • Unit - Unpause Grab_Target[Grab_Loop_Integer]
                              • Unit - Remove Throw_Dummy[Throw_Loop_Integer] from the game
                              • Special Effect - Create a special effect at Throw_Point[2] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                              • Special Effect - Destroy (Last created special effect)
                              • Custom script: call RemoveLocation(udg_DummyPing)
                              • -------- This part removes the Throw buff. --------
                              • Unit - Remove Throw buff from Grab_Caster[Grab_Loop_Integer]
                              • -------- -------------------------------------------------------------------------------------------------- --------
                              • -------- -------------------------------------------------------------------------------------------------- --------
                              • -------- This is the text that will appear stating who threw what. Delete this if you do not want it showing in game. --------
                              • Game - Display to (All players) the text: (((Name of Grab_Caster[Grab_Loop_Integer]) + threw ) + (Name of Grab_Target[Grab_Loop_Integer]))
                              • -------- -------------------------------------------------------------------------------------------------- --------
                              • -------- -------------------------------------------------------------------------------------------------- --------
                              • Set VariableSet GrabSFX_Array[Grab_Loop_Integer] = GrabSFX_Array[Grab_Index]
                              • Set VariableSet Grab_Caster[Grab_Loop_Integer] = Grab_Caster[Grab_Index]
                              • Set VariableSet Grab_Target[Grab_Loop_Integer] = Grab_Target[Grab_Index]
                              • Set VariableSet Grab_Counter[Grab_Loop_Integer] = Grab_Counter[Grab_Index]
                              • Set VariableSet Grab_Index = (Grab_Index - 1)
                              • Set VariableSet Grab_Loop_Integer = (Grab_Loop_Integer - 1)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Grab_Index Equal to 0
                                • Then - Actions
                                  • Trigger - Turn off (This trigger)
                                • Else - Actions
                            • Else - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • Set VariableSet Throw_Distance[Throw_Loop_Integer] = (Throw_Distance[Throw_Loop_Integer] - Throw_Speed[Throw_Loop_Integer])
                  • Set VariableSet Throw_Point[3] = (Position of Throw_Dummy[Throw_Loop_Integer])
                  • Set VariableSet Throw_Point[4] = (Throw_Point[3] offset by Throw_Speed[Throw_Loop_Integer] towards Throw_Angle[Throw_Loop_Integer] degrees.)
                  • Item - Create Cheese at Throw_Point[4]
                  • Set VariableSet DummyPing = (Position of (Last created item))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Terrain pathing at Throw_Point[4] of type Walkability is off) Equal to True
                          • (Number of units in Throw_ExGroup[Throw_Loop_Integer]) Greater than 0
                          • (Distance between DummyPing and Throw_Point[4]) Greater than or equal to 1.00
                    • Then - Actions
                      • Set VariableSet Throw_Distance[Throw_Loop_Integer] = 0.00
                    • Else - Actions
                      • Unit - Move Throw_Dummy[Throw_Loop_Integer] instantly to Throw_Point[4]
                      • Special Effect - Create a special effect at Throw_Point[2] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Set VariableSet Throw_ExGroup[Throw_Loop_Integer] = (Units within Throw_AoeSelect[Throw_Loop_Integer] of Throw_Point[4] matching ((((Matching unit) belongs to an ally of (Owner of Throw_Caster[Throw_Loop_Integer]).) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) is Magic
                  • Item - Remove (Last created item)
                  • Custom script: call RemoveLocation(udg_DummyPing)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Throw_Fly[Throw_Loop_Integer] Equal to 0
                    • Then - Actions
                      • Set VariableSet Throw_Height[Throw_Loop_Integer] = (Throw_Height[Throw_Loop_Integer] - 10.00)
                      • Animation - Change Throw_Dummy[Throw_Loop_Integer] flying height to Throw_Height[Throw_Loop_Integer] at 0.00
                    • Else - Actions
                      • Set VariableSet Throw_Height[Throw_Loop_Integer] = (Throw_Height[Throw_Loop_Integer] + 10.00)
                      • Animation - Change Throw_Dummy[Throw_Loop_Integer] flying height to Throw_Height[Throw_Loop_Integer] at 0.00
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Throw_Height[Throw_Loop_Integer] Less than or equal to 0.00
                    • Then - Actions
                      • Set VariableSet Throw_Fly[Throw_Loop_Integer] = 1
                      • Special Effect - Create a special effect at Throw_Point[4] using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Throw_Height[Throw_Loop_Integer] Greater than or equal to 150.00
                    • Then - Actions
                      • Set VariableSet Throw_Fly[Throw_Loop_Integer] = 0
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_Throw_Point[3])
                  • Custom script: call RemoveLocation(udg_Throw_Point[4])
                  • Custom script: call DestroyGroup(udg_Throw_ExGroup[udg_Throw_Loop_Integer])
            • Else - Actions
 

Attachments

  • Grab and Throw v1.2 - 12.16.2020.w3m
    35.3 KB · Views: 24
Last edited:
Level 9
Joined
Mar 26, 2017
Messages
376
1.
As soon as you start the 'Throw Cast' trigger, remove the corresponding instance from the Grab loop.

2.
Destroying an effect will cause it to play its death animation.
You have several options:
-Initiating the destroy at minus death animation duration.
-Set the time or time scale to a high animation to immediately end the death animation.
 
Status
Not open for further replies.
Top