I felt like trying something out, so I am going to make a baneling pit. I know this is possible, but how do I make a unit spawn underground? The unit then must unburrow and leave the region (the pit). How cool would this be if I got it working and how could I use it? Posted in triggers because it is basically an all trigger project to make it.
Unit - Create 1 Baneling (Burrowed) for player 1 at (Center of Region 001) facing 270.0 degrees (No Options)
Unit - Order (Last created unit) to (Baneling - Unburrow) (Replace Existing Orders)
Unit - Order (Last created unit) to (Move targeting (Point(0.0, 0.0))) (Replace Existing Orders)
I believe something like that should do the trick.
You could add a rally point from a structure to control where the banelings go specifically, or specify specific points. The other option of course is to have it choose random points on the map to run to after they spawn - depending on how you want the map to be set up.
Personally, I would say you should have several possible targets to run to - and then just randomize which one each spawned baneling should run to each time.
Actually - if you don't need them to burrow again, then you don't need to have it upgraded (as long as you create a burrowed one in the first place) - it will be able to unburrow, but not re-burrow.
Secondly, I can't seem to get the move, or the attack/attack(redirect) order to work. Anyone know why? I tried both Replace Existing Orders and After Existing Orders but they just spawn, then unburrow.
Unit - Create 1 Baneling (Burrowed) for player 1 at (Center of Region 001) facing 270.0 degrees (No Options)
Unit - Order (Last created unit) to (Baneling - Unburrow) (Replace Existing Orders)
Order (Unit 1 from (Baneling units in regionSpawningPit owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) to ( Attak targeting (Center of globalZones[(Random integer between 1 and 4)])) (After Existing Orders)
===================================
It seems to be ordering the baneling to attack once the next time the trigger fires... so there's a little lapse there. Is it just because of how fast the trigger is firing? or something else do you think?
It might be more accurate to do something like this:
Event: Unit uses ability Unburrow
Condition: Unit type of triggering unit = baneling
Action: Pick each unit in Units in (circle: position of triggering unit, radius 9) matching (blahblahblah)
- - - If
- - - - - - Owner of Picked unit != owner of triggering unit (or if owner of picked unit is an enemy of owner of triggering unit, however you want to set it up)
- - - Then
- - - - - - Order triggering unit to attack picked unit
Well I was thinking about Event: Unit uses ability Unburrow
and that seems like you then have to re-clarify what you're looking for later on in the trigger. Units inside of the specific region, that match conditions, that are owned by the right players... which means it checks all that every time a baneling anywhere on the map uses unburrow.
What about something like Unit enters/leaves region so at least it's restricted to a smaller region and units outside of the spawning pit don't trigger the trigger?
It's an action. Pick each unit in unit group (Units in region matching condition.) The region is the function called "convert circle to region," which creates a local region around a point in a circle shape with a size you specify. The point is the baneling. For the matching conditions, just set that to exclude things like missiles, dead, hidden, etc.
@playpong:
That might work too, and you could use a circle region around the pit (if it's a unit.) I'm not sure whether morphing units count as entering regions though.
I actually managed to make a baneling pit! They also attack the unit closest to the bane as well! Now I gotta find a good way to use the thing, hmmmmm.
Still need to test some things to make sure the attack is working.
I felt like trying something out, so I am going to make a baneling pit. I know this is possible, but how do I make a unit spawn underground? The unit then must unburrow and leave the region (the pit). How cool would this be if I got it working and how could I use it? Posted in triggers because it is basically an all trigger project to make it.
Unit - Create 1 Baneling (Burrowed) for player 1 at (Center of Region 001) facing 270.0 degrees (No Options)
Unit - Order (Last created unit) to (Baneling - Unburrow) (Replace Existing Orders)
Unit - Order (Last created unit) to (Move targeting (Point(0.0, 0.0))) (Replace Existing Orders)
I believe something like that should do the trick.
You could add a rally point from a structure to control where the banelings go specifically, or specify specific points. The other option of course is to have it choose random points on the map to run to after they spawn - depending on how you want the map to be set up.
Personally, I would say you should have several possible targets to run to - and then just randomize which one each spawned baneling should run to each time.
You might also have to make sure that the owner of the burrowed baneling that spawns has burrow upgraded
@Zarakk: Go
Yeah, a quick data change will fix that. If not, a research trigger with the upgrade free will work.
Actually - if you don't need them to burrow again, then you don't need to have it upgraded (as long as you create a burrowed one in the first place) - it will be able to unburrow, but not re-burrow.
Secondly, I can't seem to get the move, or the attack/attack(redirect) order to work. Anyone know why? I tried both Replace Existing Orders and After Existing Orders but they just spawn, then unburrow.
@playpong: Go
The order won't work because the unburrow ability is a morph. Basically, it's no longer the baneling you started with.
@BasharTeg: Go
Well then what about something like "pick each unit in region" with specifics that unit is a bane and issue attack order to some random point?
@Reaper872: Go
Yep, here's something that works:
Timer - Every 5.0 seconds of Game Time
===================================
Unit - Create 1 Baneling (Burrowed) for player 1 at (Center of Region 001) facing 270.0 degrees (No Options)
Unit - Order (Last created unit) to (Baneling - Unburrow) (Replace Existing Orders)
Order (Unit 1 from (Baneling units in regionSpawningPit owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) to ( Attak targeting (Center of globalZones[(Random integer between 1 and 4)])) (After Existing Orders)
=================================== It seems to be ordering the baneling to attack once the next time the trigger fires... so there's a little lapse there. Is it just because of how fast the trigger is firing? or something else do you think?
@Reaper872: Go
It might be more accurate to do something like this:
Event: Unit uses ability Unburrow
Condition: Unit type of triggering unit = baneling
Action: Pick each unit in Units in (circle: position of triggering unit, radius 9) matching (blahblahblah)
- - - If
- - - - - - Owner of Picked unit != owner of triggering unit (or if owner of picked unit is an enemy of owner of triggering unit, however you want to set it up)
- - - Then
- - - - - - Order triggering unit to attack picked unit
- - - Else
- - - - - - (nothing)
Should work.
I'm having trouble isuing an order to a picked unit to attack the closest enemy to where the picked unit is. Ideas please?
Edit: thanks guys, going to experiment with it.
is there a way to strictly refer to events in certain areas?
EDIT:: rather than checking the specifics of the event after it happens and then acting accordingly
@Reaper872: Go
You can calculate the distance between two units using two variables and a For Each Units In Region loop:
Make one variable a Real (it can be a local variable.) We'll call it DistanceVar. Make the other variable a Unit. We'll call it UnitVar.
Action: For each unit UnitVar in (circle: an area around the baneling)
If
Distance between UnitVar and [baneling] < DistanceVar
Then
Set DistanceVar = Distance between [baneling] and UnitVar
Outside of the loop, execute the attack action on UnitVar.
EDIT: Oh, make sure you set DistanceVar to some number greater than the maximum range you're checking for before you initiate the loop.
@playpong: What do you mean by "events?"
@BasharTeg: Go
Sorry, don't really get the "Action: Pick each unit in Units in (circle: position of triggering unit, radius 9) matching (blahblahblah)" part...
@Reaper872:
Well I was thinking about Event: Unit uses ability Unburrow
and that seems like you then have to re-clarify what you're looking for later on in the trigger. Units inside of the specific region, that match conditions, that are owned by the right players... which means it checks all that every time a baneling anywhere on the map uses unburrow.
What about something like Unit enters/leaves region so at least it's restricted to a smaller region and units outside of the spawning pit don't trigger the trigger?
@Reaper872: Go
It's an action. Pick each unit in unit group (Units in region matching condition.) The region is the function called "convert circle to region," which creates a local region around a point in a circle shape with a size you specify. The point is the baneling. For the matching conditions, just set that to exclude things like missiles, dead, hidden, etc.
@playpong:
That might work too, and you could use a circle region around the pit (if it's a unit.) I'm not sure whether morphing units count as entering regions though.
I actually managed to make a baneling pit! They also attack the unit closest to the bane as well! Now I gotta find a good way to use the thing, hmmmmm.
Still need to test some things to make sure the attack is working.