Hey!
Been playing around with triggers for a couple of days but cant get some things to work.
Lets say you have a barrack on the map and train a marine in the beggining. How do you make that unit move to a region when a new trigger start(timer hit 0). Ive tried move last created unit to region but that doesnt work.
Also when a timer start and you make it show a timer bar, how do you remove that when the timer stop? Cause i want the upcoming timer to take it place. Right now all timer bars stay visible and i get à whole bunch of useless bars showing "0".
@move units
You can get the units that are within a region in a unit group. You have to go through all units within that group and perform the actions for each one of them.
@timer window
I think you can destroy them. You might need to use a global variable (in the left list) to save a reference to the timer window. At least you can hide them for sure.
Thank you for a fast reply!
So i have to make a new region over the whole map and choose condotions like player1, got ability stimpack etc?
About the timer. Ive made global, but under the show/hide timer bar and destroy timer bar i cant choose any specific timer. All i got is last created timer. And cause the timer have stoped it cant find last created timer.
I got the timer to work.
The unit to region wont work tho. When the game start I make a timer for x sec and set action to create a marine for me. When the timer is 0 I do a if-then-else action.
if - my last created unit is still alive.
Then - move to region X
else - create last created unit in region X
hmm, dunno whats wrong!? Please help me! :)
edit: fixed the dialog thing, but the unit move still bugs me :(
@Lucyher: Go
"Last created unit" is a reference to the last created unit that has been created directly with a trigger action.
in pseudocode you do the following for your move-trigger:
Event: myTimer runs out
Variables:
- unit (unit) = no unit
- unitGroup (Unit Group) = empty unit group
Actions:
- set variable: unitGroup = All units in region 'myRegionWhereBarracksIs' matching conditions: 'someFilterOptionsThatExcludeBuildingsAndHiddenAndDead'
- For every 'unit' in 'unitGroup' do the following actions:
- - - move 'unit' to randomPointInRegion('destinationRegion')
I get the move to work now, thnx!
But now I wanna add if the unit have died along that timer it should create the same unit the player picked in the dialog in the matchstart.
unit choose:
..........alot of if-then-do actions
..........camera pan
..........unit group - add (last created unit) for player 1 to p1
timer stop:
.....if-then-do
..........if: owner of (unit 1 from p1) = 1
.............and condition: (unit 1 from p1 is alive = true)
..........then: unit - move (unit 1 from p1) to regionX
..................camera pan
..........else: unit - create 1 (unit type of (unit 1 from p1)) for player 1 at regionX
..................camera pan
Can someone help me with what im doin wrong? As I said, move works fine now but not create :(
also i can't sift through what you said, but let me just say how i would do it....
every zero point something 0.X seconds
ACTIONS: add all units in region for player 1 to unit group for player 1 (this i'm not sure if it's right, but i'm sure there's a way to add for a specific player, not just alliances)
IF: if unit of unit group for player 1 is alive
THEN: move unit for unit group of player 1 to center or random point in region
IF: if unit blah play 1 is not alive
THEN: create 1 unit for blah player 1 at point in front of barracks
add last created unit to unit group for player 1
remove player 1 unit from player 1 unit group
SAME THING FOR PLAYER 2
EDIT: also ALSO as for the timer window thing... make a timer variable... start that timer variable... create a timer window, set last created timer window to = ANOTHER variable. after you start timer, set timer for the given timer window variable to that timer, and when another timer starts, set the timer for timer window to the next timer. if you just need to change the text for the timer, just set title/text/whatever for timer window
Hey! Been playing around with triggers for a couple of days but cant get some things to work. Lets say you have a barrack on the map and train a marine in the beggining. How do you make that unit move to a region when a new trigger start(timer hit 0). Ive tried move last created unit to region but that doesnt work.
Also when a timer start and you make it show a timer bar, how do you remove that when the timer stop? Cause i want the upcoming timer to take it place. Right now all timer bars stay visible and i get à whole bunch of useless bars showing "0".
Thanks. Lucy
@move units You can get the units that are within a region in a unit group. You have to go through all units within that group and perform the actions for each one of them.
@timer window I think you can destroy them. You might need to use a global variable (in the left list) to save a reference to the timer window. At least you can hide them for sure.
@Ahli634: Go
Thank you for a fast reply! So i have to make a new region over the whole map and choose condotions like player1, got ability stimpack etc?
About the timer. Ive made global, but under the show/hide timer bar and destroy timer bar i cant choose any specific timer. All i got is last created timer. And cause the timer have stoped it cant find last created timer.
I got the timer to work. The unit to region wont work tho. When the game start I make a timer for x sec and set action to create a marine for me. When the timer is 0 I do a if-then-else action. if - my last created unit is still alive. Then - move to region X else - create last created unit in region X
hmm, dunno whats wrong!? Please help me! :)
edit: fixed the dialog thing, but the unit move still bugs me :(
@Lucyher: Go "Last created unit" is a reference to the last created unit that has been created directly with a trigger action.
in pseudocode you do the following for your move-trigger:
Event: myTimer runs out
Variables:
- unit (unit) = no unit
- unitGroup (Unit Group) = empty unit group
Actions:
- set variable: unitGroup = All units in region 'myRegionWhereBarracksIs' matching conditions: 'someFilterOptionsThatExcludeBuildingsAndHiddenAndDead'
- For every 'unit' in 'unitGroup' do the following actions:
- - - move 'unit' to randomPointInRegion('destinationRegion')
@Ahli634: Go
FInally got it to work! Thnx. But now to another problem :) If there is 2 or more players? How do I make em pick a unit to their group?
Create an if then statement. Then set condition to (Unit variable) = (Player). Make two of these if then statements, one for each player.
I get the move to work now, thnx! But now I wanna add if the unit have died along that timer it should create the same unit the player picked in the dialog in the matchstart.
unit choose:
..........alot of if-then-do actions
..........camera pan
..........unit group - add (last created unit) for player 1 to p1
timer stop:
.....if-then-do
..........if: owner of (unit 1 from p1) = 1
.............and condition: (unit 1 from p1 is alive = true)
..........then: unit - move (unit 1 from p1) to regionX
..................camera pan
..........else: unit - create 1 (unit type of (unit 1 from p1)) for player 1 at regionX
..................camera pan
Can someone help me with what im doin wrong? As I said, move works fine now but not create :(
Bump
Bump
...you're welcome :D
also i can't sift through what you said, but let me just say how i would do it....
every zero point something 0.X seconds
ACTIONS: add all units in region for player 1 to unit group for player 1 (this i'm not sure if it's right, but i'm sure there's a way to add for a specific player, not just alliances)
IF: if unit of unit group for player 1 is alive
THEN: move unit for unit group of player 1 to center or random point in region
IF: if unit blah play 1 is not alive
THEN: create 1 unit for blah player 1 at point in front of barracks
add last created unit to unit group for player 1
remove player 1 unit from player 1 unit group
SAME THING FOR PLAYER 2
EDIT: also ALSO as for the timer window thing... make a timer variable... start that timer variable... create a timer window, set last created timer window to = ANOTHER variable. after you start timer, set timer for the given timer window variable to that timer, and when another timer starts, set the timer for timer window to the next timer. if you just need to change the text for the timer, just set title/text/whatever for timer window
good luck
Thanks alot all! Finally got it to work with some "cheating".