Staredit Network > Forums > SC2 Assistance > Topic: Efficient System
Efficient System
Aug 10 2012, 2:54 am
By: MadZombie  

Aug 10 2012, 2:54 am MadZombie Post #1



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.

Aug 10 2012, 4:09 am Roy Post #2

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.




Aug 10 2012, 4:20 am UnholyUrine Post #3



I may be confused

But isn't this exactly what Sand Castle Wars did?



None.

Aug 10 2012, 3:51 pm MadZombie Post #4



Quote
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.

Aug 10 2012, 4:06 pm LoveLess Post #5

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.

Aug 10 2012, 4:18 pm MadZombie Post #6



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.

Aug 10 2012, 4:26 pm LoveLess Post #7

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.

Aug 10 2012, 5:27 pm MadZombie Post #8



Quote
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.

Aug 10 2012, 5:30 pm Biophysicist Post #9



Use a loop that goes from 1 to 8, and use the loop variable for the player number.



None.

Aug 10 2012, 5:37 pm MadZombie Post #10



Quote
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.

Aug 10 2012, 9:19 pm Ahli Post #11

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.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: Roy, Dem0n