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

Something.. leaks

Status
Not open for further replies.
Level 2
Joined
Feb 12, 2023
Messages
11
Well so I have this trigger, some may know it. But once I want to test it, it puts me into game lobby
  • DrainLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- --------
      • Custom script: if udg_zLoc == null then
      • Set zLoc = (Point(0.00, 0.00))
      • Custom script: endif
      • Set i2 = 0
      • For each (Integer i) from 1 to Drain_Max, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Drain_Caster[i] not Equal to No Unit
              • (Drain_Caster[i] is dead) Equal to False
              • (Current order of Drain_Caster[i]) Equal to (Order(channel))
            • Then - Actions
              • Set Drain_Interval[(i x 2)] = (Drain_Interval[(i x 2)] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Drain_Interval[(i x 2)] Equal to Drain_Interval[((i x 2) + 1)]
                • Then - Actions
                  • Set Drain_Interval[(i x 2)] = 0
                • Else - Actions
              • -------- Special effects --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 2) Equal to 1
                • Then - Actions
                  • Special Effect - Create a special effect attached to the overhead of Drain_Caster[i] using Abilities\Spells\Other\Parasite\ParasiteTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
              • -------- --------
              • -------- Cause GetUnitX returns the x-position of the caster --------
              • Custom script: set udg_x = GetUnitX( udg_Drain_Caster[udg_i] )
              • Custom script: set udg_y = GetUnitY( udg_Drain_Caster[udg_i] )
              • Unit Group - Pick every unit in Drain_Targets[i] and do (Actions)
                • Loop - Actions
                  • -------- Set x and y location of the target --------
                  • Custom script: set udg_x2 = GetUnitX( GetEnumUnit() )
                  • Custom script: set udg_y2 = GetUnitY( GetEnumUnit() )
                  • -------- Conditions: --------
                  • -------- And within range (Pythagoras) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked unit) not Equal to No Unit
                      • ((Picked unit) is dead) Equal to False
                      • ((Picked unit) is Resistant to Magic) Equal to False
                      • ((Picked unit) is visible to (Owner of Drain_Caster[i])) Equal to True
                      • Drain_Range[i] Greater than or Equal (((x - x2) x (x - x2)) + ((y - y2) x (y - y2)))
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Drain_Interval[(i x 2)] Equal to 0
                        • Then - Actions
                          • -------- Damage --------
                          • Unit - Cause Drain_Caster[i] to damage (Picked unit), dealing Drain_Value[i] damage of attack type Spell and damage type Normal
                          • -------- Drain Life --------
                          • Unit - Set life of Drain_Caster[i] to ((Life of Drain_Caster[i]) + Drain_Value[i])
                        • Else - Actions
                      • -------- Check if there is a lightning to use in the stack --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Drain_Life_Max Equal to i2
                        • Then - Actions
                          • -------- If this is not the case: Create one --------
                          • Set loc = (Point(0.00, 0.00))
                          • Lightning - Create a Life Drain lightning effect from source loc to target loc
                          • Set Drain_Life_Lightning[i2] = (Last created lightning effect)
                          • Set Drain_Life_Max = (Drain_Life_Max + 1)
                          • Custom script: call RemoveLocation( udg_loc )
                        • Else - Actions
                          • -------- Since there is no "GetUnitZ" we have to move a location to the units position and use "GetLocationZ" instead --------
                          • -------- Actually the same as "set zLoc = Point( x, y )" but without leak --------
                          • Custom script: call MoveLocation( udg_zLoc, udg_x, udg_y)
                          • -------- Of cause we need the flying height, too --------
                          • -------- + 50 to move the lightning to the center of the unit instead of its feet --------
                          • Custom script: set udg_z = GetUnitFlyHeight( udg_Drain_Caster[udg_i] ) + GetLocationZ( udg_zLoc ) + 50
                          • Custom script: call MoveLocation( udg_zLoc, udg_x2, udg_y2)
                          • -------- Move the lightning to the two x/y/z locations we got --------
                          • -------- "true": check visiblity (do not show the lightning in fog for players who are unable to see the lightning) --------
                          • Custom script: call MoveLightningEx( udg_Drain_Life_Lightning[udg_i2], true, udg_x, udg_y, udg_z, udg_x2, udg_y2, GetUnitFlyHeight( GetEnumUnit() ) + GetLocationZ( udg_zLoc ) + 35 )
                      • Set i2 = (i2 + 1)
                    • Else - Actions
                      • -------- Remove unvalid unit from group --------
                      • Unit Group - Remove (Picked unit) from Drain_Targets[i]
              • -------- Stop instance from running if there are no units left to drain off --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Drain_Targets[i] is empty) Equal to True
                • Then - Actions
                  • Unit - Order Drain_Caster[i] to Stop
                  • Set Drain_Caster[i] = No Unit
                • Else - Actions
            • Else - Actions
              • -------- Shift data to optimize performance --------
              • Unit Group - Remove all units from Drain_Targets[i]
              • Unit Group - Add all units of Drain_Targets[Drain_Max] to Drain_Targets[i]
              • Unit Group - Remove all units from Drain_Targets[Drain_Max]
              • Set Drain_Caster[i] = Drain_Caster[Drain_Max]
              • Set Drain_Range[i] = Drain_Range[Drain_Max]
              • Set Drain_Value[i] = Drain_Value[Drain_Max]
              • Set Drain_Interval[(i x 2)] = Drain_Interval[(Drain_Max x 2)]
              • Set Drain_Interval[((i x 2) + 1)] = Drain_Interval[((Drain_Max x 2) + 1)]
              • Set Drain_Max = (Drain_Max - 1)
              • Set i = (i - 1)
              • -------- Turns of the trigger if there is nothing to do anymore --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Drain_Max Lesser 1
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i2 Lesser Drain_Life_Max
        • Then - Actions
          • -------- If there are too many lightnings the stack will be cleared --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Drain_Max Lesser 1
              • Drain_Life_Max Greater than 10
            • Then - Actions
              • -------- Destroys all lightnings to prevent lag --------
              • For each (Integer i) from 0 to (Drain_Life_Max - 1), do (Actions)
                • Loop - Actions
                  • Lightning - Destroy Drain_Life_Lightning[i]
              • Set Drain_Life_Max = 0
            • Else -Actions
              • -------- Hides all unused lightnings --------
              • -------- (A lightning with a length of 0 will not be shown) --------
              • Set loc = (Point(0.00, 0.00))
              • For each (Integer i) from i2 to (Drain_Life_Max - 1), do (Actions)
                • Loop - Actions
                  • Lightning - Move Drain_Life_Lightning[i] to source loc and target loc
              • Custom script: call RemoveLocation( udg_loc )
        • Else - Actions
I kind of think that it's the problem, deleting it starts the game but Life Drain effect doesnt appear after casting the spell
  • -------- Since there is no "GetUnitZ" we have to move a location to the units position and use "GetLocationZ" instead --------
    • -------- Actually the same as "set zLoc = Point( x, y )" but without leak --------
    • Custom script: call MoveLocation( udg_zLoc, udg_x, udg_y)
    • -------- Of cause we need the flying height, too --------
    • -------- + 50 to move the lightning to the center of the unit instead of its feet --------
    • Custom script: set udg_z = GetUnitFlyHeight( udg_Drain_Caster[udg_i] ) + GetLocationZ( udg_zLoc ) + 50
    • Custom script: call MoveLocation( udg_zLoc, udg_x2, udg_y2)
    • -------- Move the lightning to the two x/y/z locations we got --------
    • -------- "true": check visiblity (do not show the lightning in fog for players who are unable to see the lightning) --------
    • Custom script: call MoveLightningEx( udg_Drain_Life_Lightning[udg_i2], true, udg_x, udg_y, udg_z, udg_x2, udg_y2, GetUnitFlyHeight( GetEnumUnit() ) + GetLocationZ( udg_zLoc ) + 35 )
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
What's going on with Drain interval? That looks pretty messy.

Also, I would store the Position of the Caster in a Point variable when you first cast the ability if your Unit can't be "pushed" while draining. That and create a single Point variable that's dedicated to this Spell for getting the Z Height (zLoc), although it could really be used for any number of triggers. Constantly recreating the Points seems pretty inefficient.

Anyway, you already answered your own question, when you delete the Lightning it starts working again. I imagine you're referencing unset variables or something in the MoveLightningEx function which breaks things.
 
Level 2
Joined
Feb 12, 2023
Messages
11
Also, I would store the Position of the Caster in a Point variable when you first cast the ability if your Unit can't be "pushed" while draining. That and create a single Point variable that's dedicated to this Spell for getting the Z Height (zLoc), although it could really be used for any number of triggers. Constantly recreating the Points seems pretty inefficient.
You're right, gonna write a fix for that
Yet after deleting this section I linked, there's no Life Drain vfx, spell works fine but there;s no graphics dont know why
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
Are your game graphics quality settings set to highest? Could just not be showing it for you because your settings are low (used to be a much more common thing). You could check that the lightning does in fact exist by printing its Handle ID:
JASS:
call BJDebugMsg("Lightning HID: " + I2S(GetHandleId(udg_Drain_Life_Lightning[udg_i2])))
 
Level 2
Joined
Feb 12, 2023
Messages
11
It's weird. Checked that and it's true, also checked graphics and they're set to very high. Yet the effect doesnt appear in game. Well at this point i'm lost
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
Perhaps lightning effects only show if both endpoints are visible on screen. Is one end of it off-screen for you? Another dumb idea: maybe Reforged devs fucked with the internal file paths for lightning effects so the ones used by GUI are wrong.

If you make a lightning effect manually somewhere else does it show up?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570

I think you have to constantly recreate the Lightning instead of Moving it.
 
Status
Not open for further replies.
Top