teleports with no leak

Jarko89

New Member
Reaction score
1
Ok i explain my problem. There is an island and a gate in the middle of it. The island is all covered by a region called: Regione 005. Under the gate there is a region called To 006. The next island is Regione 006 (obvious)

I have a trigger that do this: when a hero enters the gate, if there are no creeps in the island, the hero is teleported to the nex island. It always worked perfectly, but then i discovered what memory leaks are, so i tried to make the trigger leaks-free...

and now the triggers works for the first time, but when i come back to that island and creeps are respawned... it doesnt work anymore, im able to be teleported to next island even if there are creeps in the island in which i am :banghead: there is no difference than before, i just added the custom script!

how to fix it? tnx al lot!!

here the trigger:


Code:
To006
    Events
        Unit_ - A unit enters To 006 <gen>
    Conditions
        ((Entering unit) is Un eroe) Uguale a TRUE
    Actions
        Unit Group_ - Add all units of (Units in Regione 005 <gen> owned by Neutrale-ostile) to GruppoRegione005
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (All units of GruppoRegione005 are dead) Uguale a TRUE
            Than - Actions
                Units - Move (Entering unit) instantly to (Random point in Regione 006 <gen>)
                Camera - Pan camera for (Owner of (Entering unit)) to (Position of (Entering unit)) over 0.00 seconds
            Else - Actions
                Do nothing
        Custom script:   call DestroyGroup (udg_GruppoRegione005)
 

LightChaosma

New Member
Reaction score
60
should work, altough i would trigger it diffrently...

wait a min, i'll make it
Code:
thehelperskillmaketrigger
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Set temp_int[1] = (Number of units in (Units in (Playable map area) owned by Neutral Hostile))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                temp_int[1] Equal to 0
            Then - Actions
                Set temp_point[1] = (Center of Region 005 Copy 19 <gen>)
                Unit - Move (Triggering unit) instantly to temp_point[1]
                Camera - Pan camera for (Owner of (Triggering unit)) to temp_point[1] over 0.00 seconds
                Custom script:   call RemoveLocation(udg_temp_point[1])
            Else - Actions
                Do nothing

just change the regs, and change center to random point
 

Jarko89

New Member
Reaction score
1
should work, altough i would trigger it diffrently...

wait a min, i'll make it
Code:
thehelperskillmaketrigger
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Set temp_int[1] = (Number of units in (Units in (Playable map area) owned by Neutral Hostile))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                temp_int[1] Equal to 0
            Then - Actions
                Set temp_point[1] = (Center of Region 005 Copy 19 <gen>)
                Unit - Move (Triggering unit) instantly to temp_point[1]
                Camera - Pan camera for (Owner of (Triggering unit)) to temp_point[1] over 0.00 seconds
                Custom script:   call RemoveLocation(udg_temp_point[1])
            Else - Actions
                Do nothing

just change the regs, and change center to random point

tnx a lot, i have 3 questions:

1) which kind of variable temp_point is?

2) u do not destroy temp_int... wont it cause a leak?

3) u wrote "Set temp_int[1] = (Number of units in (Units in (Playable map area) owned by Neutral Hostile))"

i suppose it adds only alive units in region to that number... coz with units groups it adds also dead ones.. and if it adds dead ones, the number will never be equal to 0 :(
 

LightChaosma

New Member
Reaction score
60
tnx a lot, i have 3 questions:

1) which kind of variable temp_point is?

2) u do not destroy temp_int... wont it cause a leak?

3) u wrote "Set temp_int[1] = (Number of units in (Units in (Playable map area) owned by Neutral Hostile))"

i suppose it adds only alive units in region to that number... coz with units groups it adds also dead ones.. and if it adds dead ones, the number will never be equal to 0 :(

integers dont leak, especially not temp ints, they are given a diffrent value in each trigger that uses it.(well they do take mameory of course, but unluke temp_points, when you reuse them, they take the same space, so not an extra spot of memory)

temp_point is a point array, wich you can only use if there are absolutly no wait commands in your trigger (this goes for all temp variables)

dead units, lemme check... i guess i dindnt know either, i used this in my own map:
Set living = (Real((Number of units in (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 9 (Gray)) and (((Matching unit) is alive) Equal to True))))))

for you it would be:
Code:
Set temp_int[1] = (Number of units in (Units owned by Neutral Hostile matching (((Matching unit) is alive) Equal to True)))
 

Jarko89

New Member
Reaction score
1
Tnk u so much, ill test it tomorrow (its late night here in italy XD)

Obviously +rep for u!
 

Jarko89

New Member
Reaction score
1
works perfectly, thanks....

PS: i see there is no difference between

call RemoveLocation(udg_temp_point[1])

and

call RemoveLocation (udg_temp_point[1])

am i right?
 

LightChaosma

New Member
Reaction score
60
its a space, but wether or not it matters, i dont know, you'd have to ask someone who knows JASS, the only thing about jass i know is to remove leaks :D
 

Flare

Stops copies me!
Reaction score
662
Code:
Set temp_int[1] = (Number of units in [B](Units owned by Neutral Hostile matching (((Matching unit) is alive) Equal to True))[/B])
You've got a leak there - you are creating a unit group just to count the units in the group, and not destroying it afterwards

And the space doesn't matter, you could do
JASS:
call RemoveLocation     (   udg_PointVariable   ) //Assuming the point wasn&#039;t arrayed

if you so wished :p
 

LightChaosma

New Member
Reaction score
60
damn.. does that also leak... didnt know that... thx, lemme fix that, few min plz, gotta start WE

Code:
Actions
    Set temp_unitG[1] = (Units owned by Player 9 (Gray) matching (((Matching unit) is alive) Equal to True))
    Set temp_int[1] = (Number of units in temp_unitG[1])
    Custom script:   call DestroyGroup (udg_temp_unitG[1])

just change player 9 to neutral hostile, this was for my own map ;)
 
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