Saving Time

MissKerrigan

Active Member
Hey,

I made 200 spawn unit triggers like this:


event: elapsed time is '30' game seconds
condition: none
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'hydralisk' in 'spawn region' for player 8 facing no angels

Next trigger is:

event: elapsed time is '60' game seconds
condition: none
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels

So I made 200 triggers like this increasing 30 seconds every trigger
Here's my problem:


I made 3 EXTRA regions, I called the regions now ; 'spawn 1' 'spawn 2' 'spawn 3' 'spawn 4'
meaning that 150 of this 200 triggers must spawn in region '2' '3' and '4', I placed the regions '2' '3' and '4' at other locations over the map

Is there a way I can do this fast? or do I have to change 150 triggers?
I mean, maybe there is some multicontrol to order 50 triggers to spawn in region b,c and d?
I just don't like to spend hours on a little thing

Does anybody know what I'm saying?

MissKerrigan
 

X-maul

AKA: Demtrod
I do not have the editor at me at the time, but you can use the "For each integer do action"
You create a local variable of type integer and do for each integer YOUR VARIABLE do actions:
action: create 1 'marauder' in 'spawn region' for player 8 facing no angels
action: wait 1 game seconds

When I get home I'll create a trigger for you that will simplify it for you :)
(you can also make a global variable of unit type that will set:
WaveUnit[1] = Zerglings
WaveUnit[2] = Marines
WaveUnit[3] = Marauders
(and so on)..
and then you have a global integer variable that will be set to your current round
so the spawn of the units will look like this:
action: create 1 'WaveUnit[WaveNumber]' in 'spawn region' for player 8 facing no angels
 

Phubar

Well-Known Member
This is not an answer to your question but let me tell you that maybe your trigger can be semplifyed using a "repeat" funcion like this:

Trigger reapeat endless or until condition

event: elapsed time is '60' game seconds
condition: none
action: repeat (actions)
-------- create 1 'marauder' in 'spawn region' for player 8 facing no angels
-------- wait 1 game seconds
action: if then else
-- condition "yourcondition"
-- then action: stop looping or you can stop the execution of current trigger.


Trigger reapeat X times

event: elapsed time is '60' game seconds
condition: none
action: repeat (actions) X times
-------- create 1 'marauder' in 'spawn region' for player 8 facing no angels
-------- wait 1 game seconds
 

X-maul

AKA: Demtrod
I would suggest you to do something like this:
Create 2 Global Variables:
WaveUnit = Unit Type - Array Size 200 (above your max wave number)
Wave = Integer
Then you create 3 triggers looking like this:
Code:
Init
    Events
        Game - Map initialization
    Local Variables
    Conditions
    Actions
        Variable - Set Wave = 0
        Variable - Set WaveUnit[1] = Zergling
        Variable - Set WaveUnit[2] = Marine
        Variable - Set WaveUnit[3] = Marauder
        [COLOR="#FF0000"]<CREATE ONE FOR EACH WAVE>[/COLOR]
The following trigger will be running each wave:
Code:
Waves
    Events
    Local Variables
        INT = 0 <Integer>
    Conditions
    Actions
        General - For each integer INT from 1 to 40 with increment 1, do (Actions) [COLOR="#FF0000"]<THIS WILL MAKE IT RUN FOR 40 SECONDS (DEPENDING ON THE WAIT IN THE END)>[/COLOR]
            Actions
                Unit - Create 1 WaveUnit[Wave] for player 8 at Region1 using default facing (No Options)
                Unit - Create 1 WaveUnit[Wave] for player 8 at Region2 using default facing (No Options)
                Unit - Create 1 WaveUnit[Wave] for player 8 at Region3 using default facing (No Options)
                [COLOR="#FF0000"]<ONE FOR EACH SPAWN LOCATION>[/COLOR]
                General - Wait 1.0 Game Time seconds
Then you create a trigger that will periodically begin each round:
Code:
Periodic Waves
    Events
        Timer - Every 70.0 seconds of Game Time [COLOR="#FF0000"]<TIME BETWEEN WAVES>[/COLOR]
    Local Variables
    Conditions
    Actions
        Variable - Set Wave = (Wave + 1)
        Trigger - Run Waves  (Check Conditions, Don't Wait until it finishes)
This 'system' will store your wave units within global variables that you can use when you need them :)
 

Siretu

Starcraft 2 Editor Moderator
Staff member
As people have already pointed out, this can be simplified a LOT. We're not talking about 200 triggers. We're talking less than 5. Probably just one, depending on how your map works.

First of all, I downloaded your map from battle.net a couple of weeks ago and looked through your triggers. I sent you a long PM about ways to make the triggering easier for you. Did you read it?

Secondly, here's a trigger that should do everything you wanted your triggers to do earlier. Now when you want to add different spawns, it wont be exactly the thing you want but you'll have to explain what you want more thoroughly. Do you want the first wave to spawn at "spawn 1", the second at "spawn 2", the third at "spawn 3" and so on? Or maybe you want the first 50 waves to spawn at "spawn 1" and the next 50 at "spawn 2"?

Trigger:
  • Spawn
    • Events
      • Timer - Every 30.0 seconds of Game Time
    • Local Variables
    • Conditions
    • Actions
      • General - Repeat (Actions) 10 times
        • Actions
          • Unit - Create 1 WaveUnit[level] for player 8 at &quot;Spawn&quot; using default facing (No Options)
          • General - Wait 1.0 Game Time seconds
      • Variable - Set level = (level + 1)


See how few rows that is? To add a new level, you just need to add an action to your initialization trigger. Let's go over how it works. First of all, this trigger will run every 30 seconds. From your triggers, it looks like the first level runs 30 seconds in, the second 60 seconds in and every level after that comes in 30 second intervals. This means that we only need one event to cover it all.

What about the actions? First of all we have a "Repeat" action. It just repeats the things we put in it. How many times it repeats it depends on what we specify. In this case, we told it to repeat it 10 times. This means it will create the "WaveUnit[level]"(don't worry, I'll get more into that later) and wait one second. It will do that 10 times in a row. That is the same as this trigger:

Trigger:
  • Spawn
    • Events
      • Timer - Every 30.0 seconds of Game Time
    • Local Variables
    • Conditions
    • Actions
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Unit - Create 1 WaveUnit[level] for player 8 at Spawn using default facing (No Options)
      • General - Wait 1.0 Game Time seconds
      • Variable - Set level = (level + 1)


But as you can see, the first trigger is much shorter and easier to overlook. Next up are the variables. We have one variable called level. It is of the "integer" type(which is means it's just a normal number like 1,2 or 3 for example). At the end of the trigger, we set the variable level to be one more than it was before. This means that the level will always represent the current level you are on. The variable "level" should have a start value of 1, since you start at level 1(I assume)

There's also another variable. A unit type variable called "WaveUnit". It is an array with the size of the amount of levels you have. An array just means that it's like a desk with multiple drawers where you can put things. WaveUnit[1] is the contents(in this case, a unit type) of the first drawer. WaveUnit[2] is the contents of the second and so on. This is good because we want to save the unit types of each wave but we don't want to make one variable for each level. Now we only need one.

I think you have an initialization trigger that runs when the map starts. If you have one, you can fill your array in there. Otherwise, make a new one that looks something like this:
Trigger:
  • Level initialization
    • Events
      • Game - Map initialization
    • Local Variables
    • Conditions
    • Actions
      • Variable - Set WaveUnit[1] = Hydralisk
      • Variable - Set WaveUnit[2] = Marauder
      • Variable - Set WaveUnit[3] = Immortal


You can add more rows just like it to add more units. With some slight modification, you can even make the game end when you beat the final level. Here's a modified version of the first trigger that handles that:
Trigger:
  • Spawn
    • Events
      • Timer - Every 30.0 seconds of Game Time
    • Local Variables
    • Conditions
    • Actions
      • General - Repeat (Actions) 10 times
        • Actions
          • Unit - Create 1 WaveUnit[level] for player 8 at Point using default facing (No Options)
          • General - Wait 1.0 Game Time seconds
      • Variable - Set level = (level + 1)
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • WaveUnit[level] == No Game Link
        • Then
          • UI - Display &quot;You win!&quot; for (All players) to Subtitle area
          • Game - End game in Victory for player 1 (Show dialogs, Show score screen)
          • Game - End game in Victory for player 2 (Show dialogs, Show score screen)
          • Game - End game in Victory for player 3 (Show dialogs, Show score screen)
          • Game - End game in Victory for player 4 (Show dialogs, Show score screen)
        • Else


Basically, when there's no more unit in the WaveUnit array, it'll end the game. Make sure to make the size of the array one bigger so it doesn't go outside the array.

What I've shown you should be able to replace those 200 triggers. You should just have to fill in all the levels with one row each, and when you're done, creating levels will be extremely easy.
 

Siretu

Starcraft 2 Editor Moderator
Staff member
Yes. You should be able to find the link called "Private messages" below the thehelper logo at the top of the page. You could also try following this link
 

MissKerrigan

Active Member
Ok siretu I explored your thread above and got a few questions about this

1. is the map you downloaden from battle.net 'zombie defence'?
2. did you also seen the spawn zergling units and how I set them into air/ground unit?
3. did you even seen every coming is 10 creeps random air/ground?


I asked in another thread if it's possible to make the map size bigger
I want make the map size x2 of what it is now, so I can give a 'defence game' for every player (4 players max)
Maybe you have seen I created a trigger, how more players there are in game, the more creeps will coming
This seems to make it impossible creating towers with splash damage because it would be very EASY with 4 players the creeps getting very close to each other

Like I told before, I created all creeps for every player at the 'spawn unit' region (this are 200 triggers, 50 waves a player)
So, my plan was to make 50 trigger for every player to spawn the units in their own area
But I've seen your thread it can be easier and I have to say you're right

Now what I want:

- making 4 of this paths in the game surrounded by water, so players can't go to each other
- making the creeps coming only if the player is in the game (also the builder of the player)
- +3 regions which called 'spawn units 2' 'spawn units 3' and 'spawn units 4' (I changed the spawn units region to 'spawn units 1')
- a game over trigger that ONLY runs if all 4 players have lost all their 10 lifes
- a trigger which is NOT give resourses to other players if a player left the game
- I still want to disable the resourses menu like I post a thread about 3 months ago (players may not be able to send the other players resourses)
- If there comes a boss I want to create a text tag 'BOSS' up the unit, but how do I trigger, the text tag keeps following the boss
- Making a leaderboard that just shows howmuch minerals the players have (ONLY if they are in game)
- a trigger that change the priority of the creep which it slowed/stunned/confused (confused creeps moving back to the start for few seconds and then they continue their journey to the end)

About the variable:

- so I create a variable-integer and set the number to 50 because there are 50 waves?
- then I go to the map initalizing trigger and set the variables 'wave 1 = zergling' 'wave 2 = hydralisk' etc (is this wave variable the integer variable I just created?)
- Make a trigger that runs the waves and set them +1 at the end

If I set the variable 'wave' +1 in the end of a trigger, how exactly I tell the editor to run this wave?

OMG I SHAME MYSELF still not undertanding this after like 5 explainations
I want to UNDERSTAND how this damn variables/integers/trigger set variable/wave +1/glabol variables and things works
I know I can save hours (probably days!) at this, but till now I waste more time on it by trying things and mess up the editor and fixing bug I caused by trying this out

I would drive you crazy if I post all this questions at the forum, so I tried out most of the things by myself


Would be so great if somebody could explain me how to do this getting my tower defence game complete

MissKerrigan
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Friday Yay!
  • mgarcia mgarcia:
    did you guys catch Carl's interview? https://www.youtube.com/watch?v=kuHiMXABkGs
  • mgarcia mgarcia:
    he's the one that informed me about the DVD's working!
  • mgarcia mgarcia:
    he also mentioned the progress on the controllers!
  • The Helper The Helper:
    I did actually it was cool to see the NUON mention
  • The Helper The Helper:
    https://discord.com/channels/985377399338332202/985377399950696481 you can still use this chat too we are two fisted now :)
  • thewrongvine thewrongvine:
    costs me $80 to fill gas tank sad face
  • Ghan Ghan:
    Oof
  • The Helper The Helper:
    Yeah that gas is some expensive stuff :)
  • The Helper The Helper:
    ghan does not have to worry about it he has a tesla and I have a small tank so it does not cost me usually more than 50
  • The Helper The Helper:
    fyi Ghan we are getting an error trying to access stats or world editor tutorials Error 526 Ray ID: 72128c6bf99f6707 • 2022-06-26 02:35:15 UTCInvalid SSL certificate
  • Ghan Ghan:
    An artifact of switching to Cloudflare... the Let's Encrypt certs can't autorenew through Cloudflare.
  • Ghan Ghan:
    I got the forum updated before things expired but there were some other casualties.
  • Ghan Ghan:
    Everything should be fixed now....
  • The Helper The Helper:
    Thank you Ghan!
  • The Helper The Helper:
    Happy Monday!
  • The Helper The Helper:
    new NUON forum mod cubanral!
    +1
  • The Helper The Helper:
  • tom_mai78101 tom_mai78101:
    Started learning how to make tools-assisted speedruns, so I'm lately busy.
  • tom_mai78101 tom_mai78101:
    Here's my current project.
    +3
  • O Old Mountain Shadow:
    that was pretty good!
  • jonas jonas:
    really cool! I saw the game before but always thought it's just a half as good double dragon. Now I realize it actually has a lot of depth!
  • The Helper The Helper:
    I just saw a bunch of running and jumping past all the enemies look like it was scripted as he said I guess I should have watched the whole thing. I only got a couple of minutes in. You should post that video in the forum Tom
  • Darthfett Darthfett:
    "Hi in the chat!"
    +1
  • tom_mai78101 tom_mai78101:
    Currently busy with making the run even better, so I'll post that new one once I'm done. Right now, I had to modify the emulator itself, the tools that makes this video, and some RAM address disassembling / reverse-engineering to get the right values, and such.
    +1

    Staff online

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top