Jump to content
Teutch

Groupe spawning as playable and subjected to high command

Recommended Posts

Hello,

 

I would like to make my groupe spawn as playable units and that can be controled by the high command module.

 

The group is able to spawn, but when I add the last two lines there is an error and I don't know what it is :

 

_group1 = [getMarkerPos "marker_0", WEST, (configfile >> "CfgGroups" >> "WEST" >> "FRANCE_Faction" >> "Infantry" >> "o_francefaction_infantry_squad")] call BIS_fnc_spawnGroup;
_group1 setPlayable true;
doHighCommand _group1;

 

what have I done wrong ?

 

Thank you in advance !

Share this post


Link to post
Share on other sites

Hi,
_group1 setPlayable true; is 1) wrong syntax of the command - should be setPlayable unit and 2) is a broken command and in Arma 3 does nothing
the thing you have to do for making this work is use forEach loop and use addSwitchableUnit command.
 

{addSwitchableUnit _x} forEach units _group1;

doHighCommand _group1; This command doesn't exist
to add group to high command use command hcSetGroup
 

GloriousLeader hcSetGroup [_group1];

Personally i haven't tried it but i hope i managed to point you to right direction 🙂
Everything about commands syntax can be read on Biki

 

*Edit

Actually addSwitchableUnit description states it's for singleplayer only (haven't noticed it before), so I'm not sure if it's possible to do this in multiplayer. You can always try 🙂 I don't see any other command that is able to do it otherwise.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks soldierXXXX it works perfectly well !

 

I wonder if it could also be possible to add these two options not to a group but to a vehicle and its crew ?

 

_vehicleGroup = createVehicle [vehiculename, getMarkerPos "marker_20", [], 0, "NONE"];

createVehicleCrew _vehicleGroup;

Share this post


Link to post
Share on other sites

It's possible with just a little tweak. You always need to refer to group. These commands demand it.

_vehicle = createVehicle [vehiculename, getMarkerPos "marker_20", [], 0, "NONE"];

_vehicleGroup = createVehicleCrew _vehicle;

And do the same as above.

  • Like 1

Share this post


Link to post
Share on other sites
22 hours ago, Teutch said:

I would like to make my groupe spawn as playable units and that can be controled by the high command module.
 

 

Just to be sure: Are you writing for MP or single player?

For single player scenario, you can addSwitchableUnit

For MP, you set all playable units from lobby via 3den, but you can disable AIs in lobby (this way, these slots/units don't exist (as variable) before a player jump into it. Not present til played.

You can also keep these AIs as playable and not disabled from lobby, but hide them/disable their simulation/make them invincible  until a player joins on it.

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, soldierXXXX said:

It's possible with just a little tweak.

 

Its perfect thanks a lot !

 

I'd like to ask one last question : I want the group that appears to automatically have the name of its class or vehicle rather than the default name (alpha something).

I've thought of something like for a vehicle and his crew but nothing works :


_vehicle = createVehicle [Vehicle, getMarkerPos "marker_5", [], 0, "NONE"];
_vehicleGroup = createVehicleCrew _vehicle;

_vehVarName = vehicleVarName _vehicleGroup;

_vehicleGroup setGroupId _vehVarName;

 

Or that for a group :


_InfGroup = [getMarkerPos "marker_4", WEST, (configfile >> "CfgGroups" >> "WEST" >> "FRANCE_Faction" >> "Infantry" >> _RandomInf)] call BIS_fnc_spawnGroup;

_infVarName = unitVarName (units _InfGroup select 0);

_InfGroup setGroupId _infVarName;

 

Any ideas ?

6 hours ago, pierremgi said:

Just to be sure: Are you writing for MP or single player?

For single player scenario, you can addSwitchableUnit

 

Thx pierremgi, in fact it's both and on dedicated server the soldierXXXX technic seems to work !

 

6 hours ago, pierremgi said:

this way, these slots/units don't exist (as variable) before a player jump into it

 

So is there any way of making playable slots in the lobby for units that haven't appeared yet ?

Share this post


Link to post
Share on other sites

For question about setting names, yes it's possible. Here is the code i put together. But be aware, naming the group by its type usually is long and in high command you will see only part of it. Also every PC can run Arma in different language so this might lead to people on the server not understanding the groupID name set by the PC that issued the command (these codes are just simple examples how to do it on your PC). This is probably the reason why they are named universally like Alpha, Bravo...
To set it on every client correctly would require to run part of the script clientside and passing them variables what you spawned so they know what to look for. Also you need to pay attention if the command is global GE or local LE (in this example it should set the name globally). But i'm not really right guy for multiplayer scripting 🙂.

For Vehicle:

_vehicle = createVehicle ["B_MBT_01_cannon_F", getMarkerPos "marker_5", [], 0, "NONE"];
_config = configOf _vehicle;
_vehicleName = getText (_config >> "displayName");
_vehicleGroup = createVehicleCrew _vehicle; 
_originalName = str _vehicleGroup splitString " "; 
_sufix = _originalName select 2; 
_newName = _vehicleName + " " + _sufix; 
_vehicleGroup setGroupIdGlobal [_newName];


For Group:

_config = (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad");
_InfGroup = [getMarkerPos "marker_4", WEST, _config] call BIS_fnc_spawnGroup; 
_originalName = str _InfGroup splitString " "; 
_sufix = _originalName select 2; 
_newName = getText (_config >> "name") + " " + _sufix; 
_InfGroup setGroupIdGlobal [_newName];


For the other question. You create units in the editor, set them as playable and ,if i understand correctly, in description.ext declare disabledAI = 1; I guess you can do it also from the 3den multiplayer settings. Biki says you need to have respawn enabled if you want players to be able to JIP. Adding respawn = 3; should be fine. Be aware that this can lead to some problems like for example if you have playable unit synchronized with HC module and player chooses to play other role, errors might appear. If there are other solutions for this problem i'd also like to hear them, because i'm focused on singleplayer missions/scripts and how multiplayer environment works i know only in theory 😅.

  • Like 2

Share this post


Link to post
Share on other sites

Damn you are a genius ! Thanks a million, i'm done with my boring questions ! 😁

Share this post


Link to post
Share on other sites
12 hours ago, Teutch said:

So is there any way of making playable slots in the lobby for units that haven't appeared yet ?

 

No. You can't create/spawn extra playable units, by script for MP. All playable units must be edited in 3den, so appear in lobby. What you can do with them is on your side, as I mentioned above.

Don't forget the possibility for hidding, disabling sim... on them until... a player joins on one of them. You can even "make them back in game" with any condition (a player reaching positions, meeting conditions..). You should tell, "creating", enabling in fact, playable units, what for?  Which context?

If your scenario can run in SP or MP, don't forget playable units (so, from editor) are just switchable units in SP. You can write for SP, something different from MP, checking for  isMultiplayer

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×