I would like to use a trigger using a unit type but I can't work it out without using the limiting "grab unit" function and I haven't been able to find any functions that use a unit type variable or find sufficient information to solve my problem. I'd like to know how to use unit types. For example:
Events
Any unit enters region (position of unit of (mysterious unit type function)* that somehow belongs to player 2)
*any unit preset doesn't exist in this context. Thus I don't begin to know of any condition solution.
Conditions
Triggering Unit belongs to player 1
Triggering Unit is Annihilator
Events
Order Triggering Unit to (...Shadow Cannon... targeting unit of (mysterious unit type function) before existing orders)
If you're trying to have an event to the effect of "Any unit enters range of any unit", as far as I know you'd have to have something like a behavior on each unit with a periodic search effect or the like and have the trigger check for the impact effect.
You could also change the Shadow Cannon ability to autocast, if that's all you need to have happen.
Thanks for the tips! I just want the Annihilator to use its shadow cannon so getting the cannon to autocast would be good (hopefully it works). I've thought of a way to do this before putting the created annihilator into an attack wave (autocast caused it to stop moving towards the enemy base). However I'd still like to know if there is something to the effect of "unit of unit type" even if I have to use a unit type variable. I've already had to work around an apparent lack of one.
Here's another part that I had to work around using the "grab unit" function. A pylon is being guarded by four zealots and each time one dies it is replaced. At the end of the level a warp prism loads up the remaining four zealots. So I used the "Change owner" action with the "grab unit" function and "add unit to unit group" action to individually add each zealot to a unit group to be picked up by the warp prism. I am guessing there is a neater way of doing this.
That was my first post and I appreciate your patience with my noobiness.
That itself makes no sense, as there can be multiple units of a unit type. If you mean a unit group containing all units of a certain type that is pretty easy. If you mean a random unit of a unit type that is also easy, just a step up from the unit group using a pick random unit function. If you mean to run actions on all units of a unit type then that is also easy, get the unit group and put it in a unit group loop and run the action in the loop with the loop unit.
If this "Annihilator" is owned by AI then a tactical AI function could be written to fire its Shadow Cannon, much like how Ghosts fire Snipe or Vipers use their pull when owned by the AI. As long as the unit is part of an attack wave it will still progress towards the attack wave target while using all of its abilities as decided by the tactical AI functions.
Here's another part that I had to work around using the "grab unit" function. A pylon is being guarded by four zealots and each time one dies it is replaced. At the end of the level a warp prism loads up the remaining four zealots. So I used the "Change owner" action with the "grab unit" function and "add unit to unit group" action to individually add each zealot to a unit group to be picked up by the warp prism. I am guessing there is a neater way of doing this.
Deregister the bullies from the AI and then pick them with an area search from around the pylon and order them into the prism.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I would like to use a trigger using a unit type but I can't work it out without using the limiting "grab unit" function and I haven't been able to find any functions that use a unit type variable or find sufficient information to solve my problem. I'd like to know how to use unit types. For example:
Events
Any unit enters region (position of unit of (mysterious unit type function)* that somehow belongs to player 2)
*any unit preset doesn't exist in this context. Thus I don't begin to know of any condition solution.
Conditions
Triggering Unit belongs to player 1
Triggering Unit is Annihilator
Events
Order Triggering Unit to (...Shadow Cannon... targeting unit of (mysterious unit type function) before existing orders)
The event you are describing does not make any sense...
Please explain what you want the trigger should do. People could then suggest possible events, conditions and actions to implement it.
If you're trying to have an event to the effect of "Any unit enters range of any unit", as far as I know you'd have to have something like a behavior on each unit with a periodic search effect or the like and have the trigger check for the impact effect.
You could also change the Shadow Cannon ability to autocast, if that's all you need to have happen.
Custom Campaign Initiative | Mapster Community Project: Data Wizards
Starcraft II: Unsung Rebels, a custom campaign for Starcraft II
SC2Saver, a way to create saved games via trigger
Frustrated with the editor and would like answers in real time? Join the SC2Mapster Discord!
Thanks for the tips! I just want the Annihilator to use its shadow cannon so getting the cannon to autocast would be good (hopefully it works). I've thought of a way to do this before putting the created annihilator into an attack wave (autocast caused it to stop moving towards the enemy base). However I'd still like to know if there is something to the effect of "unit of unit type" even if I have to use a unit type variable. I've already had to work around an apparent lack of one.
Here's another part that I had to work around using the "grab unit" function. A pylon is being guarded by four zealots and each time one dies it is replaced. At the end of the level a warp prism loads up the remaining four zealots. So I used the "Change owner" action with the "grab unit" function and "add unit to unit group" action to individually add each zealot to a unit group to be picked up by the warp prism. I am guessing there is a neater way of doing this.
That was my first post and I appreciate your patience with my noobiness.
That itself makes no sense, as there can be multiple units of a unit type. If you mean a unit group containing all units of a certain type that is pretty easy. If you mean a random unit of a unit type that is also easy, just a step up from the unit group using a pick random unit function. If you mean to run actions on all units of a unit type then that is also easy, get the unit group and put it in a unit group loop and run the action in the loop with the loop unit.
If this "Annihilator" is owned by AI then a tactical AI function could be written to fire its Shadow Cannon, much like how Ghosts fire Snipe or Vipers use their pull when owned by the AI. As long as the unit is part of an attack wave it will still progress towards the attack wave target while using all of its abilities as decided by the tactical AI functions.
Deregister the bullies from the AI and then pick them with an area search from around the pylon and order them into the prism.