Jump to content
Sign in to follow this  
colonel_paz

How can I make players Respawn doing HALO jump with custom equipment?

Recommended Posts

Hi Guys,

I'm in the middle of editing a Deathmatch mission that will consist on several random elements happening around the map. So far I have managed to sort some of them but one of the most important ones would be RESPAWNING performing a halo jump from 500m altitude or so with custom loadout and uniform... I know how to make the players START the mission in this way, the problem is after anyone dies they respawn on the ground with the default loadout/clothes regardless of what I have put in each players init field.

Please can anyone suggest a solution for this?

I am using civilians dress with military uniforms... is this the best way for a deathmatch?

Thanks

Share this post


Link to post
Share on other sites

Custom equipment can be applied via the editor with script, or with a connected db using ArmA2NET. (yes, ArmA2net even though it's ArmA 3)

Share this post


Link to post
Share on other sites

IT07 thanks for your answer...

In order to be more explicit with my situation I'm posting the code i'm using in my units and mission:

THIS IS THE CODE IN MY SOLDIERS/UNITS:

removeAllWeapons this;
removeUniform this;
removeVest this;
removeHeadgear this;
this addUniform "U_B_CTRG_3";
this addvest "V_PlateCarrierL_CTRG";
this addHeadgear "H_HelmetB_light";
this addMagazine "30rnd_556x45_stanag";
this addweapon "arifle_TRG20_F";
this addprimaryweaponitem "optic_ACO";
this addBackpack "B_Parachute";
this setPos [getPos this select 0,getPos this select 1,500.00]

When the mission starts, all units start in a free fall at 500m altitude, with all the designated custom equipment... however, after they die the first time, they respawn on the ground and WITHOUT the custom equipment in their init fields.

What am I doing wrong? PLEASE HELP! :confused:

Share this post


Link to post
Share on other sites

Respawn happens by spawning a new unit of the same class name and switching the player to that one, so the init field of the old doesn't get applied.

Have you thought using the loadouts you can define in description.ext? See the settings like MenuInventory.

https://community.bistudio.com/wiki/Arma_3_Respawn

Other way is to apply the scripted loadout again in a file called onPlayerRespawn.sqf that you create in your mission directory. The HALO jump you have to apply this way in either case. Create the file and put this in it:

// the new unit is the first parameter that the game passes to the script
_unit = _this select 0;

_unit setPos [getPos _unit select 0, getPos _unit select 1, 500];

Share this post


Link to post
Share on other sites

Hi Magirot,

Thank you for your reply... so in theory something along these lines should work as the onPlayerRespawn.sqf?

waitUntil {!isNull player};       //to prevent MP / JIP issues

_unit = _this select 0;
removeAllWeapons _unit;
removeUniform _unit;
removeVest _unit;
removeHeadgear _unit;

_unit addUniform "U_B_CTRG_3";
_unit addvest "V_PlateCarrierL_CTRG";
_unit addHeadgear "H_HelmetB_light";
_unit addMagazine "30rnd_556x45_stanag";
_unit addweapon "arifle_TRG20_F";
_unit addprimaryweaponitem "optic_ACO";
_unit addBackpack "B_Parachute";

_unit setPos [getPos _unit select 0, getPos _unit select 1, 500];

if(true) exitWith{};

Will this code work as the onPlayerRespawn.sqf? sorry to ask without testing but i'm in the office at the moment unable to actually give this a try! Thanks for all the help beforehand.

Also, do I only need to create the file and will be automaticalle executed because of its name or does the file need to be called with the init field of the units or somewhere else?

Thanks!

Share this post


Link to post
Share on other sites
Also, do I only need to create the file and will be automaticalle executed because of its name or does the file need to be called with the init field of the units or somewhere else?

A file called onPlayerRespawn.sqf will be executed on default, unless you specify another file in a new respawn template.

The loadout should work like that in theory, but because of the still-persisting bug with addUniform, there will be problems. You should switch the addUniform line into:

[[[_unit, "U_B_CTRG_3"], { (_this select 0) addUniform (_this select 1) }], "BIS_fnc_spawn", TRUE] call BIS_fnc_MP;

Otherwise you will run into problems, as removeUniform is executed for everyone, while addUniform is only executed locally. Which means people in underpants.

However, there will actually be problems with the init lines at well: If a Join-In-Progress player joins while the game in progress, all players who are still controlling their initial, non-respawned units, will lose their uniforms (because the JIP player executes the init lines, and the global commands will get applied again). Also I think they might be teleported 500m into the air at that point too.

Avoiding this is relatively simple in your case, if there aren't any AI units or separate loadouts. You could give this a try in your init.sqf, for example:

if (!isDedicated) then
{
// Wait until a JIP player is initialised
if (player != player) then
{
	waitUntil {!isNull player};
	waitUntil {time > 10};
};


_unit = player;

// Apply the loadout
removeAllWeapons _unit;
removeUniform _unit;
removeVest _unit;
removeHeadgear _unit;

_unit setPos [getPos _unit select 0, getPos _unit select 1, 500];

[[[_unit, "U_B_CTRG_3"], { (_this select 0) addUniform (_this select 1) }], "BIS_fnc_spawn", TRUE] call BIS_fnc_MP;

_unit addVest "V_PlateCarrierL_CTRG";
_unit addHeadgear "H_HelmetB_light";
_unit addMagazine "30rnd_556x45_stanag";
_unit addWeapon "arifle_TRG20_F";
_unit addPrimaryWeaponItem "optic_ACO";
_unit addBackpack "B_Parachute";
};

That way the initial setup is actually only executed once, JIP should work, and if you put BIS_fnc_MP uniform line in onPlayerRespawn, everything should work. should.

Share this post


Link to post
Share on other sites

Hi magirot,

thx again for all the help... i did try the script i posted and it works perfectly (thank you for your help on that) I will do the changes you suggest to avoid any problems or bugs!

Thank you!

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  

×