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.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top