Jump to content
Sign in to follow this  
Cold Evil

Need help with respawning custom equipment

Recommended Posts

I need help with equipment weapons and items so they respawn after you have died. I have tried the following methods:

Unit Init line:

player addEventHandler ["Respawn", {_this execVM "squadleader.sqf"}];

Unit Init line:

this addEventHandler ["Respawn", {_this execVM " squadleader.sqf"}];

Unit Init line:

if(local this) then {
removeallweapons this;
removeheadgear this;
removevest this;
removebackpack this;
removeUniform this;
this unassignItem "NVGoggles";
this removeItem "NVGoggles";
this adduniform "U_B_CombatUniform_mcam";
this addVest "V_PlateCarrier2_rgr";
// ETC…
};

The init.sqf file:

waitUntil {!isNull player};
waitUntil {player == player};

if(typeOf player == "B_officer_F") then {
removeallweapons player;
removeheadgear player;
removevest player;
removebackpack player;
removeUniform player;
player unassignItem "ItemRadio";
// etc…
};

How do I do it?

Share this post


Link to post
Share on other sites

Simply give this a go - it is much easier than scripting a system. If you have a loadout at spawn then you can script the save loadout instead of having an ammo box with an action to select save.

Share this post


Link to post
Share on other sites

I have a heavily restricted VAS on the mission. So if you die i don't what people run around with enemy weapons.

Share this post


Link to post
Share on other sites

try this in the Unit Init line:

null = [this] execVM "squadleader.sqf";

this addeventhandler ["respawn","_this execVM 'squadleader.sqf'"];

And this in the sqf:

//_squadleader.sqf

waitUntil {!isNull player};

_unit = _this select 0;

//_Remove Items

removeallassigneditems _unit;

removeallcontainers _unit;

removeallweapons _unit;

//_Gear

_unit addUniform "U_B_CombatUniform_mcam";

_unit addvest "V_PlateCarrier2_rgr";

//_Items

_unit addweapon "itemcompass";

_unit addweapon "itemmap";

_unit addweapon "itemwatch";

//_Weapons

_unit addweapon "arifle_MX_F";

_unit addweapon "hgun_P07_snds_F";

_unit addmagazines ["16Rnd_9x21_Mag", 4];

Edited by Thor632

Share this post


Link to post
Share on other sites

It did not seam to do anything... It did not change anything for me.

EquipmentHeliPilot.sqf

waitUntil {!isNull player};
_unit = __unit select 0;

removeallweapons _unit;
removeheadgear _unit;
removevest _unit;
removebackpack _unit;
removeUniform _unit;
_unit unassignItem "ItemRadio";
_unit removeItem "ItemRadio";
_unit unassignItem "NVGoggles";
_unit removeItem "NVGoggles";
_unit adduniform "U_B_HeliPilotCoveralls";
_unit addVest "V_TacVest_oli";
_unit addHeadgear "H_PilotHelmetHeli_B";
_unit addMagazine ["16Rnd_9x21_Mag", 16];
_unit addMagazine ["16Rnd_9x21_Mag", 16];
_unit addMagazine ["16Rnd_9x21_Mag", 16];
_unit addMagazine ["SmokeShellBlue", 30];
_unit addMagazine ["SmokeShellBlue", 30];
_unit addMagazine ["SmokeShellBlue", 30];
_unit addMagazine ["SmokeShellGreen", 30];
_unit addMagazine ["SmokeShellGreen", 30];
_unit addMagazine ["SmokeShellGreen", 30];
_unit addWeapon "hgun_P07_F";

Unit init:

null = [this] execVM "EquipmentHeliPilot.sqf";
this addeventhandler ["respawn","_this execVM 'EquipmentHeliPilot.sqf'"];

EDIT

Never mind!!!

I see my error... When i replaced "this" to "_unit" with i forgot to change "__unit" to "_this". The script seams to work thx!

Edited by Cold Evil

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  

×