Page 1 of 1
Trigger repeating every turn
Posted: Sun Jun 16, 2019 9:50 pm
by koopanique
Hi,
I'm working on a scenario USA vs Germany, where both sides are granted 2 random units everyday. I think this would make for interesting situation where the player has to make do with what they have at hand.
To achieve the spawning of the 2 random units per turn, I have a trigger folder for each side, and inside, a multitude of triggers that deploy every unit I want to be possibly deployed. For both USA and Germany, there's a trigger outside of the trigger folders, which condition is "Check if Turn < 99", and which effect is set to "Random Trigger", with parameter set to "folder: <name of USA or GE trigger folder>", so I assume it triggers a random trigger inside the trigger folder, and does so every turn as long as turn count is below 99.
The issue is that when I launch the scenario, the game immediately spawns all units for each side on the first turn, then does not spawn anything on the later turns. What I'd like is for the game to trigger only 2 triggers from the trigger folder, once per turn.
Do you have any idea how I could achieve this using the editor?
Thanks!
Re: Trigger repeating every turn
Posted: Sun Jun 16, 2019 10:47 pm
by bru888
I'll take a look at it if you post some screenshots. Meanwhile, I'm wondering if this arrangement might do the trick; greatly simplified for demonstration - only 5 spawn sets per side - but they will repeat so you don't really need 99 separate spawn triggers; just enough to include every unit that you wish to include):

- Screenshot 9.jpg (222.63 KiB) Viewed 3028 times

- Screenshot 10.jpg (227.84 KiB) Viewed 3028 times
Re: Trigger repeating every turn
Posted: Mon Jun 17, 2019 7:31 pm
by koopanique
@bru888 Thanks a lot for the detailed response!
I think that would indeed do the trick. I can't wait to test it. I think I misunderstood the "amount" parameters. I thought it would choose 2 triggers at random in the folder, but it actually choses 2 between all the triggers or folders listed.
Re: Trigger repeating every turn
Posted: Mon Jun 17, 2019 8:02 pm
by JB72
1. Which does "amount 2" mean ?
2. All spawned units come at random then ?
Re: Trigger repeating every turn
Posted: Tue Jun 18, 2019 12:08 am
by bru888
JB72 wrote: ↑Mon Jun 17, 2019 8:02 pm
1. Which does "amount 2" mean ?
2. All spawned units come at random then ?
If,
IF it works as intended (which I think it does; I'm just being facetious), the "2" means it will pick two of the triggers in the list to fire and spawn the units indicated in those triggers. Usually a random trigger is used for only one choice from a list, hence amount "1," but I am reasonably sure that increasing this amount means correspondingly more triggers in the list will be selected to fire each time.
As far as "All spawned units come at random then ?", I'm not sure what you mean. Not all spawned units will immediately come; just two per side each turn in this set up and yes, randomly each time. I believe that is what koopanique intended.
Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 9:35 am
by koopanique
Hi,
After testing your method bru888, alas it still doesn't work as I would like, although there's some interesting change.
With the triggers set the way you suggested, when I move a spawned unit, another unit is created immediately (as if it waited for my unit to move before it spawned), even before I confirm the move order. And I can immediately move this new unit Meaning I can deploy an endless stream of units! Not applicable for any serious scenario, but interesting glitch

Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 1:13 pm
by bru888
This is an interesting problem and a learning opportunity.
Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 1:36 pm
by terminator
I think it’s because you’ve put -1 everywhere, once a trigger has been activated, it repeats itself to infinity (?)
Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 1:57 pm
by bru888
terminator wrote: ↑Fri Jun 28, 2019 1:36 pm
I think it’s because you’ve put -1 everywhere, once a trigger has been activated, it repeats itself to infinity (?)
Yes, that's it! koopanique, try this: With each of those spawn triggers marked "-1" include an effect that turns that same trigger off again. You do want them to repeat whenever each is chosen by the random trigger, but you don't want them to keep on repeating by themselves.
Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 1:57 pm
by Horst
"Triggers" checked box on upper-left should rather only read "1" to activate only once for spawn triggers. If you only want to spawn something in a specific turn then most likely only once, right? Otherwise, you better clone these triggers and change the "Check Turn" of each of them.
"Trigger Event" should preferable read "Turn Start".
"Conditions" should include "Check Turn" including pressing an alliance button, otherwise it triggers on all alliances this turn.
"Random Trigger" effect should normally only include "amount = 1" for one spawn. If you want to spawn several units at once, you better include this in each spawn-trigger. No idea how complicated you want it.
Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 2:00 pm
by bru888
That will work if he plans out all 99 turns but I was trying to save him some work. koopanique, first try my suggestion with your existing arrangement as I mentioned above. If that still doesn't work, then lay it out using Horst's recommendations.
Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 2:29 pm
by Horst
Oh wait, there is easily another oversight with the spawn triggers. I tend to use such infinite triggers with my random weather system:
You have to include "Set Trigger State" in the effects that unchecks the spawn-trigger again. Otherwise, each activated spawn-trigger will fire on the next turn again even without "Random Trigger" effect.
Here is an example of an infinite random trigger that randomizes weather in a scenario each turn:

- Weather Dice 1.jpg (343.78 KiB) Viewed 2887 times

- Weather Dice 2.jpg (333.33 KiB) Viewed 2887 times
Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 2:40 pm
by Horst
Sorry, I don't dare to edit my post above due forum attachment bug.
The problem with these infinite triggers is that they won't be normally unchecked anymore if you once enable them with the "Random Trigger" effect. That's why you have to disable them afterwards each time you let them fire.
Re: Trigger repeating every turn
Posted: Fri Jun 28, 2019 3:21 pm
by bru888
Horst wrote: ↑Fri Jun 28, 2019 2:40 pm
The problem with these infinite triggers is that they won't be normally unchecked anymore if you once enable them with the "Random Trigger" effect. That's why you have to disable them afterwards each time you let them fire.
Yes, I think we are in agreement on that. koopanique, this is what we are talking about:

- Screenshot 0.jpg (204.64 KiB) Viewed 2880 times
On each and every spawn trigger, include an Effect that turns the same switch off again until it is reactivated.