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=~
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=~
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=~
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
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=~
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=~
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.
  • The Helper The Helper:
    It is online though at night
  • The Helper The Helper:
    You would probably have to take a loan to get the Rice cert it is like 14l
  • The Helper The Helper:
    I was hoping you were going to say you wanted to be a cook and wished to open up a Food Truck there are so many opportunities for that here
  • The Helper The Helper:
    you can only open the bar if you sell food and a food truck in the parking lot counts
  • The Helper The Helper:
    here in houston
  • The Helper The Helper:
    most bars are struggling to build food prep and even some I know are doing there own food trucks
  • The Helper The Helper:
    but yeah man you should come to Houston there is so much more opportunity here than San Antonio. Just look at all the homeless people on the Riverwalk and downtown there you cannot even walk down the street without getting mobbed them
  • The Helper The Helper:
    check out this place apparently it is the best roommate site out there roommates.com lol
  • Varine Varine:
    The homeless people reminded me of New York
  • Varine Varine:
    I'll check it out, my lease expires in like a few months so I need to figure something out.
  • Varine Varine:
    I tried to open a food truck in Sandpoint a few years ago but the city said no, then like two years later they passed new laws to encourage it and gave them all fucking tax breaks and shit. And at that point I didn't have enough money to go buy one so I was way too late to the game once other cities realized they could just bring their existing truck there, or sell their brick and mortar.
  • Varine Varine:
    I do like food trucks though, they're way more fun than restaurants and usually I also get some of that tip money there.
  • Varine Varine:
    Restaurants are really hard if you don't have a back up source of income to fund them sometimes, in my experience most owners either got really really lucky, had existing money that allowed them to buy an already successful one, or they have family money to fall back on for loans. It's few and far between to see very inspiring success stories where the person actually got it through hard work and perseverance. I thought about opening one lots and I always just end up not thinking it'll work. I would much rather just find someone that has that money and go work for them
  • The Helper The Helper:
    i am not talking about opening a brick and mortar I am talking about food trucks though I have seen some brick and mortar mexican places open up during covid that are doing good because there food is awesome!
  • The Helper The Helper:
    Food trucks are killing out here because Bars cannot open unless they sell food and the governor ok'd the use of a food truck in front as serving food
  • The Helper The Helper:
    Just not enough food trucks
  • The Helper The Helper:
    a buddy of mine just opened up a food truck and he is killing it but he is a great cook and has awesome food right in the middle of the pandemic too food trucks are immune to pandemic because they are take out in Texas you will always be able to get take out or delivery
  • The Helper The Helper:
    He is in the different food facebook groups in houston and posts videos of him making his food
  • The Helper The Helper:
    he is killing it
  • jonas jonas:
    @Varine with the restaurants, there surely is a lot of luck and hard work but most restaurants fail because they suck. Flair isn't right, economics not well thought through, food is mediocre or sucks, location is bad, etc. If you're thinking about opening one, make sure you're looking at the stories of those that would be playing at your level, don't let your hopes be dragged down by all the subpar restaurants out there.
  • jonas jonas:
    I'm a bit worried about the future of data science, there's an influx of incompetent people hired by incompetent managers, that can't last. But I'm sure smart data scientists will always be useful and hireable. Same as smart security people.
  • jonas jonas:
    My sister in law worked in a vegan food truck, the owners were also making a killing, added several trucks and opened two restaurants over 5 years
  • Ghan Ghan:
    The CompTIA stuff is pretty much crap unfortunately. The places that ask for those low-level certs aren't likely places you want to work. For IT you really want a degree, but in the meantime you need to figure out some way to learn the skills. Cybersecurity is really hot right now so competition is fierce.
  • tom_mai78101 tom_mai78101:
    I realized I don't have anything much to say, other than "Good luck!". Compared to other places, I'm just very lucky we didn't have a lot of surges of cases coming in.

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top