• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Do these leak?

Status
Not open for further replies.
Level 7
Joined
Sep 8, 2011
Messages
211
Hey guys I'm screwing around with an idea that I wanted to try. At the moment I have 4 survivors v 1 killer (it's a recreation of a game called Dead by Daylight), which is pretty much a hide and seek on steroids.

When a survivor activates Sprint it leaves behind marks to show where they've gone (it's a unit with locus with the model of demon footprint) and if they stand in a trap I want them to bleed until they get out of it. I wanted to know if the triggers leak below. Also I have a trigger to add a timer to each trail object that enters the map, this is so if I wanna add trails via another script it will clean them with out me having to worry. If you want more details on it let me know.

Thanks guys.

Code:
Trail Marks
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 4, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Survivors[(Integer A)] has buff Sprinting ) Equal to True
                    Then - Actions
                        Set Temp_Point[(Integer A)] = (Position of Survivors[(Integer A)])
                        Unit - Create 1 Trail_Object_Type for Player 1 (Red) at Temp_Point[(Integer A)] facing (Facing of Survivors[(Integer A)]) degrees
                        Custom script:   call RemoveLocation( udg_Temp_Point[bj_forLoopAIndex])
                    Else - Actions

Code:
Trap Bleeding
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 4, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Survivors[(Integer A)] has buff Trapped ) Equal to True
                    Then - Actions
                        Set Temp_Point[(Integer A)] = (Position of Survivors[(Integer A)])
                        Special Effect - Create a special effect at Temp_Point[(Integer A)] using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
                        Special Effect - Destroy (Last created special effect)
                        Custom script:   call RemoveLocation( udg_Temp_Point[bj_forLoopAIndex])
                    Else - Actions
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Hey Jackhamme, first things first, please use [trigger][/trigger] tags when posting triggers, not [code][/code]. Secondly, if you're unsure about a leak, you can always use the website's JASS Checker as a guide. I wouldn't suggest relying on it though :p Lastly, from the two triggers you showed us, nothing leaks. You properly store the location into a variable, and remove it in every loop iteration. You also destroy the effect after it's created.

I do have some suggestions though:
  • You might want to use a smaller loop timer. Survivors[] can possibly die, have the buff dispelled, or even just expire in the 1 / 2 second time perioid you have
  • I would recommend using a custom integer instead of Integer A or B. Integer A or B are a bit slower and can also cause issues if other triggers that fire simultaneously
 
Level 7
Joined
Sep 8, 2011
Messages
211
I know about leaks and how to avoid them and stuff, this is just the first time I've use a loop to reference a point variable and spawning a special effect too. Thanks for the links though, wouldn't hurt to read through them again to help dust off my GUI knowledge again :p
 
Status
Not open for further replies.
Top