I'm working on (yet another) line tower defense. I've made a nice row of units, with a region at the start. This region will move ahead one area whenever a next wave starts, in this way I intend to change the spawned unit types.
So I now have a region.
A row of units on the map.
How do I find out what unit is in the region when I'm for instance spawning a new unit on a trigger?
Last thing I tried was:
Unit - Create 1 (Unit type of (Unit attached to Region Enemy Wave Player 1)) for player 15 at (Center of Region Enemy Spawn Player 1) using default facing (No Options)
I have no clue what this attach thing is though, either way it's not working. What I'm looking for is an easy way to return the unit type of whatever is in my region.
(I've already thought of an enter region trigger for the region to change a variable and then using the variable to spawn the unit type, but it seems completely wasteful, especially since the trigger will keep happening since the unit will stay in there. Although I guess I could kill it when the wave starts.)
1. Go to the "Trigger Editor", press "Ctrl + B", you have now created a variable; name it to "Unit Type Spawned" or something. Next look to the right, you will see the settings for the Variable, set its "Type:" to "Unit Type".
2. Create a new trigger.
- Events: Timer - Elapsed time is 5.0 Game Time seconds
-Conditions: <NONE>
-Actions: Variable - Set Unit Type Spawned = Marine
(To do "Variable - Set Unit Type Spawned = Marine", simply create a new action in the trigger and use the function "Set Variable" which is the first action selected. After that add your variable "Unit Type Spawned" as Variable and a unit type for the "Value", I used Marine.)
3. Create a new trigger.
- Event Timer - Every 5.0 seconds of Game Time
- Conditions <NONE>
- Actions Unit - Create 1 Unit Type Spawned for player 1 at (Random point in (Entire map)) facing 270.0 degrees (No Options)
(When creating the action for this trigger you shall select your variable "Unit Type Spawned" as unit type, just do as you would assign a Unit Type, like a Marine for instance. But instead find your variable.")
I had some ideas for variable use, I guess I was just hoping for a nice function that queried for a unit inside a region and parsed the type back, so I could just use dynamic regions for my waves.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm working on (yet another) line tower defense. I've made a nice row of units, with a region at the start. This region will move ahead one area whenever a next wave starts, in this way I intend to change the spawned unit types.
So I now have a region. A row of units on the map.
How do I find out what unit is in the region when I'm for instance spawning a new unit on a trigger?
Last thing I tried was:
Unit - Create 1 (Unit type of (Unit attached to Region Enemy Wave Player 1)) for player 15 at (Center of Region Enemy Spawn Player 1) using default facing (No Options)
I have no clue what this attach thing is though, either way it's not working. What I'm looking for is an easy way to return the unit type of whatever is in my region.
(I've already thought of an enter region trigger for the region to change a variable and then using the variable to spawn the unit type, but it seems completely wasteful, especially since the trigger will keep happening since the unit will stay in there. Although I guess I could kill it when the wave starts.)
1. Go to the "Trigger Editor", press "Ctrl + B", you have now created a variable; name it to "Unit Type Spawned" or something. Next look to the right, you will see the settings for the Variable, set its "Type:" to "Unit Type".
2. Create a new trigger.
- Events: Timer - Elapsed time is 5.0 Game Time seconds
-Conditions: <NONE>
-Actions: Variable - Set Unit Type Spawned = Marine
(To do "Variable - Set Unit Type Spawned = Marine", simply create a new action in the trigger and use the function "Set Variable" which is the first action selected. After that add your variable "Unit Type Spawned" as Variable and a unit type for the "Value", I used Marine.)
3. Create a new trigger.
- Event Timer - Every 5.0 seconds of Game Time
- Conditions <NONE>
- Actions Unit - Create 1 Unit Type Spawned for player 1 at (Random point in (Entire map)) facing 270.0 degrees (No Options)
(When creating the action for this trigger you shall select your variable "Unit Type Spawned" as unit type, just do as you would assign a Unit Type, like a Marine for instance. But instead find your variable.")
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I hope that made sense to you, just follow the instructions and you'll be fine. You should learn to use variables, they are really funky! :)
Best Regards, Ice_bane @ B.net EU
I had some ideas for variable use, I guess I was just hoping for a nice function that queried for a unit inside a region and parsed the type back, so I could just use dynamic regions for my waves.