• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Where are the leaks?

Status
Not open for further replies.
Level 1
Joined
Nov 28, 2012
Messages
5
I suspect the leaks are in those ''For each (Integer A) from 1 to 10, do (Actions)'', but I don't really know how to fix it...

HELP MEEEE :(




  • b1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ninja Star
    • Actions
      • Set b_IntegerTimes = (b_IntegerTimes + 1)
      • Set b_UnitCaster[b_IntegerTimes] = (Triggering unit)
      • Set b_PointCaster[b_IntegerTimes] = (Position of b_UnitCaster[b_IntegerTimes])
      • Unit - Create 1 Bracciante (Dummy Ninja Star) for Giocatore (Rosso) at b_PointCaster[b_IntegerTimes] facing Orientamento predefinito degli edifici degrees
      • Set b_UnitType = (Unit-type of (Last created unit))
      • Set b_UnitDummy[b_IntegerTimes] = (Last created unit)
      • Set b_RealFacingAngle[b_IntegerTimes] = (Facing of b_UnitCaster[b_IntegerTimes])
      • Set b_PointEnd[b_IntegerTimes] = (Target point of ability being cast)
      • Set b_RealThrowDistance[b_IntegerTimes] = (Distance between b_PointCaster[b_IntegerTimes] and b_PointEnd[b_IntegerTimes])
      • Trigger - Turn on b2 <gen>
      • Custom script: call RemoveLocation (udg_b_PointCaster[udg_b_IntegerTimes])
  • b2
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer b_IntegerA) from 1 to b_IntegerTimes, do (Actions)
        • Loop - Actions
          • Set b_PointCaster[b_IntegerA] = (Position of b_UnitCaster[b_IntegerA])
          • Set b_PointDummy[b_IntegerA] = (Position of b_UnitDummy[b_IntegerA])
          • Set b_RealThrowDistance[b_IntegerA] = (Distance between b_PointDummy[b_IntegerA] and b_PointEnd[b_IntegerA])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • b_BooleanGoOrCome[b_IntegerA] Uguale a FALSE
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • b_RealThrowDistance[b_IntegerA] More or equal to 100.00
                • Then - Actions
                  • Set b_RealOffset[b_IntegerA] = 10.00
                  • Set b_PointDummyGoesTo[b_IntegerA] = (b_PointDummy[b_IntegerA] offset by b_RealOffset[b_IntegerA] towards b_RealFacingAngle[b_IntegerA] degrees)
                  • Unit - Move b_UnitDummy[b_IntegerA] instantly to b_PointDummyGoesTo[b_IntegerA]
                  • Custom script: call RemoveLocation (udg_b_PointDummyGoesTo[udg_b_IntegerA])
                • Else - Actions
                  • Set b_BooleanGoOrCome[b_IntegerA] = TRUE
            • Else - Actions
              • Set b_RealApproachDistance[b_IntegerA] = (Distance between b_PointDummy[b_IntegerA] and b_PointCaster[b_IntegerA])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • b_RealApproachDistance[b_IntegerA] Less or equal to 65.00
                • Then - Actions
                  • Unit - Add a 0.20 second Generico expiration timer to b_UnitDummy[b_IntegerA]
                  • Custom script: call RemoveLocation (udg_b_PointEnd[udg_b_IntegerA])
                • Else - Actions
              • Set b_RealOffset[b_IntegerA] = 10.00
              • Unit - Make b_UnitDummy[b_IntegerA] face b_UnitCaster[b_IntegerA] over 0.00 seconds
              • Set b_RealFacingAngle[b_IntegerA] = (Facing of b_UnitDummy[b_IntegerA])
              • Set b_PointDummyGoesTo[b_IntegerA] = (b_PointDummy[b_IntegerA] offset by b_RealOffset[b_IntegerA] towards b_RealFacingAngle[b_IntegerA] degrees)
              • Unit - Move b_UnitDummy[b_IntegerA] instantly to b_PointDummyGoesTo[b_IntegerA]
              • Custom script: call RemoveLocation (udg_b_PointDummyGoesTo[udg_b_IntegerA])
          • Custom script: call RemoveLocation (udg_b_PointCaster[udg_b_IntegerA])
          • Custom script: call RemoveLocation (udg_b_PointDummy[udg_b_IntegerA])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living b_UnitType units owned by Player (Red)) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 1
Joined
Nov 28, 2012
Messages
5
The last ''If/Then/Else'' is in the actions of the second trigger. I couldn't put it in the right place :s
 
Level 1
Joined
Nov 28, 2012
Messages
5
Yes, there are. Everytime I cast the spell (after I did like 30 times), game starts slowing till the blade dummy expires, then everthing goes flowly again. I think the problem is in the ''For each (Integer b_IntegerA) from 1 to b_IntegerTimes, do (Actions)''.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
That sounds like performance issues, has nothing to do with leaks >.<

Lags which are caused by leaks dont just fade away. Also they dont occur when some spell is cast, they start small and get worse over time (usually it takes minutes to hours). I know everyone on hive is really scared of leaks, but often they dont have any impact on the game.

Similar topic: http://www.hiveworkshop.com/forums/triggers-scripts-269/need-help-making-leak-proof-246842/
 
Level 1
Joined
Nov 28, 2012
Messages
5
I don't agree with you. Can it be because of the b_IntegerTimes that increases more and more, making ''For each (Integer b_IntegerA) from 1 to b_IntegerTimes, do (Actions)'' activates too many times when the spell is cast? There's nothing that makes that integer start from 0, so it's meant to increase fearfully!
 
Hmm GUI triggers gone a little complex, with long lines. Not so easy to read.

For one I would suggest to make the periodic timer an every .03 seconds timer instead of .02. If you Find this an issue with the values of the spell, just change them.

Does this trigger actually work flawlessly, not including the lag?
Maybe you can try debugging the the trigger to figure out what is causing it.

If your still having trouble with the script, maybe send us or just myself a test map of what your trying to do.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
1. the problem is because you never de-index them ( you never reduce b_IntegerTimes even if the spell is done), so if you cast it 30 times, the loop will be from 1 to 30 every 0.02, then what if you cast it 100 times?

2. also if you put the last ITE in the loop there, it would be very hardly not efficient.. and the condition leaks..

3. you could improve this
  • Unit - Create 1 Bracciante (Dummy Ninja Star) for Giocatore (Rosso) at b_PointCaster[b_IntegerTimes] facing Orientamento predefinito degli edifici degrees
  • Set b_UnitType = (Unit-type of (Last created unit))
=>
  • Set b_UnitType = Bracciante (Dummy Ninja Star)
  • Unit - Create 1 b_UnitType for Giocatore (Rosso) at b_PointCaster[b_IntegerTimes] facing Orientamento predefinito degli edifici degrees)
but it's still not the best optimization. and many other lines also need more improvements

4. there
  • If - Conditions
  • b_RealApproachDistance[b_IntegerA] Less or equal to 65.00
  • Then - Actions
  • Unit - Add a 0.20 second Generico expiration timer to b_UnitDummy[b_IntegerA]
  • Custom script: call RemoveLocation (udg_b_PointEnd[udg_b_IntegerA])
you give timer to the unit every 0.02 seconds? better you just do it once when the spell ended. ANd I don't understand you are removing which leaks in that ITE (your variable name is hard to read)

I think if you could fix the problem above the spell will work okay..
 
Level 1
Joined
Nov 28, 2012
Messages
5
Ahaha I know the variable names I chose are long and hard to read. As soon as I can I put here the map with the thing I'm trying to make. Thank you all for the help and explanations.

The last ITE I put is right after the loop, not in it.
 
Status
Not open for further replies.
Top