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.
[03:27 am]
m.0.n.3.y -- Maybe because it's an EUD map?
[03:27 am]
m.0.n.3.y -- Can't upload maps to the DB. Error says "The action you have performed caused an Error". Any word?
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
Please log in to shout.


Members Online: Roy