• 🏆 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!

[Trigger] Optimize Periodic Trigger

Status
Not open for further replies.
Hello, i just made a periodic event earlier, but when i tested it the game just lags when the game tries to spawn the mobs/creeps on the specified region. Can someone help me optimize the triggers or have i done it wrong?

  • Mob System Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Mob_SpawnCount = 10
      • Set Mob_SpawnTime = (Random real number between 1.00 and 10.00)
      • Countdown Timer - Start Mob_SpawnTimer as a Repeating timer that will expire in Mob_SpawnTime seconds
      • Countdown Timer - Pause Mob_SpawnTimer
  • Morning Creep Detection
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Mob_Group01 and do (Unit - Add a (Random real number between 0.10 and 5.00) second Generic expiration timer to (Picked unit))
      • Countdown Timer - Start Mob_SpawnTimer as a Repeating timer that will expire in Mob_SpawnTime seconds
      • Countdown Timer - Pause Mob_SpawnTimer
  • Night Creep Detection
    • Events
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Countdown Timer - Start Mob_SpawnTimer as a Repeating timer that will expire in Mob_SpawnTime seconds
      • Countdown Timer - Resume Mob_SpawnTimer
  • Mob Spawn Region 01
    • Events
      • Time - Mob_SpawnTimer expires
    • Conditions
      • (Number of units in Mob_Group01) Less than Mob_SpawnCount
    • Actions
      • Set Mob_SpawnRegion01 = (Random point in Region 002 <gen>)
      • Unit - Create 1 Grunt for Neutral Hostile at Mob_SpawnRegion01 facing (Random angle) degrees
      • Custom script: call RemoveLocation (udg_Mob_SpawnRegion01)
      • Unit Group - Add (Last created unit) to Mob_Group01
  • Mob Remove Groups
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Unit Group - Remove (Triggering unit) from Mob_Group01
 
Last edited:

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,888
The triggers seem fine. Creating units was always an expensive operation, when you create a great amount of units at same time it will lag for a short second. It probably also lags with 1 unit due to recent patch's instability.
 
I think i found what's causing it, yes you're right that trigger is not causing it, but i think this is the one that causes the lag. Can you help me what's wrong with this?

Note: This triggers is done for me by someone recently, but i modified it and probably i messed it up, i dont know.

The goal is to detect the mana of the plant so it will go back to 0% when it reaches 100%, and it will generate random item (food).

  • Plant Lifecycle
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set Plant_PlantGroup = (Units of type Plant)
      • Unit Group - Pick every unit in Plant_PlantGroup and do (Actions)
        • Loop - Actions
          • Unit - Add a 300.00 second Generic expiration timer to (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer((Percentage mana of (Picked unit)))) Equal to 100
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 12) Equal to 1
                • Then - Actions
                  • Set Plant_ClosestPlantPoint = (Position of (Picked unit))
                  • Item - Create Crop at Plant_ClosestPlantPoint
                  • Custom script: call RemoveLocation(udg_Plant_ClosestPlantPoint)
                  • Unit - Set mana of (Picked unit) to 0.00%
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 4) Equal to 1
                    • Then - Actions
                      • Set Plant_ClosestPlantPoint = (Position of (Picked unit))
                      • Item - Create Food at Plant_ClosestPlantPoint
                      • Custom script: call RemoveLocation(udg_Plant_ClosestPlantPoint)
                      • Unit - Set mana of (Picked unit) to 0.00%
                    • Else - Actions
                      • Unit - Set mana of (Picked unit) to 0.00%
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Plant_PlantGroup)
 
Level 8
Joined
May 21, 2019
Messages
435
I think i found what's causing it, yes you're right that trigger is not causing it, but i think this is the one that causes the lag. Can you help me what's wrong with this?

Note: This triggers is done for me by someone recently, but i modified it and probably i messed it up, i dont know.

The goal is to detect the mana of the plant so it will go back to 0% when it reaches 100%, and it will generate random item (food).

  • Plant Lifecycle
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set Plant_PlantGroup = (Units of type Plant)
      • Unit Group - Pick every unit in Plant_PlantGroup and do (Actions)
        • Loop - Actions
          • Unit - Add a 300.00 second Generic expiration timer to (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer((Percentage mana of (Picked unit)))) Equal to 100
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 12) Equal to 1
                • Then - Actions
                  • Set Plant_ClosestPlantPoint = (Position of (Picked unit))
                  • Item - Create Crop at Plant_ClosestPlantPoint
                  • Custom script: call RemoveLocation(udg_Plant_ClosestPlantPoint)
                  • Unit - Set mana of (Picked unit) to 0.00%
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 4) Equal to 1
                    • Then - Actions
                      • Set Plant_ClosestPlantPoint = (Position of (Picked unit))
                      • Item - Create Food at Plant_ClosestPlantPoint
                      • Custom script: call RemoveLocation(udg_Plant_ClosestPlantPoint)
                      • Unit - Set mana of (Picked unit) to 0.00%
                    • Else - Actions
                      • Unit - Set mana of (Picked unit) to 0.00%
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Plant_PlantGroup)

Hi again.
Yeah, you modified the trigger alright. :)
One thing that strikes me as odd is that you are adding an expiration timer to the plant on your periodic. It should be added when the plant is being created/spawned/built. I don't know what it does to the game to have this many expiration timers thrown around all of the time, let alone trying to assign several expiration timers to a single unit. Maybe they count in parallel? If that's the case, then you can have 3000 timers running simultaneously per plant... so say you have 20 plants... that's 60.000 timers all counting down, which could have a milisecond accuracy for all i know, so that's 6.000.000 actions per second just from 20 plants being built.
 
This is what i am doing with my current testing. I think what's causing it is the every plant are getting picked every 0.1 seconds (even if i set this at 1 second you'll notice the stutter every second). I wonder if there is a way to actually give separate timers to each plants (with random numbers when they will spawn the item) instead of selecting an entire farm (all plants). My testing has 200 plants and it is running at 15 frames.

WC3ScrnShot_061319_003530_01.png

Edit: Here, i attached the map for testing.
 

Attachments

  • test.w3x
    1.1 MB · Views: 35
Last edited:
Level 8
Joined
May 21, 2019
Messages
435
This is what i am doing with my current testing. I think what's causing it is the every plant are getting picked every 0.1 seconds (even if i set this at 1 second you'll notice the stutter every second). I wonder if there is a way to actually give separate timers to each plants (with random numbers when they will spawn the item) instead of selecting an entire farm (all plants). My testing has 200 plants and it is running at 15 frames.

Holy cow that's a lot of plants though.
Try completely deleting the line that adds an expiration timer to the plants and see if that does something. Either way, you are running 2000 loops per second here so that's kinda heavy.
 
Yes, i did try deleting it, it doesn't really make a difference though lol. I attached the map at my previous post, you can try it. c:

Edit: I've set the loop at 2 seconds so i can test it, 0.1 seconds is just unplayable. By the way you don't necessarily have to fix it though, i'm just wondering how do i actually add timers to each plant instead of selecting the entire set.

Edit (2): I think i might just generate three invisible dummy units (per plant) at the location where the plant has been placed, then each dummy unit has random timers, and when the dummy unit dies the dice rolls what item will be created at the location of the dummy unit.
 
Last edited:
Level 8
Joined
May 21, 2019
Messages
435
This is what i am doing with my current testing. I think what's causing it is the every plant are getting picked every 0.1 seconds (even if i set this at 1 second you'll notice the stutter every second). I wonder if there is a way to actually give separate timers to each plants (with random numbers when they will spawn the item) instead of selecting an entire farm (all plants). My testing has 200 plants and it is running at 15 frames.


Edit: Here, i attached the map for personal testing.
Also, on a completely different note, if you plan on doing several hundred plants like this, then maybe the best course of action is to rework your system?

How about creating a system that selects all plants in the map, and then generates crops and food next to random ones based on the amount of plants owned?
Looks like you want food to spawn 4 times as often as crops.

So... lets say that you have 200 plants.

Then I'd have 2 triggers. One for spawning crops, one for spawning food.

Each trigger has their own timer to trigger their event.

Lets take the one for food.

At the start of the trigger actions, you count the amount of plants in the map and save it in a variable, then you pick a random plant and generate a food item next to it. Then you start the timer for the next food item to spawn, which you calculate with: Base-timer / amount of plants. So if the base timer is 100 seconds, and you have 200 plants, then the timer is set to 0.5 seconds. Since the plant spawning the item is chosen randomly, there is by default a larger chance that it will spawn in large clusters of plants rather than a few single plants spread out here and there. For the crop trigger, you use a base timer that's 4 times bigger.

Also, remember to check if the amount of plants is 0 before dividing by it. You also need another trigger to "kickstart" the cycle both when the game starts and when you construct a new plant. For the game start, just run the item spawn triggers, that should get them going. For constructing a new plant, you wanna have that one OFF by default, and then enabled when the timer events count 0 plants, and then disabled again once a plant is constructed.

Alternatively, if the map is made to have a very large variance in the number of plants, then you may go with a periodic event that counts the plants, and adds their number to 2 integers for the food and crops. Then whenver one of them exceeds their threshold, you generate an item at a random plant and deduct the threshold from the integer.
For example, every 1 second the number of plants is added to the variable FoodGrowth. Lets say you have 200, and lets say the threshold is 500. So then the periodic goes like:
200
400
600 (Above 500! Spawn an item and -500, so now its 100)
300
500 (500 or above, spawn item and -500, now it's 0)
200...
and so on.

Makes sense?
This way, you avoid looping through every single one of the plants, which is by far the heaviest part of running that thing on 200 plants.
When I designed that trigger for you, I had a very different number of plants in mind, as I was thinking of it as a structure that you'd maybe have a handful of at most.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,888
Hi again.
Yeah, you modified the trigger alright. :)
One thing that strikes me as odd is that you are adding an expiration timer to the plant on your periodic. It should be added when the plant is being created/spawned/built. I don't know what it does to the game to have this many expiration timers thrown around all of the time, let alone trying to assign several expiration timers to a single unit. Maybe they count in parallel? If that's the case, then you can have 3000 timers running simultaneously per plant... so say you have 20 plants... that's 60.000 timers all counting down, which could have a milisecond accuracy for all i know, so that's 6.000.000 actions per second just from 20 plants being built.
L.O.L.
I wonder why blizzard would implement something so stupid as letting the same unit have several expiration timers. It should just return false. But hey, you never know.
Units of Type group is something you never should use, it causes permanent leak, you can't remove it with custom scripts.
 
Level 8
Joined
May 21, 2019
Messages
435
L.O.L.
I wonder why blizzard would implement something so stupid as letting the same unit have several expiration timers. It should just return false. But hey, you never know.
Rule nr 1 of IT is to never assume that things weren't horribly botched somewhere... I mean... case in point:
Units of Type group is something you never should use, it causes permanent leak, you can't remove it with custom scripts.
Where did you read this though? In the stickied thread, the only 2 functions that are listed as blacklisted are camera pans and the "pick every unit" actions, as they don't assign a variable to the generated group for later deletion. The pan thing is just shit programming, but the pick every unit thing makes sense. Why would picking units of type cause a leak when it is assigned to a variable that you can later use to delete it?
 
Level 8
Joined
May 21, 2019
Messages
435
Yes, i did try deleting it, it doesn't really make a difference though lol. I attached the map at my previous post, you can try it. c:

Edit: I've set the loop at 2 seconds so i can test it, 0.1 seconds is just unplayable. By the way you don't necessarily have to fix it though, i'm just wondering how do i actually add timers to each plant instead of selecting the entire set.

Edit (2): I think i might just generate three invisible dummy units (per plant) at the location where the plant has been placed, then each dummy unit has random timers, and when the dummy unit dies the dice rolls what item will be created at the location of the dummy unit.

In ammendment to what I wrote earlier, the lowest intensity way to do things, would be to track the number of plants as they come in and out of existence. A plant is constructed... +1 plants.... a plant dies.... -1 plants. This way, you only really have to select the plants when you are picking a random one to spawn the items at. That's by far the least resource consuming approach that I can think of.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,888
Where did you read this though? In the stickied thread, the only 2 functions that are listed as blacklisted are camera pans and the "pick every unit" actions, as they don't assign a variable to the generated group for later deletion. The pan thing is just shit programming, but the pick every unit thing makes sense. Why would picking units of type cause a leak when it is assigned to a variable that you can later use to delete it?
From exactly where you read it, the black listed functions. It's not the "pick every unit" actions that isn't supposed to be used lol, its the part Pick all units of type, you misread it. It leaks the id counter.
 
Level 8
Joined
May 21, 2019
Messages
435
Yes, i did try deleting it, it doesn't really make a difference though lol. I attached the map at my previous post, you can try it. c:

Edit: I've set the loop at 2 seconds so i can test it, 0.1 seconds is just unplayable. By the way you don't necessarily have to fix it though, i'm just wondering how do i actually add timers to each plant instead of selecting the entire set.

Edit (2): I think i might just generate three invisible dummy units (per plant) at the location where the plant has been placed, then each dummy unit has random timers, and when the dummy unit dies the dice rolls what item will be created at the location of the dummy unit.
Alright, I found the issue.
There seems to be a performance problem with unit groups containing large amounts of units.
Look at the map I attached. It has a spawn system with extremely minimized performance load that I made. You will notice in the plant lifecycle trigger that I disabled 2 actions, namely, the actions that assigns the drop location to the location of a random unit in the unit group. This thing makes it actually drop them around very nicely, but it makes it lag for some reason... even when the unit group is only being accessed as little as 2-3 times per second to return a single random unit. That's crazy inefficient, and indicative of a serious programming issue. Either way, this system has to be designed to circumvent this group.
 

Attachments

  • Plants.w3x
    1.1 MB · Views: 30
Level 8
Joined
May 21, 2019
Messages
435
From exactly where you read it, the black listed functions. It's not the "pick every unit" actions that isn't supposed to be used lol, its the part Pick all units of type, you misread it. It leaks the id counter.
Are you certain of this? Because that's not written there. What's your source?
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,888
Things That Leak
Memory Leaks
Things That Always Leak

Never use these functions:

  • Unit Group - Pick all units of type Footman and do...
  • Camera - Pan Camera as needed...
It's right there...

Also, you've been doing this too many times and I forgot to mention, don't double, nor triple, nor quadruple post, it's written on the rules and is considered spam, so be careful with that. Use the edit button.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
You could, you know, look up the relevant function to see what it actually does under the hood. Wrda is correct; the group "g" in the below function is never nulled and thus contributes a reference leak (not a memory leak)
JASS:
function GetUnitsOfTypeIdAll takes integer unitid returns group
    local group   result = CreateGroup()
    local group   g      = CreateGroup()
    local integer index

    set index = 0
    loop
        set bj_groupEnumTypeId = unitid
        call GroupClear(g)
        call GroupEnumUnitsOfPlayer(g, Player(index), filterGetUnitsOfTypeIdAll)
        call GroupAddGroup(g, result)

        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
    call DestroyGroup(g)

    return result
endfunction
 
Level 8
Joined
May 21, 2019
Messages
435
It's not really explicitly stated, but Pyrogasm provided a proof, so it's fine. Also, please note that I am not trying to argue with you here, I am just being skeptical, which I don't think is a bad thing.
Also, the current system I designed for the plant calls the function once. Since it's only a reference leak, I dare say that it doesn't matter at all, although I will be wary of adding it to periodic triggers and loops in the future, so thank you for bringing it to my attention. :)

Also, you've been doing this too many times and I forgot to mention, don't double, nor triple, nor quadruple post, it's written on the rules and is considered spam, so be careful with that. Use the edit button.
I have a few issues with that. Do edits send a notification? Otherwise, I run the risk of the person I am writing to missing it when I add to a post.
Edit: Read the rules, and I'd argue that my use of double-posting for updating content is permitted:
"- In cases of rapid content progression, update posts* are allowed."

Wrda is correct; the group "g" in the below function is never nulled and thus contributes a reference leak (not a memory leak)
Thanks, that's very helpful. Considering that it's just a reference leak, I feel fine using it once though.

You could, you know, look up the relevant function to see what it actually does under the hood
How do I actually do that?
Also, was the "you know" part really necessary? There seems to be a lot of passive aggresion going around in this forum.

Yes, i did try deleting it, it doesn't really make a difference though lol. I attached the map at my previous post, you can try it. c:

Edit: I've set the loop at 2 seconds so i can test it, 0.1 seconds is just unplayable. By the way you don't necessarily have to fix it though, i'm just wondering how do i actually add timers to each plant instead of selecting the entire set.

Edit (2): I think i might just generate three invisible dummy units (per plant) at the location where the plant has been placed, then each dummy unit has random timers, and when the dummy unit dies the dice rolls what item will be created at the location of the dummy unit.
In amendment to the map I posted before, I wanna add that I think the best way to circumvent the unit group issue, is to use a dynamically indexed unit array, and then generate a random number between 0 and (numberOfPlants-1) for the location. That way, we would be doing what the "random unit from group" function SHOULD have been programmed to do, rather than, apparently, loading all 200 units of the group.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,013
How do I actually do that?
Also, was the "you know" part really necessary? There seems to be a lot of passive aggresion going around in this forum.
I have little tolerance for people not looking into something on their own when it's not that difficult. Being skeptical is reasonable, but you need to follow up your skepticism with a good-faith effort to do the research yourself. In this instance you actually didn't even have to look up the function, you just had to read the very bottom of the "Things that Leak" tutorial where the bit Wrda quoted is but for future reference:
  1. Use the function in an otherwise blank GUI trigger.
  2. Edit > Convert to custom text
  3. Look for the function you used.
  4. Find the definition of that function in any of the following sources:
    • If you're using an editor that has TESH (trigger editor syntax highlighting) active, function definitions are available within the trigger window itself.
    • A copy of Blizzard.j extracted from your install's CASC files or an MPQ or from a compiled map.
    • This (old & unupdated but generally reliable) sourceforge page for JASS: JASS Manual: API Browser - Blizzard.j (It's the first thing that shows up if you google JASS API or JASS Blizzard.j for me, but ymmv)
    • This copy of the 1.30.4 Blizzard.j Bo uploaded to the site and has been linked around: blizzard.j -- patch 1.30.4 | HIVE
 
I rewrote the system completely. Still, thanks for the help people :)

The main character will now have to interact with the plant in order to produce goodies. The plant have three stages now (growing, grown and dead), when the character interacts with the growing plant it will do nothing, when grown, produces good, when dead, destroys the plant. This method seem to be more friendly when it comes to performance because it doesn't loop although it still selects the entire set of existing plants at the first second to add expiration timers (Constructed plants have separate triggers for expiration timer now like what Cespie suggested).

  • Add Expiration to Existing Crops
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Plant_TimeDice = (Random real number between 3.00 and 5.00)
      • Set Plant_PlantGroupA = (Units of type Plant (Growing))
      • Set Plant_PlantGroupB = (Units of type Plant (Grown))
      • Unit Group - Pick every unit in Plant_PlantGroupA and do (Actions)
        • Loop - Actions
          • Unit - Add a Plant_TimeDice second Generic expiration timer to (Picked unit)
          • Unit - Add a Plant_TimeDice second Generic expiration timer to (Picked unit)
      • Custom script: call DestroyGroup(udg_Plant_PlantGroupA)
      • Custom script: call DestroyGroup(udg_Plant_PlantGroupB)
  • Add Expiration to Built Crops
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Plant (Growing)
    • Actions
      • Unit - Add a Plant_TimeDice second Generic expiration timer to (Constructed structure)
  • Plant Interaction
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Interact (Chain Lightning - Neutral Hostile)
      • (Owner of (Target unit of ability being cast)) Equal to (Owner of (Casting unit))
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Target unit of ability being cast)) Equal to Plant (Growing)
          • (Unit-type of (Target unit of ability being cast)) Equal to Plant (Grown)
          • (Unit-type of (Target unit of ability being cast)) Equal to Plant (Withered)
    • Actions
      • -------- Growing Plant --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of ability being cast)) Equal to Plant (Growing)
        • Then - Actions
          • Set Plant_Caster = (Casting unit)
          • Game - Display to Player Group - Player 1 (Red) the text: This plant cannot b...
        • Else - Actions
      • -------- Fully Grown Plant --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of ability being cast)) Equal to Plant (Grown)
        • Then - Actions
          • Set Plant_ClosestPlantPoint = (Position of (Target unit of ability being cast))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 2) Equal to 1
            • Then - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: Plant has generated...
              • Unit - Replace (Target unit of ability being cast) with a Plant (Growing) using The new unit's max life and mana
              • Unit - Add a Plant_TimeDice second Generic expiration timer to (Target unit of ability being cast)
              • Item - Create Food at Plant_ClosestPlantPoint
            • Else - Actions
              • Game - Display to Player Group - Player 1 (Red) the text: Plant died during h...
              • Unit - Kill (Target unit of ability being cast)
          • Custom script: call RemoveLocation(udg_Plant_ClosestPlantPoint)
        • Else - Actions
      • -------- Withered Plant --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of ability being cast)) Equal to Plant (Withered)
        • Then - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Plant removed.
          • Unit - Kill (Target unit of ability being cast)
        • Else - Actions
  • Change Growing Plant to Regular
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Plant (Growing)
    • Actions
      • Unit - Replace (Dying unit) with a Plant (Grown) using The new unit's max life and mana
  • Change Regular Plant to Withered
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Plant (Grown)
    • Actions
      • Unit - Replace (Dying unit) with a Plant (Withered) using The new unit's max life and mana

There seems to be a lot of passive aggresion going around in this forum.
It's normal, explore other sections of this forum and get used to it.

I wonder why blizzard would implement something so stupid as letting the same unit have several expiration timers. It should just return false.
I believe it doesn't really stack the expiration timers to units that already has expiration timers, based on my testing they only follow the first expiration timers set, the new timers seem to be ignored (I might be wrong but this is what i've experienced).
 
Last edited:
Level 8
Joined
May 21, 2019
Messages
435
I have little tolerance...
I don't feel that's the best attitude for a support forum.
...for people not looking into something on their own when it's not that difficult. Being skeptical is reasonable, but you need to follow up your skepticism with a good-faith effort to do the research yourself. In this instance you actually didn't even have to look up the function, you just had to read the very bottom of the "Things that Leak" tutorial where the bit Wrda quoted is
I did look into it, and you may even notice that I commented on the very part that you are referring to, but the way that it is put is open to interpretation. I interpreted it as dynamically generated groups without a variable causing a leak as they couldn't be accessed for clearing, but apparently it meant the pick every unit of type function specifically. I don't think it should be cause for frustration that I questioned whether or not an interpretation of a given statement was correct, given the ambiguity and lack of elaboration. I even did a wordsearch on the first 3 pages of the thread to see if someone elaborated on it, but found nothing, so I certainly feel like I made an earnest effort.

  1. Use the function in an otherwise blank GUI trigger.
  2. Edit > Convert to custom text
  3. Look for the function you used.
  4. Find the definition of that function in any of the following sources:
    • If you're using an editor that has TESH (trigger editor syntax highlighting) active, function definitions are available within the trigger window itself.
    • A copy of Blizzard.j extracted from your install's CASC files or an MPQ or from a compiled map.
    • This (old & unupdated but generally reliable) sourceforge page for JASS: JASS Manual: API Browser - Blizzard.j (It's the first thing that shows up if you google JASS API or JASS Blizzard.j for me, but ymmv)
    • This copy of the 1.30.4 Blizzard.j Bo uploaded to the site and has been linked around: blizzard.j -- patch 1.30.4 | HIVE
Thanks, that's helpful.
I have no idea why you feel the need to vent here, but I hope it gets better. Truly.
 
Status
Not open for further replies.
Top