I already have a method for to continualy spawn units while having a unit in area, but it utilizes three different triggers below
______________________________________________________
MarineEnterSpawner P 1
Events
Unit - Any Unit Enters Player1SpawnerSpawn
Local Variables
Conditions
(Unit type of (Triggering unit)) == MarineSpawner
Actions
Variable - Set SpawnMarine P 1 = true
Trigger - Turn (Current trigger) On
MarineLeavesSpawner P 1
Events
Unit - Any Unit Leaves Player1SpawnerSpawn
Local Variables
Conditions
(Unit type of (Triggering unit)) == MarineSpawner
Actions
Variable - Set SpawnMarine P 1 = false
Trigger - Turn (Current trigger) On
_____________________________________________________________
MarineSpawning P 1
Events
Timer - Every 0.1 seconds of Game Time
Local Variables
Conditions
SpawnMarine P 1 == true
(Number of Living units in (Any units in (Entire map) owned by player 1 matching Excluded: Missile, Dead, Hidden, Invulnerable, with at most Any
Amount)) < 48
Actions
Unit - Create 1 Marine for player 1 at SpawnUnitsPoint P1 using point facing (No Options)
Trigger - Turn (Current trigger) On
________________________________________________________________________________________
But Three triggers for each unit each persons get rather tedious fast, any one care to share a trigger set that enables continuous spawning while unit is in region? (Spawn=Create Unit)
Condition==
unit type of [triggering unit] = [marine spawner]
your current units in region less than < 48 (and add this one)
Comparison
Value 1: Number Of Units In Unit Group
Type: Living
Unit Group: Units In Region Matching Condition
Unit Type: YOUR MARINE SPAWNER UNIT
Region: YOUR MARINE SPAWNER REGION
Player: 2
Unit Filter: Excluded: Missile, Dead, Hidden, Invulnerable
Count: Any Amount
Operator: ==
Value 2: 1
Action ==
if then else:
if:
Comparison
Value 1: Number Of Units In Unit Group
Type: Living
Unit Group: Units In Region Matching Condition
Unit Type: YOUR MARINE SPAWNER UNIT
Region: YOUR MARINE SPAWNER REGION
Player: 2
Unit Filter: Excluded: Missile, Dead, Hidden, Invulnerable
Count: Any Amount
Operator: ==
Value 2: 1
then
unit create 1 [marine] for [triggering player] at spawnregion
wait 1 [REALTIME] second
run trigger [nameofthistrigger]
else:
skip remaining actions
So every 1 second it will re-run the trigger, each time checking the amount of units is less than 48, if the dude is still in the spawner region ... if he is itll then spawn unit else itll just stop the loop.
Comparison
Value 1: Number Of Units In Unit Group
Type: Living
Unit Group: Units In Region Matching Condition
Unit Type: Any
Region: Entire Map
Player: 2
Unit Filter: Excluded: Missile, Dead, Hidden, Invulnerable
Count: Any Amount
Operator: <
Value 2: 48
I'm actually already using that conditon elsewhere and i never realized I could be using that for my spawning >.> Thanks a ton, you saved me hours of extra clicking "Replace This"
yeah use:
Comparison
Value 1: Number Of Units In Unit Group
Type: Living
Unit Group: Units In Region Matching Condition
Unit Type: YOUR MARINE SPAWNER UNIT
Region: YOUR MARINE SPAWNER REGION
Player: 2
Unit Filter: Excluded: Missile, Dead, Hidden, Invulnerable
Count: Any Amount
Operator: ==
Value 2: 1
I updated the above post to make it easier to read also. :D
Hmm, I'm gonna set up arrays, but when using them, I know that in programming an array starts at 0 instead of one so when it returns triggering player (say 1) will it call the first option in array or the second? I could either put dummy into 0 blank or put triggering player minus one in the call. Either way, ill find out when it does /doesnt work or spawns units for wrong person =P
In otherwords, I don't know if ScIIEditor does it atuomaticaly in transition from galaxy or not
You are right that it starts with 0 but in most cases you will set your variables by player number so set variable name[playernumber] = player1name will still be 1. So its alot easier in my opinion to just skip the 0.
For instance:
Pick each player in player group [active player] and:
- Set variable playername[picked player] = nameof[pickedplayer]
Hmm, Something was bugging me about that, and thats if a unit leaves/reenters quickly while the trigger is waiting, it wont spawn even though unit is in region.
The event, would only retrigger the trigger if a unit enters
also if conditions arent met, the run this trigger after 1 second wont be activated, so after max pop (48)m is achieved, if a unit dies it wouldnt spawn another unit
Rather, Using periodic game time event wouldnt work either because It would remove triggering player which would void the use of an array
Because I have separate areas in which players select which units to spawn, there is no need for a triggering player to choose an array of regions because each triggering region would be set to one player.
Therefore, I can still trim this down to one trigger, but one to each player for each unit, not one for all players per unit.
By using game time to activate the trigger, I have condition to check if correct unit is in area, then spawn unit and reactivate the trigger to be activated again.
The trigger format you posted kept bothering me, because I think I had thought of that before only to realize the error in it >.>
EDIT: I keep trying to find a way to incorporate arrays into it, but since the only triggering something is game time, and not possible to use "unit in region" event (is it possible to make custom events?) I simply can't think of anyway to have a changing variable to choose an array spot.
Hmm, It seems I can put EVERYTHING into same trigger, although its a one IF then else If with each being a huge Switch Statement... I love switch statements
I need to let go of my bad habits from AoE2 mapmaking....
I was going to make 110 triggers for my map, but with if statements and such, I can do the entire thing in two triggers. its only a 550% Trigger reduction.. no big deal...
I already have a method for to continualy spawn units while having a unit in area, but it utilizes three different triggers below
______________________________________________________
MarineEnterSpawner P 1
Events
Unit - Any Unit Enters Player1SpawnerSpawn
Local Variables
Conditions
(Unit type of (Triggering unit)) == MarineSpawner
Actions
Variable - Set SpawnMarine P 1 = true
Trigger - Turn (Current trigger) On
_________________________________________________________
MarineLeavesSpawner P 1
Events
Unit - Any Unit Leaves Player1SpawnerSpawn
Local Variables
Conditions
(Unit type of (Triggering unit)) == MarineSpawner
Actions
Variable - Set SpawnMarine P 1 = false
Trigger - Turn (Current trigger) On
_____________________________________________________________
MarineSpawning P 1
Events
Timer - Every 0.1 seconds of Game Time
Local Variables
Conditions
SpawnMarine P 1 == true
(Number of Living units in (Any units in (Entire map) owned by player 1 matching Excluded: Missile, Dead, Hidden, Invulnerable, with at most Any
Amount)) < 48
Actions
Unit - Create 1 Marine for player 1 at SpawnUnitsPoint P1 using point facing (No Options)
Trigger - Turn (Current trigger) On
________________________________________________________________________________________
But Three triggers for each unit each persons get rather tedious fast, any one care to share a trigger set that enables continuous spawning while unit is in region? (Spawn=Create Unit)
Event==
[Any unit] enters [unitspawning region]
Condition==
unit type of [triggering unit] = [marine spawner]
your current units in region less than < 48 (and add this one)
Comparison
Value 1: Number Of Units In Unit Group
Type: Living
Unit Group: Units In Region Matching Condition
Unit Type: YOUR MARINE SPAWNER UNIT
Region: YOUR MARINE SPAWNER REGION
Player: 2
Unit Filter: Excluded: Missile, Dead, Hidden, Invulnerable
Count: Any Amount
Operator: ==
Value 2: 1
Action ==
if then else:
if:
Comparison
Value 1: Number Of Units In Unit Group
Type: Living
Unit Group: Units In Region Matching Condition
Unit Type: YOUR MARINE SPAWNER UNIT
Region: YOUR MARINE SPAWNER REGION
Player: 2
Unit Filter: Excluded: Missile, Dead, Hidden, Invulnerable
Count: Any Amount
Operator: ==
Value 2: 1
then
unit create 1 [marine] for [triggering player] at spawnregion
wait 1 [REALTIME] second
run trigger [nameofthistrigger]
else:
skip remaining actions
So every 1 second it will re-run the trigger, each time checking the amount of units is less than 48, if the dude is still in the spawner region ... if he is itll then spawn unit else itll just stop the loop.
===========
1 trigger
@Torrak:
I so dumb
Comparison
Value 1: Number Of Units In Unit Group
Type: Living
Unit Group: Units In Region Matching Condition
Unit Type: Any
Region: Entire Map
Player: 2
Unit Filter: Excluded: Missile, Dead, Hidden, Invulnerable
Count: Any Amount
Operator: <
Value 2: 48
I'm actually already using that conditon elsewhere and i never realized I could be using that for my spawning >.> Thanks a ton, you saved me hours of extra clicking "Replace This"
@Feldeat: Go
yeah use:
Comparison
Value 1: Number Of Units In Unit Group
Type: Living
Unit Group: Units In Region Matching Condition
Unit Type: YOUR MARINE SPAWNER UNIT
Region: YOUR MARINE SPAWNER REGION
Player: 2
Unit Filter: Excluded: Missile, Dead, Hidden, Invulnerable
Count: Any Amount
Operator: ==
Value 2: 1
I updated the above post to make it easier to read also. :D
@Torrak:
Hmm, I'm gonna set up arrays, but when using them, I know that in programming an array starts at 0 instead of one so when it returns triggering player (say 1) will it call the first option in array or the second? I could either put dummy into 0 blank or put triggering player minus one in the call. Either way, ill find out when it does /doesnt work or spawns units for wrong person =P
In otherwords, I don't know if ScIIEditor does it atuomaticaly in transition from galaxy or not
@Feldeat: Go
You are right that it starts with 0 but in most cases you will set your variables by player number so set variable name[playernumber] = player1name will still be 1. So its alot easier in my opinion to just skip the 0.
For instance:
Pick each player in player group [active player] and:
- Set variable playername[picked player] = nameof[pickedplayer]
Or kill counter:
-modify variable uKills[ownerofkillingunit] + 1
Hmm, Something was bugging me about that, and thats if a unit leaves/reenters quickly while the trigger is waiting, it wont spawn even though unit is in region.
The event, would only retrigger the trigger if a unit enters
also if conditions arent met, the run this trigger after 1 second wont be activated, so after max pop (48)m is achieved, if a unit dies it wouldnt spawn another unit
Rather, Using periodic game time event wouldnt work either because It would remove triggering player which would void the use of an array
Because I have separate areas in which players select which units to spawn, there is no need for a triggering player to choose an array of regions because each triggering region would be set to one player.
Therefore, I can still trim this down to one trigger, but one to each player for each unit, not one for all players per unit.
By using game time to activate the trigger, I have condition to check if correct unit is in area, then spawn unit and reactivate the trigger to be activated again.
The trigger format you posted kept bothering me, because I think I had thought of that before only to realize the error in it >.>
EDIT: I keep trying to find a way to incorporate arrays into it, but since the only triggering something is game time, and not possible to use "unit in region" event (is it possible to make custom events?) I simply can't think of anyway to have a changing variable to choose an array spot.
Hmm, It seems I can put EVERYTHING into same trigger, although its a one IF then else If with each being a huge Switch Statement... I love switch statements
I need to let go of my bad habits from AoE2 mapmaking....
I was going to make 110 triggers for my map, but with if statements and such, I can do the entire thing in two triggers. its only a 550% Trigger reduction.. no big deal...