• 🏆 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] Hookshot Crash

Status
Not open for further replies.
Level 26
Joined
Oct 2, 2011
Messages
2,482
[SOLVED] Hookshot Crash

Is there something wrong with this?
It works perfectly for me, but two Hivers who tested it reported crashes assosiated with this trigger.

The ability fires a hookshot in casters facing direction, and pulls in small (Summoned) units and pulls the caster to all other targets.

  • HookshotMissile
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Trigger - Turn off Move <gen>
      • Set Pos1 = (Position of HookshotMissile)
      • Set Pos2 = (Position of Char)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Pos2 and Pos1) Greater than 600.00
        • Then - Actions
          • Unit - Remove HookshotMissile from the game
          • Animation - Reset Char's animation
          • Lightning - Destroy (Last created lightning effect)
          • Trigger - Turn on Move <gen>
          • Set CurrentlyAttacking = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • MoveDown Equal to True
                  • MoveRight Equal to True
                  • MoveUp Equal to True
                  • MoveLeft Equal to True
            • Then - Actions
              • Custom script: call SetUnitAnimationByIndex(udg_Char, 2)
            • Else - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Set Pos3 = (Pos1 offset by 40.00 towards (Facing of HookshotMissile) degrees)
          • Unit - Move HookshotMissile instantly to Pos3
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units within 80.00 of Pos3 matching ((Owner of (Matching unit)) Not equal to Player 1 (Red)))) Greater than 0
            • Then - Actions
              • Set UnitGroup = (Units within 80.00 of Pos3 matching ((Owner of (Matching unit)) Not equal to Player 1 (Red)))
              • Unit Group - Pick every unit in UnitGroup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is Summoned) Not equal to True
                    • Then - Actions
                      • Trigger - Turn on HookshotPull <gen>
                    • Else - Actions
                      • Set HookshotGrabbedItem = (Picked unit)
                      • Trigger - Turn on HookshotPullObject <gen>
                  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\PriestMissile\PriestMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause Char to damage (Picked unit), dealing (CharDamage / 2.00) damage of attack type Spells and damage type Normal
              • Custom script: call DestroyGroup (udg_UnitGroup)
              • Unit - Turn collision for Char Off
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Trigger - Turn off HookshotPull <gen>
              • Trigger - Turn off HookshotPullObject <gen>
          • Custom script: call RemoveLocation (udg_Pos3)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Set Pos1 = (Position of HookshotMissile)
      • Custom script: call MoveLightningEx(udg_HookLightning, true, GetLocationX(udg_Pos1), GetLocationY(udg_Pos1), GetLocationZ(udg_Pos1) + 50, GetLocationX(udg_Pos2), GetLocationY(udg_Pos2), GetLocationZ(udg_Pos2) + 50)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Pos2)
Here are the other two triggers that this trigger utilizes:
  • HookshotPull
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Animation - Change HookshotMissile's animation speed to 0.00% of its original speed
      • Custom script: call SetUnitAnimationByIndex(udg_Char, 15)
      • Set Pos1 = (Position of Char)
      • Set Pos3 = (Position of HookshotMissile)
      • Set Pos2 = (Pos1 offset by 45.00 towards (Angle from Pos1 to Pos3) degrees)
      • Unit - Move Char instantly to Pos2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Pos3 and Pos1) Less than 128.00
        • Then - Actions
          • Animation - Reset Char's animation
          • Unit - Remove HookshotMissile from the game
          • Lightning - Destroy (Last created lightning effect)
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off HookshotMissile <gen>
          • Unit - Turn collision for Char On
          • Set CurrentlyAttacking = False
          • Trigger - Turn on Move <gen>
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • MoveDown Equal to True
                  • MoveRight Equal to True
                  • MoveUp Equal to True
                  • MoveLeft Equal to True
            • Then - Actions
              • Custom script: call SetUnitAnimationByIndex(udg_Char, 2)
            • Else - Actions
        • Else - Actions
          • Trigger - Turn off Move <gen>
      • Custom script: call DestroyGroup (udg_UnitGroup)
      • Custom script: call MoveLightningEx(udg_HookLightning, true, GetLocationX(udg_Pos1), GetLocationY(udg_Pos1), GetLocationZ(udg_Pos1) + 50, GetLocationX(udg_Pos3), GetLocationY(udg_Pos3), GetLocationZ(udg_Pos3) + 50)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Pos2)
      • Custom script: call RemoveLocation (udg_Pos3)
  • HookshotPullObject
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Animation - Change HookshotMissile's animation speed to 0.00% of its original speed
      • Custom script: call SetUnitAnimationByIndex(udg_Char, 2)
      • Set Pos1 = (Position of HookshotMissile)
      • Set Pos3 = (Position of Char)
      • Set Pos2 = (Pos1 offset by 45.00 towards (Angle from Pos1 to Pos3) degrees)
      • Unit - Move HookshotMissile instantly to Pos2
      • Custom script: call RemoveLocation (udg_Pos1)
      • Set Pos1 = (Position of HookshotMissile)
      • Unit - Move HookshotGrabbedItem instantly to Pos1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Pos3 and Pos1) Less than 128.00
        • Then - Actions
          • Set HookshotGrabbedItem = No unit
          • Animation - Reset Char's animation
          • Unit - Remove HookshotMissile from the game
          • Lightning - Destroy (Last created lightning effect)
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off HookshotMissile <gen>
          • Unit - Turn collision for Char On
          • Set CurrentlyAttacking = False
          • Trigger - Turn on Move <gen>
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • MoveDown Equal to True
                  • MoveRight Equal to True
                  • MoveUp Equal to True
                  • MoveLeft Equal to True
            • Then - Actions
              • Custom script: call SetUnitAnimationByIndex(udg_Char, 2)
            • Else - Actions
        • Else - Actions
          • Trigger - Turn off Move <gen>
      • Custom script: call DestroyGroup (udg_UnitGroup)
      • Custom script: call MoveLightningEx(udg_HookLightning, true, GetLocationX(udg_Pos1), GetLocationY(udg_Pos1), GetLocationZ(udg_Pos1) + 50, GetLocationX(udg_Pos3), GetLocationY(udg_Pos3), GetLocationZ(udg_Pos3) + 50)
      • Custom script: call RemoveLocation (udg_Pos1)
      • Custom script: call RemoveLocation (udg_Pos2)
      • Custom script: call RemoveLocation (udg_Pos3)
Here you can find a test map with the trigger:
http://www.hiveworkshop.com/forums/requests-341/bug-hunting-opinions-278861/
 
Last edited:
Level 26
Joined
Oct 2, 2011
Messages
2,482
Ah, yes!
Well I had that "bug" too, but it won't be a problem later since I won't have large buildings in my map. It was a bad example putting it there.
Although, you don't have to restart the map, you can simply use "Rewind" to get out of there as it targets the closest walkable location. :)

But no troubles for you?
So far 2 no crash, 2 crash... :|

Thanks!
 
Level 26
Joined
Oct 2, 2011
Messages
2,482
Yeah, they said it crashed a little before reaching max range, so that means the problem has to be in that first trigger.

I am using a custom lightning effect (.slk), but that shouldn't be a problem... :/

What did you think of the abilities in general? :)
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Ermm since you refer to bj_lastCreatedLightning when you destroy the lightning, I would just make sure that you actually have an active lightning effect. That was just a minor suggestion though, I could be remembering the whole "destroying a null lightning" issue wrong. I would need more details on their crash before actually coming up with a conclusion.
 
Level 26
Joined
Oct 2, 2011
Messages
2,482
Ok, I read some threads about it, and it seems you are right.
Destroying Null Lightnings almost always causes crashes, so you have to change or nullify their variable before destroying.

I fixed it my way though.
I do not remove the lightning at all, as it is not needed. I just make it invisible instead.
The trigger got slightly smaller and it matches the animation a little bit better.

I'm gonna contact the users that got crashes and see if it is fixed.

Thanks for your help! :)
 
Status
Not open for further replies.
Top