So I was looking to figure out how to create a limiter for unit spawn, when I found a good guide here:
I followed the instructions and duplicated it for 3 players in my trigger. However, despite my triggers being basically the same (except player owner number are different), only one of the triggers work. The other two keeps displaying "script error...AddFunction Too many threads."
I've looked over the triggers and they're basically identitcal except the ownership # corresponding to each player. Can anyone help?
Here are my triggers w/ spawn trigger conditions set to "P5 Total Units <= 400" :
Example of Player 5 trigger:
P5 Total Units = 0 <Integer>
Initial Value 0
P5 Total Units Counter Add
Unit - Any Unit Enters (Entire map)
Local Variables
Conditions
(Owner of (Triggering unit)) == 5
Actions
Variable - Modify P5 Total Units: + 1
P5 Total Units Counter Remove
Events
Unit - Any Unit dies
Local Variables
Conditions
(Owner of (Triggering unit)) == 5
Actions
Variable - Modify P5 Total Units: - 1
P5 Spawn Unit Limit Reached Text
Timer - Every 30.0 seconds of Game Time
Local Variables
Conditions
P5 Total Units > 400
Actions
UI - Display "One or more players on the attackin..." for (Players on team 2) to Subtitle area
Example of player 6 trigger:
P6 Total Units = 0 <Integer>
P6 Total Units Counter Add
Unit - Any Unit Enters (Entire map)
Local Variables
Conditions
(Owner of (Triggering unit)) == 6
Actions
Variable - Modify P6 Total Units: + 1
P6 Total Units Counter Remove
Unit - Any Unit dies
Local Variables
Conditions
(Owner of (Triggering unit)) == 6
Actions
Variable - Modify P6 Total Units: - 1
bump, apparently the triggers all do work...at least after the inital error. The units stop spawning after reaching the cap. So does the error message mean the trigger doesn't work in the beginning when the map starts, but it works after?
a thread usually reefers to an trigger instance. Since the number of triggers that can run at any given moment is very high chances are that one of ur triggers is going nuts and generating loads of instances and those instances are not dying.
i know thats a bunch of mumbo jumbo so let me try to explain it differently.
you probably have an event that occurs frequently but has some sort of repeat forever clause in it that prevents the trigger from ending. for example, when you add a "unit death" event, whenever a unit dies a trigger instance is created for that unit. it hits conditions and actions and what not. however, it also reached the end of actions and theirs no actions left, thus the instances is done. if you were to have some sort of long waits, or whiles, or repeat forever, the instance stays alive working the actions. if you have alot of dying in the game, you will end up with many of these instances working. eventually thousands and tens of thousands of instances run, the system realizes its getting out of control and stops allowing trigger events from occurring.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So I was looking to figure out how to create a limiter for unit spawn, when I found a good guide here:
I followed the instructions and duplicated it for 3 players in my trigger. However, despite my triggers being basically the same (except player owner number are different), only one of the triggers work. The other two keeps displaying "script error...AddFunction Too many threads."
I've looked over the triggers and they're basically identitcal except the ownership # corresponding to each player. Can anyone help?
Here are my triggers w/ spawn trigger conditions set to "P5 Total Units <= 400" :
Example of Player 5 trigger:
P5 Total Units = 0 <Integer> Initial Value 0
P5 Total Units Counter Add Unit - Any Unit Enters (Entire map) Local Variables Conditions (Owner of (Triggering unit)) == 5 Actions Variable - Modify P5 Total Units: + 1
P5 Total Units Counter Remove Events Unit - Any Unit dies Local Variables Conditions (Owner of (Triggering unit)) == 5 Actions Variable - Modify P5 Total Units: - 1
P5 Spawn Unit Limit Reached Text Timer - Every 30.0 seconds of Game Time Local Variables Conditions P5 Total Units > 400 Actions UI - Display "One or more players on the attackin..." for (Players on team 2) to Subtitle area
Example of player 6 trigger:
P6 Total Units = 0 <Integer>
P6 Total Units Counter Add Unit - Any Unit Enters (Entire map) Local Variables Conditions (Owner of (Triggering unit)) == 6 Actions Variable - Modify P6 Total Units: + 1
P6 Total Units Counter Remove Unit - Any Unit dies Local Variables Conditions (Owner of (Triggering unit)) == 6 Actions Variable - Modify P6 Total Units: - 1
bump, apparently the triggers all do work...at least after the inital error. The units stop spawning after reaching the cap. So does the error message mean the trigger doesn't work in the beginning when the map starts, but it works after?
"script error...AddFunction Too many threads"
a thread usually reefers to an trigger instance. Since the number of triggers that can run at any given moment is very high chances are that one of ur triggers is going nuts and generating loads of instances and those instances are not dying.
i know thats a bunch of mumbo jumbo so let me try to explain it differently.
you probably have an event that occurs frequently but has some sort of repeat forever clause in it that prevents the trigger from ending. for example, when you add a "unit death" event, whenever a unit dies a trigger instance is created for that unit. it hits conditions and actions and what not. however, it also reached the end of actions and theirs no actions left, thus the instances is done. if you were to have some sort of long waits, or whiles, or repeat forever, the instance stays alive working the actions. if you have alot of dying in the game, you will end up with many of these instances working. eventually thousands and tens of thousands of instances run, the system realizes its getting out of control and stops allowing trigger events from occurring.