Jump to content
Sign in to follow this  
soapsurfer

JIP with MenuPosition

Recommended Posts

Hi,

I'm working on a mission for my group and I'm wondering how to make it possible for JIP players to start next to the playing folks. Right now I'm using a simple base respawn. As we are using AGM with permadeath disabled this enables JIP and players don't respawn.

How can I spawn them next to the other players without leaving any AI slots open?

Cheers :)

Edit:

Dang, I forgot to change the title after changing my question in the editor. :D

Share this post


Link to post
Share on other sites

For my group's missions I use scripts originally made by Megagoth1702.

In the init.sqf of your mission put in

[] execVM "scripts\initTeleportToSL.sqf";

Then make a folder called "scripts" in your mission folder and make a "initTeleportToSL.sqf" and "TeleportToSL.sqf".

initTeleportToSL.sqf

sleep 5;
movetoSL = player addAction ["Teleport To SL", "scripts\TeleportToSL.sqf"];
sleep 10;
hintSilent "Use your scroll wheel to teleport to your squad leader";
sleep 180;//3min
player removeAction movetoSL;

TeleportToSL.sqf

private ["_leader","_LX","_LY","_LZ"];

//setting up basic variables
       _leader = leader player;

//If leader's vehicle is the leader himself, move player 3m behind him

       if (vehicle _leader == _leader) then
       {

       //Getting the coords

       _LX = (getpos _leader select 0) +
                       (3*sin ((getDir _leader) -180));
       _LY = (getpos _leader select 1) +
                       (3*cos ((getDir _leader) -180));
       _LZ = (getpos _leader select 2);

       player setpos [_LX,_LY,_LZ];
       player removeAction movetoSL;
       }

//If leader is inside vehicle, move player into vehicle cargo

       else

       {

       /*Checking if there is room in the vehicle, gives hint if there is none
       if there is room, player is moved into cargo of leader's vehicle
       */

       if ((vehicle _leader) emptyPositions "cargo"==0) then
       {hint "No room in squad leader's vehicle."}
       else
       {
       player moveincargo vehicle _leader;
       player removeAction movetoSL;
       };
       };

The scripts give every player, including JIPs and addaction that enables them to teleport to the leader of their group even if they're in a vehicle, assuming its not full. The addaction automatically disappears upon use or after 3 minutes.

Share this post


Link to post
Share on other sites

Thank you, this works great. :)

I have another question: Whenever a player joins, all inventories are overwritten. I guess the init fields of the units are called again - not only for the joining player but over everyone. Does anybody know why this happens and how to work around it?

Share this post


Link to post
Share on other sites
Thank you, this works great. :)

I have another question: Whenever a player joins, all inventories are overwritten. I guess the init fields of the units are called again - not only for the joining player but over everyone. Does anybody know why this happens and how to work around it?

How to work around it? Don't use Init field. There used to be a command (in arma 2) to clear init fields but BIS removed it for arma 3.

Other than that, you could protect your init fields with something like:

if (isNil "initialised") then {
<Normal Init Code>
initialised = true;
sleep 5;// <- to allow other players to initialise
publicVariable "initialised";

};



I'm not sure exactly why it happens but init.sqf and init fields seem unreliable to me, I don't use them. (initServer.sqf is the only event script I use.)

Share this post


Link to post
Share on other sites

How do you assign loadouts to units then? If Init-Fields are not that reliable there needs to be another possibilty. I know there needs to be one! :icon_evil:

Share this post


Link to post
Share on other sites

The script looks quite nice but I'm looking for a simpler solution. Is it possible to How can I use Arsenal exported loadouts without much hassle?

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  

×