Alright SEN I want to see if I can save some time by asking you guys for help. I want to make a map where you build buildings and receive units depending on what buildings you have after a spawn timer reaches zero and then resets itself (supply depot = 1 marine, receive a marine every x amount of time per depot). I am not very familiar with the editor yet but here is the way I was thinking of handling it
When ever the countdown reaches 0 a spawn token is given to each player (global variable "spawn token p1' +1 'spawn token p2' +1)
Whenever a player has a 'Spawn Token' they will subtract it and create the units for each building that player controls
This is the part where I need help. How would I efficiently go about this? The event would be having a Spawn token but what would my conditions be? Somewhere in the actions I would subtract a spawn token to bring it back down to 0 right? But If I do that then that means I would have to do a check for buildings all in one single trigger or something. I don't think that would be possible. How would I go about this?
Sorry if this doesn't make much sense.
None.
An artist's depiction of an Extended Unit Death
I would get exact trigger code for you, but I don't have SC2 installed on this machine.
It'd be something along the lines of:
Events:
Timer reaches 0
Local Variables:
NumBuildings <integer>
Conditions:
Actions:
Set variable NumBuildings = Number of Supply Depot in (Entire Map) owned by Player 1 with flags: Living
Create NumBuildings Marine at (Center of SpawnRegion) owned by Player 1
Set variable NumBuildings = Number of ANOTHER_BUILDING in (Entire Map) owned by Player 1 with flags: Living
...
Reset Timer
You can wrap all those actions in a for loop to iterate over each player as well to make it less redundant (instead of hardcoding "1" for the first player and duplicating it for players 2, 3, etc.). If the spawning region is at the building you could rework it to Pick Each Unit In Region And Do Action. Combining these two ideas, we get:
Events:
Timer reaches 0
Local Variables:
PlayerNr <integer>
Conditions:
Actions:
Pick each integer PlayerNr from 1 to 8 and do Actions:
Pick each unit in (Supply Depot owned by Player PlayerNr in (Entire Map)) and do Actions:
Create 1 Marine at (Position of (Picked Unit)) owned by Player PlayerNr
Pick each unit in (ANOTHER_BUILDING owned by Player PlayerNr in (Entire Map)) and do Actions:
Create 1 ANOTHER_UNIT at (Position of (Picked Unit)) owned by Player PlayerNr
...
Reset Timer
Sorry if I'm getting syntax wrong and stuff. Hopefully it's still understandable.
Post has been edited 1 time(s), last time on Aug 10 2012, 4:22 am by Roy.
I may be confused
But isn't this exactly what Sand Castle Wars did?
None.
Set variable NumBuildings = Number of Supply Depot in (Entire Map) owned by Player 1 with flags: Living
Not sure how to do this. TZ says to use "number of units in unit group" but if that is true from there I have no idea what else to choose for triggering unit. halp
None.
Let me show you how to hump without making love.
MZ, is what you want to do basically what Sand Castle Wars did? If so, I can offer you the best and easiest solution. If not, more elaboration is required.
None.
I think so, except I'm not trying to create the units at the building but in a 'spawn' region. The map idea is sort of based on the sc1 maps War of the 12 kingdoms and Heros of Might and Magic.
anyways assume sandcastle I guess. I think it's pretty much the same system except I don't spawn the units at the building and I don't auto move them or anything like that.
None.
Let me show you how to hump without making love.
I helped.
Post has been edited 1 time(s), last time on Aug 10 2012, 5:14 pm by LoveLess.
None.
You can wrap all those actions in a for loop to iterate over each player as well to make it less redundant (instead of hardcoding "1" for the first player and duplicating it for players 2, 3, etc.)
so how do I do this without hard coding it for P1-8? I'm not really sure how, anyways I guess in the mean time I will hard cord it
None.
Use a loop that goes from 1 to 8, and use the loop variable for the player number.
None.
Use a loop that goes from 1 to 8, and use the loop variable for the player number.
Sorry I'm new to the editor and thinking like a programmer in general. So... I would make it that every time a player number is needed it would be a variable. Then I would... use the 'While' action? Right? I think
edit: or actually I would use the repeat command x8 since I have 8 players and have the action before it add +1 the the player number variable to run I think right? Or maybe not since the repeat command would need a while action... I think I'm the the right direction ;_;
but this wouldn't work because of the spawn location. Would I have to some how to a variable thing for regions? How do I do that? Also how many repeats would I need for 8 players? 7 or 8? not sure if it counts one instance + the repeats or whatever.
Post has been edited 2 time(s), last time on Aug 10 2012, 6:06 pm by MadZombie.
None.
I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.
It's the most efficient way to iterate over the players I guess.
for each player p# in active players
-> set variable unitGroup = any unit in complete map owned by player p# with the filter (required structure, not dead, not hidden) with max of none
-> for each UNIT in unit group
---> if unit type of UNIT == supply depot
---------> create unit for p# in at random point in Regions[p#], ignore placement
I would solve that with looping over the players and looping over the units. I would get the region out of a region array based on the player number.
Remember that player numbers aren't the same as in SCBW. They are determined by the order of joining the lobby and can't be changed.