• 🏆 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] Knockback Sytem (Remove Leaks)

Status
Not open for further replies.
Level 11
Joined
Sep 12, 2008
Messages
657
Just for any ideas: this knockback system was made by me.
The Code:

  • Knockback Gui
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Knockback_Group and do (Actions)
        • Loop - Actions
          • Set Knockback_Point2 = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between Knockback_Point[(Custom value of (Picked unit))] and Knockback_Point2) Less than or equal to (Knockback_Distance[(Custom value of (Picked unit))] x Knockback_Duration[(Custom value of (Picked unit))])
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Coliseun_Range) Equal to 0
                • Then - Actions
                  • Unit - Move (Picked unit) instantly to (Knockback_Point2 offset by Knockback_Distance[(Custom value of (Picked unit))] towards Knockback_Angle[(Custom value of (Picked unit))] degrees)
                  • Special Effect - Create a special effect at Knockback_Point2 using Knockback_Effect[(Custom value of (Picked unit))]
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Unit Group - Pick every unit in Coliseun_Range and do (Actions)
                    • Loop - Actions
                      • Set Knockback_Starter[(Custom value of (Picked unit))] = (Picked unit)
                      • Set Knockback_Point[(Custom value of (Picked unit))] = (Position of (Picked unit))
                      • Set Knockback_Angle[(Custom value of (Picked unit))] = ((Facing of (Picked unit)) + 180.00)
                      • Set Knockback_Distance[(Custom value of (Picked unit))] = 50.00
                      • Set Knockback_Duration[(Custom value of (Picked unit))] = 2.00
                      • Set Knockback_Effect[(Custom value of (Picked unit))] = Effect-KnockbackDust.mdx
                      • Unit Group - Add (Picked unit) to Knockback_Group
            • Else - Actions
              • Unit Group - Remove (Picked unit) from Knockback_Group
              • Set Knockback_Point[(Custom value of (Picked unit))] = (Position of (Picked unit))
              • -------- set udg_Knockback_Point[GetUnitUserData(GetEnumUnit())] = GetUnitLoc(GetEnumUnit()) --------
              • Custom script: call RemoveLocation(udg_Knockback_Point[GetUnitUserData(GetEnumUnit())]
          • Custom script: call RemoveLocation(udg_Knockback_Point2)


My problem is this:

i need to remove the Knockback_Point(Custom value of Picked unit),
but since im not so good with jass.. and we dont really get along..
i cant really understend how to cheak unit custom value..
so.. if any 1 can help, it'll be awesome. thanks.
 
Level 13
Joined
Mar 24, 2010
Messages
950
Is this all you want to be able to use a condition with unit values?

  • (Custom value of (Triggering unit)) Greater than 0
this is a good example of how to clean unit group leaks
  • Spirit Vortex
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Group = (Units of type Spirit Vortex)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Set Point = (Position of Warden 0048 <gen>)
          • Set Point2 = (Position of (Picked unit))
          • Set Point3 = (Position of Warden 0048 <gen>)
          • Set Point4 = (Point offset by (Real((Custom value of (Picked unit)))) towards ((Angle from Point to Point2) + 5.00) degrees)
          • Unit - Move (Picked unit) instantly to Point4
          • Custom script: call RemoveLocation(udg_Point)
          • Custom script: call RemoveLocation(udg_Point2)
          • Custom script: call RemoveLocation(udg_Point3)
          • Custom script: call RemoveLocation(udg_Point4)
      • Custom script: call DestroyGroup(udg_Group)
 
Level 11
Joined
Sep 12, 2008
Messages
657
well..
"i need to remove the Knockback_Point(Custom value of Picked unit),"
as i sayd..
i setted all units custom values as X..
then i use it in the knockback group..
then i wanna remove a leak from a point which uses it..
(Custom value of picked unit), i tried call RemoveLocation(udg_Knockback_Point[GetUnitUserData(GetEnumUnit())]
but it syntax error's for me..
 
Status
Not open for further replies.
Top