Leak Question

jaybles169

New Member
Reaction score
2
Trigger:
  • LL to HR
    • Events
      • Unit - A unit enters LLspawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
    • Actions
      • Set Max_Hp = ((Integer((Max life of (Triggering unit)))) x NumberOfPlayers)
      • Set Some_Unit = (Triggering unit)
      • Trigger - Run Set Max Hp <gen> (ignoring conditions)
      • Unit - Order (Triggering unit) to Move To (Random point in HighRoad <gen>)


Does this trigger leak the "Random point" in this case?
 

CaptDeath

New Member
Reaction score
103
yes it needs to be a point variable then removed
like set w/e == Random point in HighRoad <gen>)
Unit - Order (Triggering unit) to Move To (w/e)
call RemoveLocation(udg_w/e)
 

ShadowInTheD

Active Member
Reaction score
12
Yes, I think twice.

To fix: Set RandomPoint = Random Point in your region
call RemoveLocation (udg_RandomPoint)

Custom Script: set SomeUnit=null

EDIT:
When you set SomeUnit to triggering unit, you don't even use the variable, so what's the point of setting it? If you don't set it to a variable, it won't leak, so you can remove Custom Script: set SomeUnit=null
 

jaybles169

New Member
Reaction score
2
Cool thanks guys.

The Some_Unit variable gets used in the Set Max Hp trigger which is used quite often; should I still null it after each time Set Max Hp is finished?

One more question. Do I only need one RandomPoint variable (the temporary point variable), even if I have alot of regions (similar to this one) that are issuing move orders constantly?
 

ShadowInTheD

Active Member
Reaction score
12
You'll need to do something completely different actually, no nulling needed.

I have to think, hold on.

EDIT: You will need one per region, so you'll need an array.
call RemoveLocation(RandomPoint[<array number])

Can you show me your other trigger?
 

jaybles169

New Member
Reaction score
2
Trigger:
  • Set Max Hp
    • Events
    • Conditions
    • Actions
      • Set Max_Hp = (Max_Hp - (Integer((Max life of Some_Unit))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Max_Hp Greater than 0
        • Then - Actions
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set Level of Max Life Modifier for Some_Unit to 4
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 100)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set Level of Max Life Modifier for Some_Unit to 3
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 10)
          • For each (Integer A) from 1 to Max_Hp, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set Level of Max Life Modifier for Some_Unit to 2
              • Unit - Remove Max Life Modifier from Some_Unit
        • Else - Actions
          • Set Max_Hp = (0 - Max_Hp)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set Level of Max Life Modifier for Some_Unit to 7
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 100)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set Level of Max Life Modifier for Some_Unit to 6
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 10)
          • For each (Integer A) from 1 to Max_Hp, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set Level of Max Life Modifier for Some_Unit to 5
              • Unit - Remove Max Life Modifier from Some_Unit


This was actually written by Tom Jones, and I imported it from a demo map he made for it. I have no idea how it actually works, in a literal sense, but it allows me to change a units hp to whatever I want quite easily. If you look at the first trigger I posted what I do is scale the created units hp according to how many players are playing.
 

ShadowInTheD

Active Member
Reaction score
12
This should work: Just do Custom Script: set udg_Some_Unit = null at the end of the Set Max Life trigger
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
>Just do Custom Script: set udg_Some_Unit = null
...Why? Some_Unit is a global, it doesn't need to be nulled. Only locals must be nulled.
 

ShadowInTheD

Active Member
Reaction score
12
Bleh, what's the difference between locals and globals, besides the fact that locals are only in the function they were created in?
 

CaptDeath

New Member
Reaction score
103
the fact that globals can be used globaly and locals cant and are no longer after being called
 

takethat

Active Member
Reaction score
12
global unit can use like this

trigger-1
a skill target on a unit, set target unit as <targe_unit> (a unit variable)

trigger-2
periodic event - every 1 second
set life of <target_unit> = life of <target_unit> - 100

so if unit variable must be null, than it cant be done like wat i say...

btw, you may only need 1 point variable to reduce the number of variable you save, example <TempPoint>

since you will remove the point at the moment it be used, as long as no wait or no cross trigger usage, 1 TempPoint can do the job
 
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