I am trying to make units spawn in a certain area every second, until there are at least x units. Once there are x units, the area will not spawn any more until the units are moved out of the region. Pretty much something similar to the old SC1 spawn style, without the annoying error sounds.
Right now I am using variables and while loops to control it, but the problem is when the units start leaving the region in groups, I get a very bad lag spike. Suggestions are appreciated!
While loops to control it? Hmm... that smells fishy. Why not make a periodic event, checking that the area is not full in its conditions?
But if you really want the high performance and elegant approach you could do it all with data. Make a hidden Spawner unit with a behaviour. The periodic effect for this behaviour is to spawn units obviously. And finally, set the Behaviour's "Validator (Disable)" to check that the area is not full.
Thanks for the quick reply. Do you know what the validator is called specifically? Or do I have to make one? I have toyed with the data editor a bit but have not really touched the spawn section. Can you give me a step-by-step?
You'll need to create the Validator yourself. It is of the "Enumerate Area" type which counts units in an area. You'll need to create a Behaviour of the "Buff" type and an Effect of the "Create Unit" type. Also, you'll need a Unit which you can set to "No Draw" in its Flags so that it is hidden and add the Behaviour you've created to it. I don't have the editor here and I can't recall the exact steps you need to follow, I'm afraid, though.
Note that the data approach might seem advanced so you might want to ignore me if you find it overwhelming. But no harm in learning something new.
You'll need to create the Validator yourself. It is of the "Enumerate Area" type which counts units in an area. You'll need to create a Behaviour of the "Buff" type and an Effect of the "Create Unit" type. Also, you'll need a Unit which you can set to "No Draw" in its Flags so that it is hidden and add the Behaviour you've created to it. I don't have the editor here and I can't recall the exact steps you need to follow, I'm afraid, though.
Note that the data approach might seem advanced so you might want to ignore me if you find it overwhelming. But no harm in learning something new.
Thank you sir =)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I am trying to make units spawn in a certain area every second, until there are at least x units. Once there are x units, the area will not spawn any more until the units are moved out of the region. Pretty much something similar to the old SC1 spawn style, without the annoying error sounds.
Right now I am using variables and while loops to control it, but the problem is when the units start leaving the region in groups, I get a very bad lag spike. Suggestions are appreciated!
While loops to control it? Hmm... that smells fishy. Why not make a periodic event, checking that the area is not full in its conditions?
But if you really want the high performance and elegant approach you could do it all with data. Make a hidden Spawner unit with a behaviour. The periodic effect for this behaviour is to spawn units obviously. And finally, set the Behaviour's "Validator (Disable)" to check that the area is not full.
@Klishu: Go
Thanks for the quick reply. Do you know what the validator is called specifically? Or do I have to make one? I have toyed with the data editor a bit but have not really touched the spawn section. Can you give me a step-by-step?
You'll need to create the Validator yourself. It is of the "Enumerate Area" type which counts units in an area. You'll need to create a Behaviour of the "Buff" type and an Effect of the "Create Unit" type. Also, you'll need a Unit which you can set to "No Draw" in its Flags so that it is hidden and add the Behaviour you've created to it. I don't have the editor here and I can't recall the exact steps you need to follow, I'm afraid, though.
Note that the data approach might seem advanced so you might want to ignore me if you find it overwhelming. But no harm in learning something new.
Thank you sir =)