How can I do this? It appears I cannot alter the time during the game in anyway. Are there any other methods that can "imitate" this event with a more flexible timing? Let's put it this way: I'm trying to create a unit for every X seconds, but the periodic event by no means supports flexibility.
But the problem with that is if I decide to use Map Init, it will instantly begin spawning as I enter the game. The spawning should begin when a Zergling from each player is brought to a region, which I have really will have no control over when that happens.
But the problem with that is if I decide to use Map Init, it will instantly begin spawning as I enter the game. The spawning should begin when a Zergling from each player is brought to a region, which I have really will have no control over when that happens.
you can add an if then else condition to check whether the zergling is in the region or not.
on a side note; so is the timer dependant on when the zerg player enters (when the zergling enters, a random timer starts and it spawns units periodically)? or is it a global periodic event that happens at the same time for every player?
from what i am reading, I think its completely possible create the trigger you want.
My map is a tower defense and the Zergling basically initiates the game when all players are ready. Once all players move their Zergling to set region, they die and the game will continuously create units without end. The units created change according to the round or level. The next round occurs when 60 seconds pass. The timer repeats itself once it ends, so basically there are no breaks in between. What I am trying to do is for players to be able to adjust the speed of the creation of units to their liking, but apparently it is impossible to assign a non-constant variable to a periodic event.
My map is a tower defense and the Zergling basically initiates the game when all players are ready. Once all players move their Zergling to set region, they die and the game will continuously create units without end. The units created change according to the round or level. The next round occurs when 60 seconds pass. The timer repeats itself once it ends, so basically there are no breaks in between. What I am trying to do is for players to be able to adjust the speed of the creation of units to their liking, but apparently it is impossible to assign a non-constant variable to a periodic event.
then i guess the solution would be to use what the others suggested above:
You dont have to use Map Init for the events. Create another trigger that activates when a player's zergling enters the the said regions; and check if all the other player's zergling are in there as well. If the conditions are met, and your round is about to begin, use the Trigger - Run Trigger function to the trigger above. and voila. the trigger will spawn every X seconds (its a non-constant variable), and will spawn units of unit type Y. of course it is best if you force the players to define these variables before the round starts.
When the round is over, use the Trigger - Stop Trigger function, and the spawning will stop.
Why would it be best if I ask the players to define these variables before the round starts? I want the players to be able to control the rate of spawn whenever they want. Also, does a trigger run even without an event? And how will I go about defining the Unit Type of all the rounds within one single trigger (take note that there are more than one type of units per round and I want the units to come randomized, say 10% to spawn a Baneling, 50% to spawn a Zergling, and 40% to spawn a Marine)? Will I use the integer randomization to generate a number between 1 - 100 and add IF statements under every round, inside this one trigger? I have yet to figure out a way to do this...
Why would it be best if I ask the players to define these variables before the round starts? I want the players to be able to control the rate of spawn whenever they want. Also, does a trigger run even without an event? And how will I go about defining the Unit Type of all the rounds within one single trigger (take note that there are more than one type of units per round and I want the units to come randomized, say 10% to spawn a Baneling, 50% to spawn a Zergling, and 40% to spawn a Marine)? Will I use the integer randomization to generate a number between 1 - 100 and add IF statements under every round, inside this one trigger? I have yet to figure out a way to do this...
Sorry for asking so many questions, but I honestly cannot figure this out for life.
well you can. actually it wont be a problem. but do be advised that once the wait action action has registered, players will need to wait until the next loop for their adjustments to take effect. at least using that method.
so for example.
if by default the wait is 30 secs, and say 35 secs later the player changes the spawn rate to 1 second. it will be 25 seconds before the actual 1 second spawn rate takes into effect.
i would do it just like that using if then else statements. and to store the units in one trigger, you would need to use arrays just as Celerisk mentioned.
@Celerisk: it might be a hassle if he wants something like 45% lol.
Anyhow for efficiency, and simplicity so you wont need to amass triggers, I would do it this way with 3 variables, 2 with 2 indexes. and one with 1 index.
bear with my long post
Variables:
UnitType[round number] [case number] this is a unit type variable
Percentage[round number] [case number] this is a real
NumberofRandomUnits[round number] this is an integer, that returns how many random units are there in one round.
round number is... the round number. track this with an integer variable that gets a +1 when a new round starts.
case number would be an integer, labeling the random unit's percentage chance of spawning. So if one round its either a Zergling, Roach or a Hydralisk;
then Zergling would be 1, Roach would be 2, and Hydralisk is 3. its not a priority thing, its more like a data table we could refer to later.
You need to add a global boolean variable called "stop" or "break" or something like that; that if checked to true stops the script; so you would not use Repeat Forever, you would instead use a While Loop. This would allow you to stop it at anytime. Otherwise you would need an if,then,else statement in the Repeat Forever loop stating that if break = true then do it, else Break.
While
Conditions - break = false
Actions - do this.
Wait x seconds
As stated above, just use 'Run trigger' to start it, don't use map initialization.
You need to add a global boolean variable called "stop" or "break" or something like that; that if checked to true stops the script; so you would not use Repeat Forever, you would instead use a While Loop. This would allow you to stop it at anytime. Otherwise you would need an if,then,else statement in the Repeat Forever loop stating that if break = true then do it, else Break.
While Conditions - break = false Actions - do this. Wait x seconds
As stated above, just use 'Run trigger' to start it, don't use map initialization.
wont the trigger stop action do the same thing?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
How can I do this? It appears I cannot alter the time during the game in anyway. Are there any other methods that can "imitate" this event with a more flexible timing? Let's put it this way: I'm trying to create a unit for every X seconds, but the periodic event by no means supports flexibility.
Repeat action forever
-> Action
-> Wait <your variable>
@Eiviyn: Go
How will I apply that Action to my trigger? Do I require an event? Also what about the conditions?
@Nothing5: Go
You want to create a unit at an interval throughout the game?
What Eiviyn means is that you should make a trigger like this
@Kafoso - I want to have my triggers spawn random units at an unfixed interval, but not throughout the game.
@SBeier - But I don't want the same unit to keep on spawning, what I want is to have another type of unit spawning every 60 seconds.
Then make a global variable which contains the current unit type, and make the trigger from above create one of that unit type.
In a separate trigger, like for instance a periodic 60 seconds trigger, you change that global variable to reflect what unit type should be created.
But the problem with that is if I decide to use Map Init, it will instantly begin spawning as I enter the game. The spawning should begin when a Zergling from each player is brought to a region, which I have really will have no control over when that happens.
you can add an if then else condition to check whether the zergling is in the region or not.
on a side note; so is the timer dependant on when the zerg player enters (when the zergling enters, a random timer starts and it spawns units periodically)? or is it a global periodic event that happens at the same time for every player?
from what i am reading, I think its completely possible create the trigger you want.
@Zolstice: Go
My map is a tower defense and the Zergling basically initiates the game when all players are ready. Once all players move their Zergling to set region, they die and the game will continuously create units without end. The units created change according to the round or level. The next round occurs when 60 seconds pass. The timer repeats itself once it ends, so basically there are no breaks in between. What I am trying to do is for players to be able to adjust the speed of the creation of units to their liking, but apparently it is impossible to assign a non-constant variable to a periodic event.
then i guess the solution would be to use what the others suggested above:
Global Variables:
You dont have to use Map Init for the events. Create another trigger that activates when a player's zergling enters the the said regions; and check if all the other player's zergling are in there as well. If the conditions are met, and your round is about to begin, use the Trigger - Run Trigger function to the trigger above. and voila. the trigger will spawn every X seconds (its a non-constant variable), and will spawn units of unit type Y. of course it is best if you force the players to define these variables before the round starts.
When the round is over, use the Trigger - Stop Trigger function, and the spawning will stop.
@Zolstice: Go
Why would it be best if I ask the players to define these variables before the round starts? I want the players to be able to control the rate of spawn whenever they want. Also, does a trigger run even without an event? And how will I go about defining the Unit Type of all the rounds within one single trigger (take note that there are more than one type of units per round and I want the units to come randomized, say 10% to spawn a Baneling, 50% to spawn a Zergling, and 40% to spawn a Marine)? Will I use the integer randomization to generate a number between 1 - 100 and add IF statements under every round, inside this one trigger? I have yet to figure out a way to do this...
... and so on until round 50(?)
Sorry for asking so many questions, but I honestly cannot figure this out for life.
You could give an array of type unit-type a chance.
Something like:
Switch(Round)
Case(1):
- Set Spawns[1] = Baneling
- Set Spawns[2] = Zergling
- Set Spawns[3] = Zergling
- Set Spawns[4] = Zergling
- Set Spawns[5] = Zergling
- Set Spawns[6] = Zergling
- Set Spawns[7] = Marine
- Set Spawns[8] = Marine
- Set Spawns[9] = Marine
- Set Spawns[10] = Marine
Case(2):
- Set Spawns...
And create a random unit from there:
Unit - Create 1 Spawns[Random integer between 1 and 10] for ... someone, somewhere
Note though that random has a tendency to actually being random.
well you can. actually it wont be a problem. but do be advised that once the wait action action has registered, players will need to wait until the next loop for their adjustments to take effect. at least using that method.
so for example.
if by default the wait is 30 secs, and say 35 secs later the player changes the spawn rate to 1 second. it will be 25 seconds before the actual 1 second spawn rate takes into effect.
i would do it just like that using if then else statements. and to store the units in one trigger, you would need to use arrays just as Celerisk mentioned.
@Celerisk: it might be a hassle if he wants something like 45% lol.
Anyhow for efficiency, and simplicity so you wont need to amass triggers, I would do it this way with 3 variables, 2 with 2 indexes. and one with 1 index.
bear with my long post
Variables:
round number is... the round number. track this with an integer variable that gets a +1 when a new round starts.
case number would be an integer, labeling the random unit's percentage chance of spawning. So if one round its either a Zergling, Roach or a Hydralisk; then Zergling would be 1, Roach would be 2, and Hydralisk is 3. its not a priority thing, its more like a data table we could refer to later.
say in round one you want:
and in round 2
you would set these in one trigger.
well you get the idea? i know its harsh setting these up. but its better than setting up hundreds of if then else statements...
now for the actual spawn trigger: (you dont have to use Map Init. Run it at the start of your round, and then use trigger - stop during round breaks)
sorry u will need to recreate this on the editor. I am just typing this by memory, and no this is not Galaxy =P
the break is there so only one of the random units get spawned. if u want multiple instances, remove the break.
On a side note, i guess its obvious, the need for the random percentages to add up to 100%, unless u want a chance of it not spawning at all.
In the long run, setting stuff like array variables can prove beneficial, especially since ur making 50 rounds. =D
You need to add a global boolean variable called "stop" or "break" or something like that; that if checked to true stops the script; so you would not use Repeat Forever, you would instead use a While Loop. This would allow you to stop it at anytime. Otherwise you would need an if,then,else statement in the Repeat Forever loop stating that if break = true then do it, else Break.
While Conditions - break = false Actions - do this. Wait x seconds
As stated above, just use 'Run trigger' to start it, don't use map initialization.
wont the trigger stop action do the same thing?