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

[Trigger] Need help with my "Wisp Hook"

Status
Not open for further replies.
Level 5
Joined
Nov 17, 2010
Messages
28

  • Wisp Hook CAST
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Wisp Hook
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Index[0] Equal to 0
        • Then - Actions
          • Trigger - Turn on Wisp Hook LOOP <gen>
        • Else - Actions
      • Set Index[0] = (Index[0] + 1)
      • Set Index[1] = (Index[1] + 1)
      • Set Caster[Index[1]] = (Triggering unit)
      • Set Point[Index[1]] = (Position of (Triggering unit))
      • Set Point1[Index[1]] = (Target point of ability being cast)
      • Set Angle[Index[1]] = (Angle from Point[Index[1]] to Point1[Index[1]])
      • Set Velocity = 30.00
      • Set Damage = 360.00
      • Set Come[Index[1]] = False
      • Set AreaOfEffect = 150.00
      • Set ActualDistance[Index[1]] = 0.00
      • Set Distance = 900.00
      • Set ActualDistance[Index[1]] = 0.00
      • Set Target[Index[1]] = No unit
      • Unit Group - Pick every unit in Group[Index[1]] and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Picked unit) from Group[Index[1]]
      • Custom script: call DestroyGroup(udg_Group[udg_Index[1]])
      • Set Boolean[Index[1]] = True



  • Wisp Hook LOOP
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Index[2]) from 1 to Index[1], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Boolean[Index[2]] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ActualDistance[Index[2]] Less than Distance
                  • Come[Index[2]] Equal to False
                • Then - Actions
                  • Set ActualDistance[Index[2]] = (ActualDistance[Index[2]] + Velocity)
                  • Set TempPoint = (Point[Index[2]] offset by ActualDistance[Index[2]] towards Angle[Index[2]] degrees)
                  • Unit - Create 1 Hook for (Owner of Caster[Index[2]]) at TempPoint facing Angle[Index[2]] degrees
                  • Set Dummy = (Last created unit)
                  • Unit Group - Add Dummy to Group[Index[2]]
                  • Set Target[Index[2]] = (Random unit from (Units within AreaOfEffect of TempPoint matching (((((Matching unit) is A structure) Equal to False) and (Caster[Index[2]] Not equal to (Matching unit))) and (((Matching unit) is alive) Equal to True))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Target[Index[2]] Not equal to No unit
                    • Then - Actions
                      • Set Come[Index[2]] = True
                      • Unit - Turn collision for Target[Index[2]] Off
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Target[Index[2]] belongs to an enemy of (Owner of Caster[Index[2]])) Equal to True
                        • Then - Actions
                          • Unit - Cause Caster[Index[2]] to damage Target[Index[2]], dealing Damage damage of attack type Spells and damage type Normal
                        • Else - Actions
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                • Else - Actions
                  • Set Come[Index[2]] = True
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Come[Index[2]] Equal to True
                      • ActualDistance[Index[2]] Greater than or equal to 100.00
                    • Then - Actions
                      • Set ActualDistance[Index[2]] = (ActualDistance[Index[2]] - Velocity)
                      • Set TempPoint = (Point[Index[2]] offset by ActualDistance[Index[2]] towards Angle[Index[2]] degrees)
                      • Unit - Move Target[Index[2]] instantly to TempPoint
                      • Special Effect - Create a special effect at (Position of Target[Index[2]]) using Objects\Spawnmodels\Orc\Orcblood\OrcBloodHellScream.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit Group - Pick every unit in (Units within 29.00 of (Position of Target[Index[2]]) matching (((Matching unit) is in Group[Index[2]]) Equal to True)) and do (Actions)
                        • Loop - Actions
                          • Unit - Explode (Picked unit)
                      • Custom script: call RemoveLocation(udg_TempPoint)
                    • Else - Actions
                      • Unit - Turn collision for Target[Index[2]] Off
                      • Custom script: call DestroyGroup(udg_Group[udg_Index[2]])
                      • Set Boolean[Index[2]] = False
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Boolean[Index[2]] Equal to False
                        • Then - Actions
                          • Set Index[0] = (Index[0] - 1)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Index[0] Equal to 0
                            • Then - Actions
                              • Set Index[1] = 0
                              • Trigger - Turn off (This trigger)
                            • Else - Actions
                        • Else - Actions
            • Else - Actions


My problem is this! :vw_sad:

Imprezy-WAR3_1317573790.jpg


When the Hook targets an enemy, the enemy comes to the caster but the dummys aren't killed/exploded/removed :S :ogre_rage:

Can anyone answerme the solution? or fix the map? :ogre_haosis:
 

Attachments

  • Wisp Hook.w3x
    21.5 KB · Views: 64
Level 6
Joined
Apr 16, 2011
Messages
158
Well I do not know if this is what you want:
add this line in Wisp Hook LOOP
  • Unit - Add a 0.50 second Generic expiration timer to Dummy
and
  • Animation - Play Dummy's Death animation
Notice how I put together:



  • Wisp Hook LOOP
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Index[2]) from 1 to Index[1], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Boolean[Index[2]] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ActualDistance[Index[2]] Less than Distance
                  • Come[Index[2]] Equal to False
                • Then - Actions
                  • Set ActualDistance[Index[2]] = (ActualDistance[Index[2]] + Velocity)
                  • Set TempPoint = (Point[Index[2]] offset by ActualDistance[Index[2]] towards Angle[Index[2]] degrees)
                  • Unit - Create 1 Hook for (Owner of Caster[Index[2]]) at TempPoint facing Angle[Index[2]] degrees
                  • Set Dummy = (Last created unit)
                  • Unit - Add a 0.50 second Generic expiration timer to Dummy
                  • Animation - Play Dummy's Death animation
                  • Unit Group - Add Dummy to Group[Index[2]]
                  • Set Target[Index[2]] = (Random unit from (Units within AreaOfEffect of TempPoint matching (((((Matching unit) is A structure) Equal to False) and (Caster[Index[2]] Not equal to (Matching unit))) and (((Matching unit) is alive) Equal to True))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Target[Index[2]] Not equal to No unit
                    • Then - Actions
                      • Set Come[Index[2]] = True
                      • Unit - Turn collision for Target[Index[2]] Off
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Target[Index[2]] belongs to an enemy of (Owner of Caster[Index[2]])) Equal to True
                        • Then - Actions
                          • Unit - Cause Caster[Index[2]] to damage Target[Index[2]], dealing Damage damage of attack type Spells and damage type Normal
                        • Else - Actions
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                • Else - Actions
                  • Set Come[Index[2]] = True
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Come[Index[2]] Equal to True
                      • ActualDistance[Index[2]] Greater than or equal to 100.00
                    • Then - Actions
                      • Set ActualDistance[Index[2]] = (ActualDistance[Index[2]] - Velocity)
                      • Set TempPoint = (Point[Index[2]] offset by ActualDistance[Index[2]] towards Angle[Index[2]] degrees)
                      • Unit - Move Target[Index[2]] instantly to TempPoint
                      • Special Effect - Create a special effect at (Position of Target[Index[2]]) using Objects\Spawnmodels\Orc\Orcblood\OrcBloodHellScream.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit Group - Pick every unit in (Units within 29.00 of (Position of Target[Index[2]]) matching (((Matching unit) is in Group[Index[2]]) Equal to True)) and do (Actions)
                        • Loop - Actions
                      • Custom script: call RemoveLocation(udg_TempPoint)
                    • Else - Actions
                      • Unit - Turn collision for Target[Index[2]] Off
                      • Custom script: call DestroyGroup(udg_Group[udg_Index[2]])
                      • Set Boolean[Index[2]] = False
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Boolean[Index[2]] Equal to False
                        • Then - Actions
                          • Set Index[0] = (Index[0] - 1)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Index[0] Equal to 0
                            • Then - Actions
                              • Set Index[1] = 0
                              • Trigger - Turn off (This trigger)
                            • Else - Actions
                        • Else - Actions
            • Else - Actions
was not very good but it is something ^ ^
I love the effect ^^
 
Last edited:
Level 5
Joined
Nov 17, 2010
Messages
28
Well I do not know if this is what you want:
add this line in Wisp Hook LOOP
  • Unit - Add a 0.50 second Generic expiration timer to Dummy
and
  • Animation - Play Dummy's Death animation
Notice how I put together:



  • Wisp Hook LOOP
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Index[2]) from 1 to Index[1], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Boolean[Index[2]] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ActualDistance[Index[2]] Less than Distance
                  • Come[Index[2]] Equal to False
                • Then - Actions
                  • Set ActualDistance[Index[2]] = (ActualDistance[Index[2]] + Velocity)
                  • Set TempPoint = (Point[Index[2]] offset by ActualDistance[Index[2]] towards Angle[Index[2]] degrees)
                  • Unit - Create 1 Hook for (Owner of Caster[Index[2]]) at TempPoint facing Angle[Index[2]] degrees
                  • Set Dummy = (Last created unit)
                  • Unit - Add a 0.50 second Generic expiration timer to Dummy
                  • Animation - Play Dummy's Death animation
                  • Unit Group - Add Dummy to Group[Index[2]]
                  • Set Target[Index[2]] = (Random unit from (Units within AreaOfEffect of TempPoint matching (((((Matching unit) is A structure) Equal to False) and (Caster[Index[2]] Not equal to (Matching unit))) and (((Matching unit) is alive) Equal to True))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Target[Index[2]] Not equal to No unit
                    • Then - Actions
                      • Set Come[Index[2]] = True
                      • Unit - Turn collision for Target[Index[2]] Off
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Target[Index[2]] belongs to an enemy of (Owner of Caster[Index[2]])) Equal to True
                        • Then - Actions
                          • Unit - Cause Caster[Index[2]] to damage Target[Index[2]], dealing Damage damage of attack type Spells and damage type Normal
                        • Else - Actions
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                • Else - Actions
                  • Set Come[Index[2]] = True
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Come[Index[2]] Equal to True
                      • ActualDistance[Index[2]] Greater than or equal to 100.00
                    • Then - Actions
                      • Set ActualDistance[Index[2]] = (ActualDistance[Index[2]] - Velocity)
                      • Set TempPoint = (Point[Index[2]] offset by ActualDistance[Index[2]] towards Angle[Index[2]] degrees)
                      • Unit - Move Target[Index[2]] instantly to TempPoint
                      • Special Effect - Create a special effect at (Position of Target[Index[2]]) using Objects\Spawnmodels\Orc\Orcblood\OrcBloodHellScream.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit Group - Pick every unit in (Units within 29.00 of (Position of Target[Index[2]]) matching (((Matching unit) is in Group[Index[2]]) Equal to True)) and do (Actions)
                        • Loop - Actions
                      • Custom script: call RemoveLocation(udg_TempPoint)
                    • Else - Actions
                      • Unit - Turn collision for Target[Index[2]] Off
                      • Custom script: call DestroyGroup(udg_Group[udg_Index[2]])
                      • Set Boolean[Index[2]] = False
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Boolean[Index[2]] Equal to False
                        • Then - Actions
                          • Set Index[0] = (Index[0] - 1)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Index[0] Equal to 0
                            • Then - Actions
                              • Set Index[1] = 0
                              • Trigger - Turn off (This trigger)
                            • Else - Actions
                        • Else - Actions
            • Else - Actions
was not very good but it is something ^ ^
I love the effect ^^

MMM. I just want to when the hook ends, it comes to the hero, removing the dummys
 
Level 12
Joined
Aug 12, 2008
Messages
349
By the way, I think you should use new indexing system to avoid bug. Some bug may occur for certain condition if you use this indexing. Well, it's not necessary to change the indexing system if you it functions well.
But, array should be avoided if it isn't needed such as the index variable. :)
If you want to change the indexing system, check the "Recommended" section under my signature. :)
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
I wasn't looking on script carefully right now but I hear "group array" in GUI - and in 99% cases most GUI-users don't know what array groups have to be initialized at first - if you don't, given group doesn't exist (though groups with index [0] and [1] are declared at map init).

So before doing anything about group manipulation actually, you should do:

  • Custom script: if udg_Group[udg_Index[1]] == null then
  • Custom script: set udg_Group[udg_Index[1]] = CreateGroup()
  • Custom script: endif
  • // and then the group manipulation
  • Unit Group - Pick every unit in Group[Index[1]] and do (Actions)
You should be using Dynamic indexing instead of this old, inefficient indexing system.
 
Status
Not open for further replies.
Top