Hey all, I'm trying to make a system of copying a single order from one unit, to all other units of that type.
For instance if, one marine is given an order to "Move" then all other marines owned by that player are given the same order
I'm wondering if there is anyway to set it up to avoid having to make a separate trigger for every different ability.
at the moment I have the Event
Unit - Any Unit uses Move at Generic 1 - Any Stage(Ignore shared Abilities)
Make one event for each ability and use a Switch function in actions, basing the Switch function on "Triggering Ability." Then just make a case for each ability you listed.
I would NOT recommend doing this through triggers:
- your unit is given an order to move (no problem so far)
- then your trigger runs as many times as there are units of the same type in the whole map, which means potentially 200 instances of your trigger for just one click! (just imagine how micro-managing your unit would cause mayhem)
- each unit being given the order to move by the trigger, will trigger it themselves because they are also using the ability to move at any stage.
- basically, the number of orders given is going exponentially higher and higher.
- any PC would crash here
- ...
- profit
True, if all marines were capable of triggering the event with a move order it would cause substantial lag (and loop over itself if the other marines were given the same order.) If you're going to do this by triggers, either use a specific unit or make a different ability that only one unit has and set the event to that ability. I don't know enough about the OP's map to say which way would be better.
OK so I simplified the senario a bit, and I've already solved the problem of "marine was given move" move marine, moved marines were given "move" move all marines.
basiclly I'm working on a squad system, and I have it set up so that only the "squad leaders" can be given orders, but I want when something like "blink" is given all other members of the squad are given that order to.
I guess I just have to make a seperate trigger for each ability >.<
Make one event for each ability and use a Switch function in actions, basing the Switch function on "Triggering Ability." Then just make a case for each ability you listed.
Im wondering... Why not just force select the entire squad? "Any unit is selected", figure out which squad its in (easily done with a loop), then add the rest of the squad to the players selection. That way all orders will be issued to the entire group of units (Ok, there are some abilities where only a single unit uses it, like Infested Terrans, but that can be easily modified)
Why do you use the "uses ability" event? There should be a "receives Order" event, and you should be able to issue the triggering order to other units directly. You might need a switch for different kinds of orders (target unit, target point, no target), an adjustment for the order target point, so the squad does not try to stack up at one point, and some method to prevent recursion.
I really like this idea, one problem I have trying it out is that If i select the units, and then click on of them again, I'm able to select a single unit and order it seperatly from the rest of them.
-Edit- after testing around a bit more with the forcing the selection of the squad, I can't seem to figure out how to fix this one little oddity, if you have none of the units selected it works fine, but if you select some members of the squad again either by clicking him individually or by boxing a portion, the trigger doesn't reselect the whole squad as expected.
Don't use the unit selection suggestion because on B-net there will be a delay and orders won't execute for all units within a second or so of selecting.
Instead of using Unit Uses Ability event use the Unit is Issued Order event like Kueken suggests. This will allow you to put everything on the same trigger by using an If Then Else-If function that can check for the ability ordered and/or type of the commander unit you're using.
Ok then how can I distinguish between "shift qued" orders, and non shift qued orders. with the old way of doing things I had a boolean flag for when the shift key was down or not and if it was down orders got put at the end of the order que, otherwise they replaced current orders.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey all, I'm trying to make a system of copying a single order from one unit, to all other units of that type. For instance if, one marine is given an order to "Move" then all other marines owned by that player are given the same order I'm wondering if there is anyway to set it up to avoid having to make a separate trigger for every different ability.
at the moment I have the Event
Unit - Any Unit uses Move at Generic 1 - Any Stage(Ignore shared Abilities)
Make one event for each ability and use a Switch function in actions, basing the Switch function on "Triggering Ability." Then just make a case for each ability you listed.
I would NOT recommend doing this through triggers:
- your unit is given an order to move (no problem so far)
- then your trigger runs as many times as there are units of the same type in the whole map, which means potentially 200 instances of your trigger for just one click! (just imagine how micro-managing your unit would cause mayhem)
- each unit being given the order to move by the trigger, will trigger it themselves because they are also using the ability to move at any stage.
- basically, the number of orders given is going exponentially higher and higher.
- any PC would crash here
- ...
- profit
True, if all marines were capable of triggering the event with a move order it would cause substantial lag (and loop over itself if the other marines were given the same order.) If you're going to do this by triggers, either use a specific unit or make a different ability that only one unit has and set the event to that ability. I don't know enough about the OP's map to say which way would be better.
OK so I simplified the senario a bit, and I've already solved the problem of "marine was given move" move marine, moved marines were given "move" move all marines.
basiclly I'm working on a squad system, and I have it set up so that only the "squad leaders" can be given orders, but I want when something like "blink" is given all other members of the squad are given that order to.
I guess I just have to make a seperate trigger for each ability >.<
Im wondering... Why not just force select the entire squad? "Any unit is selected", figure out which squad its in (easily done with a loop), then add the rest of the squad to the players selection. That way all orders will be issued to the entire group of units (Ok, there are some abilities where only a single unit uses it, like Infested Terrans, but that can be easily modified)
Why do you use the "uses ability" event? There should be a "receives Order" event, and you should be able to issue the triggering order to other units directly. You might need a switch for different kinds of orders (target unit, target point, no target), an adjustment for the order target point, so the squad does not try to stack up at one point, and some method to prevent recursion.
@TheAlmaity: Go
I really like this idea, one problem I have trying it out is that If i select the units, and then click on of them again, I'm able to select a single unit and order it seperatly from the rest of them.
-Edit- after testing around a bit more with the forcing the selection of the squad, I can't seem to figure out how to fix this one little oddity, if you have none of the units selected it works fine, but if you select some members of the squad again either by clicking him individually or by boxing a portion, the trigger doesn't reselect the whole squad as expected.
@BootleZoke: Go
Don't use the unit selection suggestion because on B-net there will be a delay and orders won't execute for all units within a second or so of selecting.
Instead of using Unit Uses Ability event use the Unit is Issued Order event like Kueken suggests. This will allow you to put everything on the same trigger by using an If Then Else-If function that can check for the ability ordered and/or type of the commander unit you're using.
Ok then how can I distinguish between "shift qued" orders, and non shift qued orders. with the old way of doing things I had a boolean flag for when the shift key was down or not and if it was down orders got put at the end of the order que, otherwise they replaced current orders.