I've been looking thru all sorts of abilities, but i just cant seem to find the correct one to be able to place a unit in a region based on either player1 or player 2, clicking a button in a building (in my case i am using the protoss nexus), i mean i can make the button, but i just dont see any way of adding a spawn unit to it.
If anyone can point me in the right direction that would be awesome.
First use the normal train ability like normal barracks have.
Then create a trigger
you have to create regions for every play
spawn[0]=region0
spawn[1]=region1....
i didnt check yet, so i am not sure for unit if it is triggering progress unit or triggering unit
Events
Unit - Any Unit training is Completed
Local Variables
unit = (Triggering progress unit) <Unit>
player = (Owner of unit) <Integer>
point = No Point <Point>
Conditions
Actions
Variable - Set point = (Random point in spawn[player])
Why do you need such a big region?
You could also do it with points, if the region has to move just move the point and for the event you do not need a region anyway.
Or why do you need such abig region at your command center?
When you use local variables as soon as possble, then you will have no lag at all and no memory leak.
So the units can be created in a bigger region around a point already. maybe you should try it the way i told you and check how many units you can spawn before they cant be moved correctly.
Either it always works or they could stay at the barracks.
I have it working wiht a 2x1 square region near my command center, and it works ok, but i had to add a 2nd on the right side due to the lag issue, i managed to replicate it once (so it happend twice when i was spamming units)
I included a picture of what my regions look at atm.
I spawn the unit when clicking, when it hits region 1 or 2 i move it to player 2 start position.
So it did not work with any unit progress - unit train has completed?
Events
Unit - Any Unit training is Completed
Local Variables
unit = (Triggering progress unit) <Unit>
player = (Owner of unit) <Integer>
point = No Point <Point>
Conditions
Actions
Variable - Set point = (Random point in spawn[player])
Unit - Move unit instantly to point (No Blend)
It should work without any lag issue.... but if no other units can get close to his structure i recommend you
to copy at least using local variables for unit, triggering player and the point, otherwise the memory usage of your map will increase by a high amount over time and you are right you could use one bigger region then there
If you get an error like the structure would move as entering the area on map initialization add a condition that the unit type has to be uneuqal the barracks
I must admit tho i am not entirely clear about something you mentioned earlier.
You said the move with the regions is very heavy on SC2, i asume this has to do with the constantly check on the reaching even if no units are being spawned ?
Nono, i was wondering why you used a big region, you just need one if the random point should be in a very big region.
The only thing you should avoid is using initial values like triggering player...last created untis etc in actions, try to save them in local variables and use the local variables then instead, then everything is fine!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I've been looking thru all sorts of abilities, but i just cant seem to find the correct one to be able to place a unit in a region based on either player1 or player 2, clicking a button in a building (in my case i am using the protoss nexus), i mean i can make the button, but i just dont see any way of adding a spawn unit to it.
If anyone can point me in the right direction that would be awesome.
@xxnxx: Go
First use the normal train ability like normal barracks have. Then create a trigger you have to create regions for every play spawn[0]=region0 spawn[1]=region1....
i didnt check yet, so i am not sure for unit if it is triggering progress unit or triggering unit
Events
Unit - Any Unit training is Completed
Local Variables
unit = (Triggering progress unit) <Unit>
player = (Owner of unit) <Integer>
point = No Point <Point>
Conditions
Actions
Variable - Set point = (Random point in spawn[player])
Unit - Move unit instantly to point (No Blend)
@BeLugh: Go
Thanks a lot, it works fine.
I just wish there was a more elegant way of doing it :)
Now i i put a big region under the command center, it also moves it along with the units which results in funny sight :P
I just put 4 small stroke regions along the sides and sofar it works ok.
@xxnxx: Go
Why do you need such a big region? You could also do it with points, if the region has to move just move the point and for the event you do not need a region anyway.
Or why do you need such abig region at your command center?
@BeLugh: Go
I was just really worried about lag in the game, spawning to many units (they get placed all around the command center if there are to much)
But sofar it seems, that the triggers are way faster then i have been able to spawn my units
@xxnxx: Go
When you use local variables as soon as possble, then you will have no lag at all and no memory leak. So the units can be created in a bigger region around a point already. maybe you should try it the way i told you and check how many units you can spawn before they cant be moved correctly.
Either it always works or they could stay at the barracks.
@BeLugh: Go
I have it working wiht a 2x1 square region near my command center, and it works ok, but i had to add a 2nd on the right side due to the lag issue, i managed to replicate it once (so it happend twice when i was spamming units)
I included a picture of what my regions look at atm.
I spawn the unit when clicking, when it hits region 1 or 2 i move it to player 2 start position.
@xxnxx: Go
So it did not work with any unit progress - unit train has completed?
Events
Unit - Any Unit training is Completed
Local Variables
unit = (Triggering progress unit) <Unit>
player = (Owner of unit) <Integer>
point = No Point <Point>
Conditions
Actions
Variable - Set point = (Random point in spawn[player])
Unit - Move unit instantly to point (No Blend)
It should work without any lag issue.... but if no other units can get close to his structure i recommend you to copy at least using local variables for unit, triggering player and the point, otherwise the memory usage of your map will increase by a high amount over time and you are right you could use one bigger region then there If you get an error like the structure would move as entering the area on map initialization add a condition that the unit type has to be uneuqal the barracks
@BeLugh: Go
This is what happens with your example :)
i dont seem to be able to add a not condition to exclude buildings.
@xxnxx: Go
I tried it myself, this one works fine:
Events
Unit - Any Unit training is Completed
Local Variables
unit = (Triggering progress unit) <Unit>
player = (Triggering player) <Integer>
point = No Point <Point>
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
player == 1
Then
Variable - Set point = (Random point in Region 001)
Unit - Move unit instantly to point (No Blend)
Else
if you woudl take triggering unit instead of triggering progress unit then it moves the structure instead of the unit
by the way how did you record the video? i just know to do it with fraps but then already a few seconds are like 200mb...
@BeLugh: Go
Its fraps, and then i use windows movie maker to compress it, i usually use the local lan quallity 2,1mbps
the video it self is like 5mb big :)
@xxnxx: Go
What about the problem, did it work for you now?
It works brilliantly now
I must admit tho i am not entirely clear about something you mentioned earlier.
You said the move with the regions is very heavy on SC2, i asume this has to do with the constantly check on the reaching even if no units are being spawned ?
@xxnxx: Go
Nono, i was wondering why you used a big region, you just need one if the random point should be in a very big region.
The only thing you should avoid is using initial values like triggering player...last created untis etc in actions, try to save them in local variables and use the local variables then instead, then everything is fine!