Page 1 of 1

Commanding a single unit

Posted: Wed Jul 26, 2017 7:29 pm
by edward77
Is it possible to give a single unit (not team) a command in the Script BSF file?
eg using SetCannotControl(id, value). The id values run from 0 upto 64(max) but how do they relate to the IDs in the squad file?

Re: Commanding a single unit

Posted: Wed Jul 26, 2017 7:59 pm
by pipfromslitherine
Anywhere you see a unit id required they are the id of a specific unit. This is not related to the squads file but to the specific unit on the map. You generally get a unit id using GetUnitID as they are not just [0,63] because they vary by side.

Cheers

Pip

Re: Commanding a single unit

Posted: Wed Jul 26, 2017 9:04 pm
by edward77
Thanks Pip for the quick reply. Yes its 0 to 63 max. But how do I know the id of a particular unit? I know the unit name, what side and what team each unit is in but how can I identify which one is 10 or which one is 17?

Re: Commanding a single unit

Posted: Thu Jul 27, 2017 12:34 pm
by rbodleyscott
edward77 wrote:Thanks Pip for the quick reply. Yes its 0 to 63 max. But how do I know the id of a particular unit? I know the unit name, what side and what team each unit is in but how can I identify which one is 10 or which one is 17?
There isn't an easy way of doing this. If you are trying to the stop the player from controlling it in the initial turns of the scenario, the easiest way to do it would be

id = GetUnitOnTile(x, y);

if you know the values for x and y that represent its starting location.