Jump to content
Sign in to follow this  
sfod-d_snakebite

Multyplayer Switch

Recommended Posts

Hi@ all.

First thanks to read this article :)

However I want to know if it's possible to have the "switch function" in MP mission (me + friend). I mean: we like to go infantry, but sometimes we would like to play pilot for help our ground unit. If I read well in MP switch feature is turned off. There is a way to make it happen?

Hope in a reply please. Have a nice time.

Share this post


Link to post
Share on other sites

Hi Zukov. Thanks for reply. However I see that the switch could be done while u're dead and switch to another of your soldier. I don't need this. I need to switch unit in MP while my character is alive. Is this possible this?

Share this post


Link to post
Share on other sites

Build an addaction or menu and look up the commands like setPlayable and selectPlayer.

You'll need those to switch units.

Share this post


Link to post
Share on other sites

Hi Das Attorney. Thanks also to you for reply. I'm a low level for this thinghs, can u, please, explain how to "build an addaction" etc? please!

Share this post


Link to post
Share on other sites
Build an addaction or menu and look up the commands like setPlayable and selectPlayer.

You'll need those to switch units.

Actually Das, according to the wiki for setPlayable:

NOTE: Currently in Arma 3 this command does nothing.

Not sure if that's changed, but thought I would bring it up.

But to Snakebite, here is a psuedo example (in other words, untested), of an action you would place in whatever unit's init field:

this addAction
[
"Player Switch",
{
	if !((_this select 0) in switchableUnits) then
	{
		addSwitchableUnit (_this select 0);
	};

	selectPlayer (_this select 0);
},
[],
6,
true,
true,
"",
"_this distance _target < 5"
];

And here are all the related wiki pages:

addAction

addSwitchableUnit

switchableUnits

selectPlayer

Share this post


Link to post
Share on other sites

Thanks Jshock. So If i Wanna use another soldier in MP, I have to copy all of what u wtote in the "init" field of the unit right? Is it possible to have more than 1? I mean: for me & and my friend, we can both use the switchable unit?

Share this post


Link to post
Share on other sites

Yes, just copy it all (but like I said it's untested, so it may not work), and yes you could have more than one as long as there was a second pilot unit with this same action added in its init field. This example is very straightforward without any dynamics, so we may have to add a few things here and there to make it work the way it needs to, or it just may not work at all, we shall see :).

Share this post


Link to post
Share on other sites

Weel ok. This weekend I have a MP session with friend on Stratis and I'll let you know if it works. Thanks again for your support. Really really appreciated!

Share this post


Link to post
Share on other sites

Jshock Hi. Unfortunately it didn't work. I made a simple mission: 3 men, rifleman, pilot, officer. And in eveybody I put in the initialization the code u give me, put 1 player and 2 playble, but not work unlucly :(

Share this post


Link to post
Share on other sites

Tested with self-hosted LAN scenario, and it works. Made own versions, all of them together there:

this addAction [ "Player Switch", {selectPlayer (_this select 0)}, [], 6, true, true, "", "((_this distance _target) < 5) and not (_this == _target)"];

- into init field of any unit, that should be switchable via action menu (when close, and pointing at it).

Similar to put into vehicle's init field to cover its crew:

this addAction [ "Driver Switch", {selectPlayer (assigneddriver (_this select 0))}, [], 6, true, true, "", "not (_this == (assignedDriver _target)) and {not (isNull (assigneddriver _target))}"];
this addAction [ "Gunner Switch", {selectPlayer (assignedgunner (_this select 0))}, [], 6, true, true, "", "not (_this == (assignedGunner _target)) and {not (isNull (assignedgunner _target))}"];
this addAction [ "Commander Switch", {selectPlayer (assignedcommander (_this select 0))}, [], 6, true, true, "", "not (_this == (assignedCommander _target)) and {not (isNull (assignedcommander _target))}"];

Also variant 2, for switching between two units (named PlayerA and PlayerB) anytime for any distance:

PlayerA init:

this addAction [ "Player B Switch", {selectPlayer PlayerB}, [], 6, true, true, "", "not (_this == PlayerB)"];

playerB init:

this addAction [ "Player A Switch", {selectPlayer PlayerA}, [], 6, true, true, "", "not (_this == PlayerA)"];

Although possible some locality issues. Making GUI for switching in MP is quite another matter though.

Edited by Rydygier

Share this post


Link to post
Share on other sites

Hi@ all.

First thanks to read this article :)

However I want to know if it's possible to have the "switch function" in MP mission (me + friend). I mean: we like to go infantry, but sometimes we would like to play pilot for help our ground unit. If I read well in MP switch feature is turned off. There is a way to make it happen?

Hope in a reply please. Have a nice time.

https://forums.bistudio.com/topic/186059-mp-unit-switch/

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
Sign in to follow this  

×