Let's say the first person to reach 100 kills spawns an Omegalisk, but in such a way that it would only spawn once. So rather than spawing an Omegalisk each time someone reaches their first 100 kills, the Trigger would only work once. How would I go about that?
Let's say the first person to reach 100 kills spawns an Omegalisk, but in such a way that it would only spawn once. So rather than spawing an Omegalisk each time someone reaches their first 100 kills, the Trigger would only work once. How would I go about that?
create a variable and set it to 0 at the beginning of the game. When the first player reaches 100 kills, check the value of the variable as a condition like this:
conditions:
value of "variable" == 0
Then in the actions set the value of your variable to 1 so that the trigger won't work anymore because the variable is no longer equal to 0.
Hey mate, decided to quickly create an example map. This one is 10 unit kills to spawn the omegalisk as im sure you didn't want to sit there for 100 kills to see if it worked :). Has kill tracking using an array so should work for all players and a basic unit respawn so you can keep killing.
Global Variables: Score Integer<10> (This is where each players kills are stored. It is an array of 10 for the number of players. To change a normal variable into an array just check the array box and set the number to what you desire.)
Score_tracking (Trigger)
Event: Unit - Any Unit Dies (This trigger is called when any unit dies in the map. We use this seeing as you want to increment a variable every time a unit dies.)
Local Variables: Special_Unit_Spawned [Boolean] (This variable is used to see if the omegalisk has already spawned or not.)
Conditions: (Owner of (Triggering Unit)) == 15 (I put this condition in because we only want to increment the value if the enemy (player 15) dies. This condition is not needed)
Actions:
Variable - Set score[(Killing player)] = (score[(Killing player)] + 1) (This action is set variable. The variable is 'Score' and because the variable is an array we need to tell which number it is. Due to this we use killing player. Killing player returns an integer of the player who killed the triggering unit (the unit that died). We then make 'Score' = arithmetic(integer). This allows us to add onto the Scores previous total without replacing the value. So the value we make score([(Killing player)] and add 1 onto it.)
The second part is an 'If' statement.
Conditions: score[(Killing player)] == 10 (and) special_unit_spawned == false (Because there are two conditions and they are not placed in an 'Or' condition, both must be true before they action in the 'If' statement is triggered. When a player gets 10 kills the first condition is met. Secondly if the omegalisk hasn't spawned yet the second statement will be true.)
Actions: Variable - Set special_unit_spawned = true (this set variable makes it so the omegalisk can not be spawned again regardless of what happens.)
Unit - Create 1 Omegalisk for player (Killing player) at special_unit_spawn facing (Random angle) degrees (No Options) (this will spawn an omegalisk for the player who killed the unit that triggered this trigger. It will spawn it the Point special_unit_spawn which is located at the centre of the map)
Not sure if I cleared anything up, if you have any specific questions will be happy to answer them
And more importantly that omegalisk will only spawn once right? So if player 2 kills 10 units after the omegalisk spawns it won't spawn again right?
Yep the omegalisk will only spawn once. Thats the purpose of the variable 'Special_unit_spawned'. When the omegalisk is spawned it will change to true preventing any further spawning of the omegalisk.
Yep it would be handled the same way as the omegalisk. If you wanted every player the chance to spawn a brutalisk you dont need to worry about the brutalisk spawned variable.
If you want only one to spawn i suggest changing the variable special_unit_spawned to a array of 2
The omegalisk would be special_unit_spawned(0) and the brutalisk would be special unit_spawned(1). The reason i suggest an array instead of another variable as the less the better and keeps it clean. Then just make another 'if' condition for the brutalisk identical to the omegalisk with those few changes. That should hopefully work.
Instead of choosing the variable, go on "Functions" and choose "Arithmetic Integer", then you can add the variable, choose a mathematical operation ("+" in this case) and add another value (1 in this case)
These arithmetic things come in useful when you want to change integer/real number variable depending on what the variable was before, or you somehow want to refer to any number in game but dont want the exact number but use mathematics instead.
That's what I did in mine.. I'll explain mine I guess since no one seems to have understood it.
The variable playerKills has 8 arrays to it, each 1 array is for a single player, the first trigger detects when any unit dies and then adds 1 to the variable, the array is chosen by the triggering players #, so if player 1 kills a unit then playerKills[1] will have 1 kill added to it.
The second trigger also detects when a unit dies, but in its conditions is checking to see if the variable is equal to 100 for the trigger player. If it isn't then the rest of the trigger wont run, if it is then it will spawn the omegalisk at your chosen point, yes i put ultralisk in my trigger. After it's done spawning the trigger turns itself off and the trigger that adds kills. This makes it so it will only spawn once for a single player, once 1 player reaches 100 kills no one else can get the omegalisk
Bah, Array was too small, it fixed the Error Messages but not the Trigger... It's still skipping to the 5th Challenge when it should be going to the first...
Looking at your triggers they seem to be a bit redundant. You have 5 challenges(unit spawns) but in each trigger you are also adding +1 to player kills. So every time a player gets a kill it will count as 5 instead of 1. A way to resolve this is to copy all the 'if' conditions from the other challenges and put them in Challenge1.
Secondly, change the variable special_unit_spawned (Boolean) to be an array of how many challenges you want (in this case 5. Finally change the 'if' condition variable 'special_unit_spawned(x)' from a number within the array size.
For example challenge 1 would be special_unit_spawned(0), challenge 2 would be special_unit_spawned(1) etc.
Why don't you just add the "Turn Trigger off (this trigger)" action.
The reason I didn't do Turn trigger off(this trigger) is because I put them all into the same trigger to save space. Turning the trigger off would of stopped the kill tracking.
Let's say the first person to reach 100 kills spawns an Omegalisk, but in such a way that it would only spawn once. So rather than spawing an Omegalisk each time someone reaches their first 100 kills, the Trigger would only work once. How would I go about that?
create a variable and set it to 0 at the beginning of the game. When the first player reaches 100 kills, check the value of the variable as a condition like this:
Then in the actions set the value of your variable to 1 so that the trigger won't work anymore because the variable is no longer equal to 0.
This would be really simple.. honestly..
I made a variable integer with an array for each player, in my example, 8 arrays, called playerKills. and then 2 triggers.
First trigger
Second trigger
I'm not really sure what this means, it looks a bit confusing, and I'm not learning anything by copying it...
Hey mate, decided to quickly create an example map. This one is 10 unit kills to spawn the omegalisk as im sure you didn't want to sit there for 100 kills to see if it worked :). Has kill tracking using an array so should work for all players and a basic unit respawn so you can keep killing.
Good luck
@unix055: Go
Can you talk me through what you did here with these Triggers?
@unix055: Go
And more importantly that omegalisk will only spawn once right? So if player 2 kills 10 units after the omegalisk spawns it won't spawn again right?
I see why not heh,
Global Variables: Score Integer<10> (This is where each players kills are stored. It is an array of 10 for the number of players. To change a normal variable into an array just check the array box and set the number to what you desire.)
Score_tracking (Trigger)
Event: Unit - Any Unit Dies (This trigger is called when any unit dies in the map. We use this seeing as you want to increment a variable every time a unit dies.)
Local Variables: Special_Unit_Spawned [Boolean] (This variable is used to see if the omegalisk has already spawned or not.)
Conditions: (Owner of (Triggering Unit)) == 15 (I put this condition in because we only want to increment the value if the enemy (player 15) dies. This condition is not needed)
Actions:
Variable - Set score[(Killing player)] = (score[(Killing player)] + 1) (This action is set variable. The variable is 'Score' and because the variable is an array we need to tell which number it is. Due to this we use killing player. Killing player returns an integer of the player who killed the triggering unit (the unit that died). We then make 'Score' = arithmetic(integer). This allows us to add onto the Scores previous total without replacing the value. So the value we make score([(Killing player)] and add 1 onto it.)
The second part is an 'If' statement.
Conditions: score[(Killing player)] == 10 (and) special_unit_spawned == false (Because there are two conditions and they are not placed in an 'Or' condition, both must be true before they action in the 'If' statement is triggered. When a player gets 10 kills the first condition is met. Secondly if the omegalisk hasn't spawned yet the second statement will be true.)
Actions: Variable - Set special_unit_spawned = true (this set variable makes it so the omegalisk can not be spawned again regardless of what happens.)
Unit - Create 1 Omegalisk for player (Killing player) at special_unit_spawn facing (Random angle) degrees (No Options) (this will spawn an omegalisk for the player who killed the unit that triggered this trigger. It will spawn it the Point special_unit_spawn which is located at the centre of the map)
Not sure if I cleared anything up, if you have any specific questions will be happy to answer them
Yep the omegalisk will only spawn once. Thats the purpose of the variable 'Special_unit_spawned'. When the omegalisk is spawned it will change to true preventing any further spawning of the omegalisk.
Add condition to spawn trigger: (Number of times (Current Trigger) has been executed) == 0
It's that simple.
@unix055: Go
Okay and let's say I wanted a brutalisk to spawn after 25 kills. Do I just extend the trigger?
Yep it would be handled the same way as the omegalisk. If you wanted every player the chance to spawn a brutalisk you dont need to worry about the brutalisk spawned variable.
If you want only one to spawn i suggest changing the variable special_unit_spawned to a array of 2
The omegalisk would be special_unit_spawned(0) and the brutalisk would be special unit_spawned(1). The reason i suggest an array instead of another variable as the less the better and keeps it clean. Then just make another 'if' condition for the brutalisk identical to the omegalisk with those few changes. That should hopefully work.
@unix055: Go
I don't see how you added that + 1 to the end of the set Score trigger. For me it just stops before that...
Instead of choosing the variable, go on "Functions" and choose "Arithmetic Integer", then you can add the variable, choose a mathematical operation ("+" in this case) and add another value (1 in this case)
These arithmetic things come in useful when you want to change integer/real number variable depending on what the variable was before, or you somehow want to refer to any number in game but dont want the exact number but use mathematics instead.
Why don't you just add the "Turn Trigger off (this trigger)" action.
@Vexal: Go
That's what I did in mine.. I'll explain mine I guess since no one seems to have understood it.
The variable playerKills has 8 arrays to it, each 1 array is for a single player, the first trigger detects when any unit dies and then adds 1 to the variable, the array is chosen by the triggering players #, so if player 1 kills a unit then playerKills[1] will have 1 kill added to it.
The second trigger also detects when a unit dies, but in its conditions is checking to see if the variable is equal to 100 for the trigger player. If it isn't then the rest of the trigger wont run, if it is then it will spawn the omegalisk at your chosen point, yes i put ultralisk in my trigger. After it's done spawning the trigger turns itself off and the trigger that adds kills. This makes it so it will only spawn once for a single player, once 1 player reaches 100 kills no one else can get the omegalisk
I must've done something wrong, I'm getting an error:
Trigger Error in 'gt_Challenge4_Func': An Error occurred starting Starcraft II. Please try again.e_arrayIndexOverflow
Any ideas what this means? I've uploaded my Triggers for the 5 Challenges
http://www.sc2x.net/C1.png http://www.sc2x.net/C2.png http://www.sc2x.net/C3.png http://www.sc2x.net/C4.png http://www.sc2x.net/C5.png
Anyone know what I'm getting this Error?
@Mesden: Go
Bah, Array was too small, it fixed the Error Messages but not the Trigger... It's still skipping to the 5th Challenge when it should be going to the first...
@Mesden: Go
Looking at your triggers they seem to be a bit redundant. You have 5 challenges(unit spawns) but in each trigger you are also adding +1 to player kills. So every time a player gets a kill it will count as 5 instead of 1. A way to resolve this is to copy all the 'if' conditions from the other challenges and put them in Challenge1.
Secondly, change the variable special_unit_spawned (Boolean) to be an array of how many challenges you want (in this case 5. Finally change the 'if' condition variable 'special_unit_spawned(x)' from a number within the array size.
For example challenge 1 would be special_unit_spawned(0), challenge 2 would be special_unit_spawned(1) etc.
The reason I didn't do Turn trigger off(this trigger) is because I put them all into the same trigger to save space. Turning the trigger off would of stopped the kill tracking.