This trigger has leaks

troyboy

New Member
Reaction score
5
Code:
Surge
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Surge 
    Actions
        Set SurgeCaster = (Triggering unit)
        Set SurgeTargets = (Units within 700.00 of (Position of (Triggering unit)))
        Unit Group - Pick every unit in SurgeTargets and do (Actions)
            Loop - Actions
                Unit - Create 1 Dummy unit for (Owner of SurgeCaster) at (Position of SurgeCaster) facing Default building facing degrees
                Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                Unit - Add Surge (dummy)  to (Last created unit)
                Unit - Set level of Surge (dummy)  for (Last created unit) to (Level of Surge  for SurgeCaster)
                Unit - Order (Last created unit) to Neutral - Hurl Boulder (Picked unit)
                Custom script:   call DestroyGroup(udg_SurgeTargets)

The move fires water things at the opponents, stunning and damaging them.

I thought i had all the leaks cleared, but when i tested it it started lagging the more i used the spell.

Can anyone see any leaks i havnt cleared up?

Cheers
 

Squirel

New Member
Reaction score
13
The unit group is probably leaking. Add the function remove all units from last created unit group and see if that helps.

Edit: missed a line of code sorry. I don't have a clue...
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Code:
Surge
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Surge 
    Actions
        Set SurgeCaster = (Triggering unit)
        Set SurgeTargets = (Units within 700.00 of [B](Position of (Triggering unit))[/B])
        Unit Group - Pick every unit in SurgeTargets and do (Actions)
            Loop - Actions
                Unit - Create 1 Dummy unit for (Owner of SurgeCaster) at [B](Position of SurgeCaster)[/B] facing Default building facing degrees
                Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                Unit - Add Surge (dummy)  to (Last created unit)
                Unit - Set level of Surge (dummy)  for (Last created unit) to (Level of Surge  for SurgeCaster)
                Unit - Order (Last created unit) to Neutral - Hurl Boulder (Picked unit)
        [B]Custom script:   call DestroyGroup(udg_SurgeTargets)[/B]

You forgot to remove the two point leaks (bolded in the quote), and you tried to destroy the group inside the loop. Instead, set those two points to variables and remove them with "call RemoveLocation(udg_LOCATION_VARIABLE_NAME_GOES_HERE)"

Also move the DestroyGroup function call to be after the entire loop is done.
 
Reaction score
341
  • Position of (Triggering unit) leaks.
  • Position of SurgeCaster leaks.
  • Custom script: call DestroyGroup(udg_SurgeTargets);
    Place that outside of the UnitGroup's loop actions.
 

Ayanami

칼리
Reaction score
288
Trigger:
  • Surge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Surge
    • Actions
      • Set SurgeCaster = (Triggering unit)
      • Set SurgeCasterLoc = (Position of SurgeCaster)
      • Set SurgeTargets = (Units within 700.00 of SurgeCasterLoc)
      • Unit Group - Pick every unit in SurgeTargets and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy unit for (Owner of SurgeCaster) at SurgeCasterLoc facing Default building facing degrees
          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Surge (dummy) to (Last created unit)
          • Unit - Set level of Surge (dummy) for (Last created unit) to (Level of Surge for SurgeCaster)
          • Unit - Order (Last created unit) to Neutral - Hurl Boulder (Picked unit)
      • Custom script: call DestroyGroup(udg_SurgeTargets)
      • Custom script: call RemoveLocation(udg_SurgeCasterLoc)


Basically, your locations leaked. Therefore, I added the SurgeCasterLoc variable to be "Position of SurgeCaster".
 

troyboy

New Member
Reaction score
5
ok i think i got it sorted.

Code:
Surge2
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Surge 
    Actions
        Set SurgeCaster = (Triggering unit)
        Set SurgeCasterLoc = (Position of SurgeCaster)
        Set SurgeTargets = (Units within 700.00 of SurgeCasterLoc)
        Unit Group - Pick every unit in SurgeTargets and do (Actions)
            Loop - Actions
                Unit - Create 1 Dummy unit for (Owner of SurgeCaster) at (Position of SurgeCaster) facing Default building facing degrees
                Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                Unit - Add Surge (dummy)  to (Last created unit)
                Unit - Set level of Surge (dummy)  for (Last created unit) to (Level of Surge  for SurgeCaster)
                Unit - Order (Last created unit) to Neutral - Hurl Boulder (Picked unit)
        Custom script:   call DestroyGroup(udg_SurgeTargets)
        Custom script:   call RemoveLocation(udg_SurgeCasterLoc)

Right?
 

ludnica

Long gone
Reaction score
61
Eh...
Trigger:
  • Unit - Create 1 Dummy unit for (Owner of SurgeCaster) at SurgeCasterLoc facing Default building facing degrees

You missed SurgeCasterLoc.
 

Igor_Z

You can change this now in User CP.
Reaction score
61
But still your unit ground doesn't have the proper conditions... Make this:
Code:
Set SurgeTargets = (Units within 700.00 of SurgeCasterLoc) matching condition(Matching unit is Magic Immune equal to false and Matching unit is a structure equal to false and Matching unit is alive equal to true and Matching unit belongs to an enemy of Owner of SurgeCaster equal to true
Now that unit group will check what units to pick not all unit in that area
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top