Selected units is basically global variable-like unit group. You can access it simply by going into 'unit selection' should be below unit group category.
There probably is a field that you can edit to change maximum unit selection in the Data Editor, but I can't find it, so here's a trigger version of it. I also attached a map with all of the triggers so you can easily copy and paste.
Notes: The unit limit isn't a permanent change, but just a work-around, meaning that putting that on Map Initialization for all players does nothing. You have to apply it every time a unit is selected for a player.
---
If you find a problem with my code or have any further questions, don't be afraid to reply back!
A follow up question, when more than for example 8 units are selected, the icons for the units gets messed up. At the bottom center of the screen you have a lots of rows with 8 slots in each. 8 units icons can fit in one row. You can see in the picture what I mean.
Try saving all of the selected units to unitgroup when selected and at the end of the trigger, use the "Select Unit Group" function when the excessive units are removed.
The triggers posted Kenneth are working exactly as you want them to. The thing that is messing it up is the instant selection after deselection. By adding a very short wait after deselection it will correctly deselect the units. Another thing is that the trigger is fires for every unit you select, I've fixed that by adding a global variable and setting it to true as soon as the trigger fires and changing it back to false again at the end of the trigger.
The only problem is that if a player select his army and A-moves immideately, a small delay occur. That delay prevents the order from being executed.
Example: I drag the cursor over my entire army. 16 units are selected and I A-move. The units do not get that order and just stands still. I have to wait ca 1 second after selection before I can give them an order.
I have adjusted the time values in the trigger. But if I lower the "Wait X Real time seconds" field to 0.001 seconds, the army gains an order immideately! The problem is that they don´t fit so nicely into the rows anymore. The icons get messed up, like before : /
Is there anyway to adjust the trigger so units can be ordered right after selection and still keep the icons organized in rows?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
How on earth can limited unit selection be added to a map?
I´ve seen some maps where players only can select, 1,5,10,12 units.
I suppose it is made with triggers, but when I look inside the maps, I can´t get access to see the triggers. Or perhaps is it some other method?
Selected units is basically global variable-like unit group. You can access it simply by going into 'unit selection' should be below unit group category.
There probably is a field that you can edit to change maximum unit selection in the Data Editor, but I can't find it, so here's a trigger version of it. I also attached a map with all of the triggers so you can easily copy and paste.
---Action Definition List:
1. Limit Unit Selection
Trigger List:
1. Player Selects Unit
---Limit Unit Selection
Player Selects Unit
---Notes: The unit limit isn't a permanent change, but just a work-around, meaning that putting that on Map Initialization for all players does nothing. You have to apply it every time a unit is selected for a player.
---If you find a problem with my code or have any further questions, don't be afraid to reply back!
Happy coding :D
A follow up question, when more than for example 8 units are selected, the icons for the units gets messed up. At the bottom center of the screen you have a lots of rows with 8 slots in each. 8 units icons can fit in one row. You can see in the picture what I mean.
Is there anyway this can be adjusted?
And of course, thanks a lot for the trigger!!
Bump!
Anyone knows how to fix this?
The only idea I got, how it could work, is deselecting the units and selecting them again in the same trigger...
If you select another control group and switch back to the first one, these gaps disappear I believe... so that should work with triggers, too.
Maybe you need a wait, but that would mean that the player has no units selected for a game frame...
Try saving all of the selected units to unitgroup when selected and at the end of the trigger, use the "Select Unit Group" function when the excessive units are removed.
Thank you for so quick replies!
I suck extremely hard at the trigger editor. Would you mind adding it to the end of the trigger and just save the map and reupload it?
(I know its a bold question.. But I just want this trigger to work flawless and I do not have the skills to fix it myself T_T)
The triggers posted Kenneth are working exactly as you want them to. The thing that is messing it up is the instant selection after deselection. By adding a very short wait after deselection it will correctly deselect the units. Another thing is that the trigger is fires for every unit you select, I've fixed that by adding a global variable and setting it to true as soon as the trigger fires and changing it back to false again at the end of the trigger.
Thank you for your trigger. It looks much better!
The only problem is that if a player select his army and A-moves immideately, a small delay occur. That delay prevents the order from being executed.
Example: I drag the cursor over my entire army. 16 units are selected and I A-move. The units do not get that order and just stands still. I have to wait ca 1 second after selection before I can give them an order.
I have adjusted the time values in the trigger. But if I lower the "Wait X Real time seconds" field to 0.001 seconds, the army gains an order immideately! The problem is that they don´t fit so nicely into the rows anymore. The icons get messed up, like before : /
Is there anyway to adjust the trigger so units can be ordered right after selection and still keep the icons organized in rows?