Help with looping triggers

T

Tojso09

Guest
I'm making this map where you fight in an arena and have ten waves of enemies. I don't want to have to write triggers for each wave so I tried to loop them using a few switches, but it doesn't work right.

As a custom in most games, the wave or level of the player is represented in ore and for some reason it jumps by odd intervals of 5 or 7.

My triggers are supposed to set a custom score for a player you don't control and as the score goes up, so does the time for each wave and the enemies within it. I have not yet gotten to spawning enemies yet because of the timer.

Please post if this is confusing to you or if you would like to see my triggers.
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
Well, you can't tell the game to create a variable # of units within a trigger, the units created count must be a constant value.
You have to trigger each wave separately.
 
T

Tojso09

Guest
I understand that the unit variable must be a constant, but I also have discovered that functions such as x^3 have a constant in them. so what if I used multiple scores, and using triggers to increase/decrease values to get the desired unit count? Would that work?
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
No matter what you do, you have to have different triggers. It's what you have to put up with when you don't have inner-actionbox if/then/else options.


And I don't have any clue what the constant I was refering to has to do with the 4 possible constants in a cubic function...
 
T

Tojso09

Guest
The reason i mentioned that constant was because i wanted to show that it is possible to use constants to get funtions such as x^3.

And what I was going for was something like the level scheme in the premade "Defenders of the Galaxy" map that comes with the game. I was wondering if anyone had a easy explanation for it instead of having to follow all 30-odd switches in the triggers.
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
If its just a level based thing, why use switches? Why not use a number-based counter like a neutral player's gas resources or something?
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
Don't be lazy, its so much easier to create seperate triggers, although it will be much harder to edit if you make a mistake ;P
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
anarki, if it was possible to use variable values, THAT is what would be easy. Just set the value once instead of doing a 30x CnP.
 
T

Tojso09

Guest
So... is that it for help on this topic? just wondering. I would like to know if anyone is really good at looping triggers for situations such as these.
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
Well, nobody is good at looping triggers for this stuff because triggers where the constants change each time (which exception to the player number integer) aren't looping, it's several triggers.
 
T

Tojso09

Guest
I know that it takes several triggers and switches to loop, and for the constant, just use a nonplayable character's resources to keep a constant or to keep it looping.

I'm not sure if this works, but this is what I'm talking about.

Conditions:
Always
Actions:
Clear 'loop'

Conditions:
'loop' is cleared
Actions:
Set ore for all players. Add 1
Set ore and gas for nonplayable character. Set to 0
Set 'loop'
preserve trigger

Conditions:
'loop' is set
Actions:
Spawn x zerglings at location 'wherever'
Set gas for nonplayable character. Add 1
preserve trigger

Conditions:
nonplayable character accumulates 30 gas
Actions:
Set gas for nonplayable character. Set to 0
Set ore for nonplayable character. Add 1
preserve trigger

Conditions:
nonplayable character has least ore
Actions:
set 'loop'
preserve trigger

Conditions:
nonplayable character has most ore
Actions:
clear 'loop'
preserve trigger

Conditions:
nonplayable character accumulates 10 ore
Enemies command 0 men
Actions:
End scenario in victory for current player

As you can see, I did use multiple triggers, a constant (accumulates 30 gas), and it might be able to loop
 
T

Tojso09

Guest
coded triggers above to test and prove that it does work

public class starcraftTrigger//anything after the slashes, //, use starcraft trigger jargon to help explain what is going on{
//note:this only works for one type of enemy spawning at a time

static boolean victory=false,loop=false;
//booleans are basically switches, false means cleared, and true means set

static int P2Ore=0, allopOre=0, p2gas=0;
//resources used (could be called "variables")

static int x=0,y=0;
//x is enemies in the wave, y is total enemies faced, both are used for data collection only, DO NOT TRY TO PUT INTO TRIGGER EDITOR, WILL NOT WORK

public static void main(String[] args)
{

/*Trigger 1*/

loop=false;
//this line is a trigger, but it is not preserved and the condition is always

while(!victory){
//unitl victory is declared in triggers, the program will keep going through triggers 2-7

/*Trigger 2*/

if(!loop){
//means if loop is cleared

allopOre++;
//means add 1 Ore to all players
P2Ore=1;
//continues previous statement

p2gas=0;
//sets player 2's gas to 0

loop=true;
//means set loop

y+=x;
x=0;}
//for data collection purposes

/*Trigger 3*/

if(loop){
//means if loop is set

x+=5;
//use spawn enemies at location with the x value in place

p2gas++;}

/*Trigger 4*/

if(p2gas>=30){
//means if player 2 accumulates at least 30 gas, also, the 30 can be changed into a smaller number to show how many times you want the enemy to spawn at the location in each wave

p2gas=0;
//sets player 2's gas to 0

P2Ore++;}

/*Trigger 5*/

if(P2Ore<allopOre)
//means if player 2 has least Ore

{loop=true;}
//means set loop

/*Trigger 6*/

if(P2Ore>allopOre)
//means if player 2 has most Ore
{loop=false;}
//means clear loop

/*Trigger 7*/

if(allopOre==100)
//the 100 can be changed to whatever amount of waves you wish

{victory=true;}
//means end scenario in victory for current player

/*Data Collection*/
System.out.println("Player 2 Ore:"+P2Ore+"\t\tPlayer 2 Gas:"+p2gas+"\t\tEnemies"+x+"\t\tEveryone else's Ore:"+allopOre+"\t\tTotal Enemies Fought:"+y);
// ^ prints out data collected in triggers in each iteration while no victory is declared ^

//under these settings you face almost 750000 enemies with up to 15000 per wave, TAKES A VERY VERY LONG TIME TO GO THROUGH
//by wave 40 over 100000 enemies are faced total with over 5000 enemies in wave

}}}
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top