Jump to content
slrruthless

Respawn with Custom loadout

Recommended Posts

Aloha, need help making a(n) sqf file and an "init" entry for a player/playable unit with custom loadouts on respawn. Have no idea what to put on both init and sqf.. I have actually tried to find ways and It does not work.This is what I have in my loadout:

removeallweapons this_;

removeGoggles this_;

removeHeadgear this_;

this_ addbackpack "B_Kitbag_Base";

this_ addvest "V_Chestrig_khk";

this_ addheadgear "H_HelmetB_light";

this_ addmagazine ["100Rnd_65x39_caseless_mag_Tracer", 1];

this_ addmagazine ["100Rnd_65x39_caseless_mag_Tracer", 1];

this_ addweapon "arifle_MX_f";

this_ addPrimaryWeaponItem "muzzle_snds_H";

this_ addPrimaryWeaponItem "optic_Hamr";

this_ addPrimaryWeaponItem "acc_flashlight";

this_ addweapon "NVGoggles";

will wait for reply,thanks in advance..........

Share this post


Link to post
Share on other sites

Hi slrruthless,

try this:

loadout.sqf

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

_unit = _this select 0;
removeallweapons _unit;
removeallassigneditems _unit;
removeallcontainers _unit;

_unit addbackpack "B_Kitbag_Base"; 
_unit addvest "V_Chestrig_khk"; 
_unit addheadgear "H_HelmetB_light"; 
_unit addmagazines ["100Rnd_65x39_caseless_mag_Tracer", 1];    //<- it is addmagazines ["string", number] or addmagazine "string"!
_unit addmagazines ["100Rnd_65x39_caseless_mag_Tracer", 1]; 
_unit addweapon "arifle_MX_f"; 
_unit addPrimaryWeaponItem "muzzle_snds_H"; 
_unit addPrimaryWeaponItem "optic_Hamr"; 
_unit addPrimaryWeaponItem "acc_flashlight"; 
_unit addweapon "NVGoggles";
/* you'd probably also use here: 
* _unit assignItem "NVGoggles";
*/

if(true) exitWith{};

init field:

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

The eventhandler is to ensure the gear is reloaded at respawn.

Tell me if you have questions or it didn't work :)

Edited by Kill_Phil
added waitUntil {!isNull player};

Share this post


Link to post
Share on other sites

THANK YOU kind sir......it worked perfectly, mahalo...... you the MAN !!!!!!! Okay one more question though, say if I had another character a "playable" character what would I put under the: _unit = _playable select 0; in the sqf.file ? I got a friend that plays along side me and I'd like for him to respawn with his custom set of weapons but what exactly do I put in the sqf.file under my (player) text ? Thank you so much for the help.

Share this post


Link to post
Share on other sites

No problem, I'm glad that this helped you out. :-)

So..I understand it this way: you want your friend to spawn/respawn with his personal loadout, right?

OK, I would do this as follows:

Create two loadout script files (e.g. loadout1.sqf, loadout2.sqf):

loadout1.sqf

waitUntil {!isNull player};

_unit = _this select 0;
removeallweapons _unit;
removeallassigneditems _unit;
removeallcontainers _unit;

_unit addbackpack "B_Kitbag_Base"; 
_unit addvest "V_Chestrig_khk"; 
_unit addheadgear "H_HelmetB_light"; 
_unit addmagazines ["100Rnd_65x39_caseless_mag_Tracer", 1];    //<- it is addmagazines ["string", number] or addmagazine "string"!
_unit addmagazines ["100Rnd_65x39_caseless_mag_Tracer", 1]; 
_unit addweapon "arifle_MX_f"; 
_unit addPrimaryWeaponItem "muzzle_snds_H"; 
_unit addPrimaryWeaponItem "optic_Hamr"; 
_unit addPrimaryWeaponItem "acc_flashlight"; 
_unit addweapon "NVGoggles";
/* you'd probably also use here: 
* _unit assignItem "NVGoggles";
*/

if(true) exitWith{};

loadout2.sqf

waitUntil {!isNull player};

_unit = _this select 0;
removeallweapons _unit;
removeallassigneditems _unit;
removeallcontainers _unit;

_unit addbackpack "B_Kitbag_Base"; 
_unit addvest "V_Chestrig_khk"; 
_unit addheadgear "H_HelmetB_light"; 
_unit addmagazines ["100Rnd_65x39_caseless_mag_Tracer", 1];    //<- it is addmagazines ["string", number] or addmagazine "string"!
_unit addmagazines ["100Rnd_65x39_caseless_mag_Tracer", 1]; 
_unit addweapon "arifle_MX_f"; 
_unit addPrimaryWeaponItem "muzzle_snds_H"; 
_unit addPrimaryWeaponItem "optic_Hamr"; 
_unit addPrimaryWeaponItem "acc_flashlight"; 
_unit addweapon "NVGoggles";
/* you'd probably also use here: 
* _unit assignItem "NVGoggles";
*/

if(true) exitWith{};

You can, of course, give the 2nd player a different loadout.

In the 1st players init:

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

2nd players init:

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

Also, to help you understanding the "null = [this] execVM "loadout2.sqf"; " line (If you don't care how this works, ignore :P):

this returns the unit, e.g. player1. You can pass arguments to the script with an array (this is why there is "[this]" and not "this" before execVM!). So, e.g. [player1] is passed to the loadoutscript. In this script you access the array with _this, however, you don't want the array, but the first element of it. Thats why you use "_this select 0;".

Edited by Kill_Phil
waitUntil {!isNull player};

Share this post


Link to post
Share on other sites

Alriiiiiiiight woohoo, you understood perfectly brother. Everything works great, cool I learned something and I can refer this post to whomever needs the help, thanks a million uncle Phil (LOL). Stay healthy bro,until next time :))))))

Share this post


Link to post
Share on other sites

Right, I am trying kinda the same thing. I have a switch inside my code so that I don't need more than one script for variations. However I don't know how to get out the second value ("role") upon respawn.

My script looks like this:

/*
* Used to loadout weapons for special forces classes.
* this SQF is made for Regular special forces.
*
*
* in init line put
* null = [this,"role"] execVM "Load.sqf"; 
* Switch out role with a number depending on what role you want, remove ""
*
* 
* 1: Squad Leader
* 2: Explosive expert
* 3: Medic
* 4: Marksman
* 5: Rifleman
*/

//Defines Variables
_unit = _this select 0;
_role = _this select 1;


//Ads general inventory.
removeAllWeapons _unit;
removeUniform _unit;
removeHeadgear _unit;
_unit addHeadgear "H_HelmetB_paint";
_unit adduniform "U_B_CombatUniform_mcam";
_unit addbackpack "b_assaultpack_rgr";
_unit addGoggles "g_tactical_clear";
_unit addweapon "binocular";
_unit additem "NVGoggles";
_unit assignItem "NVGoggles";
_unit addItem "itemGPS";
_unit assignItem "itemGPS";


//Switch hands out weapons and equipment based on role
switch (_role) do 
{ 
//Squad Leader
case 1: 
{
	//hint "case 1, squad Leader"; 
	_unit addMagazines ["30Rnd_65x39_case_mag", 8]; 
	_unit addWeapon "arifle_TRG20_F";
	_unit addPrimaryWeaponItem "acc_pointer_IR";
	_unit addPrimaryWeaponItem "optic_Hamr"; 
	_unit addPrimaryWeaponItem "muzzle_snds_H";
	_unit addMagazines ["16Rnd_9x21_Mag", 4];
	_unit addWeapon "hgun_P07_snds_F"; 
	_unit addMagazines ["SatchelCharge_Remote_Mag",3];
};
case 2:
{
	//hint "case 2, Explosives";
	_unit addMagazines ["30Rnd_65x39_case_mag", 8]; 
	_unit addWeapon "arifle_TRG20_F"; 
	_unit addPrimaryWeaponItem "acc_pointer_IR"; 
	_unit addPrimaryWeaponItem "optic_Hamr"; 
	_unit addPrimaryWeaponItem "muzzle_snds_H";  
	_unit addMagazines ["SatchelCharge_Remote_Mag",3];
};
case 3:
{
	//hint "case 3, Medic";
	_unit addMagazines ["30Rnd_65x39_case_mag", 8]; 
	_unit addWeapon "arifle_TRG20_F"; 
	_unit addPrimaryWeaponItem "acc_pointer_IR"; 
	_unit addPrimaryWeaponItem "optic_Hamr";
	_unit addPrimaryWeaponItem "muzzle_snds_H"; 
	_unit additem "medikit";
};
case 4:
{
	//hint "case 4, Marksman";
	_unit addMagazines ["20Rnd_762x45_Mag", 8];
	_unit addWeapon "arifle_MXM_F"; 
	_unit addPrimaryWeaponItem "acc_pointer_IR"; 
	_unit addPrimaryWeaponItem "optic_Hamr"; 
	_unit addPrimaryWeaponItem "muzzle_snds_B";
};
case 5:
{
	//hint "case 5, Rifleman";
	_unit addMagazines ["30Rnd_65x39_case_mag", 8]; 
	_unit addWeapon "arifle_TRG20_F"; 
	_unit addPrimaryWeaponItem "acc_pointer_IR"; 
	_unit addPrimaryWeaponItem "optic_Hamr";
	_unit addPrimaryWeaponItem "muzzle_snds_H";
};
default {hint "script error, variable does not exist"}; 
}; 

So in the init line of the squad leader i enter this:

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

What I am wondering is how do I get the second "value" out after respawn, the one that defines what role/class you will respawn as?

Edited by Valefor
Tried to define the question in a better way.

Share this post


Link to post
Share on other sites

init field:

null = [this,1] execVM "Loadout_Regular.sqf"; 
this addeventhandler ["respawn","[_this select 0,1] execVM 'Loadout_Regular.sqf'"];

With that you pass an array with [unit, role] on respawn.

The script selects first element (unit) and second element (role) correctly.

Also see: http://community.bistudio.com/wiki/addEventHandler

(Remember _this resturns already an array, thats why you have to select the 0. element (the respawned unit) and pass that.)

Regards, Phil

Edited by Kill_Phil

Share this post


Link to post
Share on other sites

Hi

I have a simular question about this, however, instead of a "fixed" loadout, i would like to have my friends respawn (after they die) with the same weapon / "gear" loadout. example: if they die with a pistol and only a vest, i would like them to respawn with that as well.

Could anyone help me with such a script? :)

Cheers

Share this post


Link to post
Share on other sites

Hi all, first time post, new to ARMA3 and editing, keen to learn a few tricks.

I have read the above and tried to apply it to my mission.

What I am trying to do is to have a multiplayer and/or single player mission. BLUFOR will have 10 playable units and OPFOR will have 10 playable units (either a player or AI). I have gone ahead and gave each unit a dedicated name (BLUFOR are "p1" through to "p10"), (OPFOR are "p11" through to "p20"). I have successfully been able to create the units with a custom load out. All units have the exact same load out on start and I want every unit to keep that exact spawn initial load out on respawn.

This is the initialisation that appears for each of the units.

removeallweapons this;

removeallitems this;

removeallassigneditems this;

removeuniform this;

removevest this;

removebackpack this;

this addvest "V_TacVest_brn";

this addmagazine "16Rnd_9x21_Mag";

this addmagazine "16Rnd_9x21_Mag";

this addweapon "hgun_P07_snds_F";

this addweapon "arifle_MX_GL_F";

this addmagazine "Chemlight_blue";

this addmagazine "Chemlight_green";

this addmagazine "Chemlight_red";

this addmagazine "Chemlight_yellow";

this addmagazine "SmokeShell";

this addmagazine "SmokeShell";

this addmagazine "SmokeShell";

this addmagazine "SmokeShell";

this addmagazine "SmokeShell";

this addmagazine "SmokeShell";

this addmagazine "MiniGrenade";

this addmagazine "3Rnd_UGL_FlareWhite_F";

this additem "ItemMap";

this additem "ItemWatch";

this additem "ItemCompass";

this additem "nvgoggles";

this assignitem "ItemMap";

this assignitem "ItemWatch";

this assignitem "ItemCompass";

this assignitem "nvgoggles";

this adduniform "U_B_CombatUniform_mcam_vest";

Can someone help so that I am able to have all players respawn with the custom loadout?

Share this post


Link to post
Share on other sites

This one is mine that I'm messing with. It works and it will give you more of a idea. I noticed you need a vest at least to hold the ammo. You can always add more to it.

//////////////////////////////////////////////////////////////////
// Having fun with LoadOuts
//////////////////////////////////////////////////////////////////

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

_unit = _this select 0;
removeallassigneditems _unit;
removeallcontainers _unit;
removeallweapons _unit;
removebackpack _unit;
removeuniform _unit;
removevest _unit;



// Headgear, Uniform & Vest

_unit addheadgear "H_Cap_red"; 

_unit adduniform "U_C_Poloshirt_tricolour";

_unit addvest "V_Chestrig_khk";

// Trinkets

_unit additem "itemgps";
_unit additem "itemwatch";

_unit assignitem "itemgps";
_unit assignitem "itemwatch"; 

// weapons, attatchments & ammo

_unit addweapon "arifle_MXM_f"; 
_unit addmagazine "20Rnd_762x45_Mag";
_unit addmagazine "20Rnd_762x45_Mag"; 
_unit addmagazine "20Rnd_762x45_Mag"; 
_unit addmagazine "20Rnd_762x45_Mag"; 
_unit addmagazine "20Rnd_762x45_Mag"; 
_unit addmagazine "20Rnd_762x45_Mag"; 

_unit addPrimaryWeaponItem "muzzle_snds_H"; 
_unit addPrimaryWeaponItem "optic_Hamr"; 
_unit addPrimaryWeaponItem "acc_flashlight";

_unit addweapon "hgun_Rook40_F";
_unit addmagazine "16Rnd_9x21_Mag";
_unit addmagazine "16Rnd_9x21_Mag";
_unit addmagazine "16Rnd_9x21_Mag";



// ETXTRA Commands 
// _unit addbackpack "B_Kitbag_Base"; 
// _unit addvest "V_Chestrig_khk";
// _unit addweapon "NVGoggles";
// _unit assignItem "NVGoggles";

if(true) exitWith{};

In the init field

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

I do get a "Cannot connect to the positioning system." message when loading. I think that's a bug, I'm not sure.

what command is it to get my weapons already loaded?

Edited by esham
question

Share this post


Link to post
Share on other sites

Can someone help so that I am able to have all players respawn with the custom loadout?

Thanks to Kill_Phil I was able to write my first script and might be able to help you. Thanks Kill_Phil!

Remove all that you have in the "Initialization" field and replace it with this:

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

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

Now go to your "Missions" folder located in "My Documents\ArmA 3 Alpha" and find the mission you are working on. Open it's folder up and create a text file and save it as "Loadout_All.sqf" and place the following code into it.

//_Loadout_All.sqf

waitUntil {!isNull player};

_unit = _this select 0;

//_Remove Items

removeallassigneditems _unit;

removeallcontainers _unit;

removeallweapons _unit;

//_Gear

_unit addweapon "nvgoggles";

_unit assignitem "nvgoggles";

_unit adduniform "U_B_CombatUniform_mcam_vest";

_unit addvest "V_TacVest_brn";

//_Items

_unit addweapon "itemcompass";

_unit addweapon "itemmap";

_unit addweapon "itemwatch";

//_Weapons

_unit addmagazines ["MiniGrenade", 1];

_unit addmagazines ["SmokeShell", 6];

_unit addmagazines ["UGL_FlareWhite_F", 3];

_unit addmagazines ["100Rnd_65x39_caseless_mag", 3];

_unit addweapon "arifle_MX_GL_F";

_unit addmagazines ["16Rnd_9x21_Mag", 2];

_unit addweapon "hgun_P07_snds_F";

if(true) exitWith{};

I do get a "Cannot connect to the positioning system." message when loading. I think that's a bug, I'm not sure.

what command is it to get my weapons already loaded?

For the map see my code above, it's a weapon. As for ammo, magazines have to go before the weapon. Also no need to type out multiple instances for each one. Again see code above.

Edited by SIMJEDI

Share this post


Link to post
Share on other sites

It worked for me. Thanks for the tips.

As shown in his 'spoiler' make sure you have this at the top of the script:

waitUntil {!isNull player};

_unit = _this select 0;

and this at the bottom:

if(true) exitWith{};

I missed that the first time and did get the default custom loadout.

I used my own loadout and didn't test his verbatim but if you're still having problems, copy his scripts exactly into a new mission, verify that it works, then slowly add your own stuff a bit at a time.

Share this post


Link to post
Share on other sites

when i tried this it came up with:

..int cant find nvgoggles

entry ['100rnd_...'not found

this came up in the top right hand corner and when i opent my inventory there was nothing in it

if some could help that would be great thx!!!

Share this post


Link to post
Share on other sites
can you add: respawn with the same gear you had at start / on death?

+1 asking the same as above

Share this post


Link to post
Share on other sites

Hello all,

I've read through various threads about this but I need help with something specific.

I'm new to this, and need each separate unit (there are 6 of them) to respawn with their individual custom loadouts. Ive got marksmen, medics and riflemen each with different load outs and need them all to respawn with them intact every time.

Can someone help me with this? Hopefully someone has an idiot guide or text I can just paste in the right place.

Thank!

Share this post


Link to post
Share on other sites

I use this method:

Make files for each unit in the mission directory were your missions are saved.

Exsamples:

Infantryman.sqf
Marksman.sqf
Medic.sqf

Then open the editor and add the following text to the Init fieald of the the unit you what to have the loadout.

For the marksman:

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

For the medic:

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

And for the infantrymen: (example with directory)

null = [this] execVM "Equipment\Infantryman.sqf";  this addeventhandler ["respawn","_this execVM 'Equipment\Infantryman.sqf'"];

Then open one of the files you just made and add the custom equipment by typing something like this:

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

removeallweapons _unit;
removeheadgear _unit;
removeallitems _unit;
removevest _unit;
removebackpack _unit;
removeUniform _unit;
_unit unassignItem "NVGoggles";
_unit removeItem "NVGoggles";
_unit unassignItem "ItemGPS";
_unit removeItem "ItemGPS";
_unit adduniform "U_B_CombatUniform_mcam";
_unit addVest "V_PlateCarrier1_rgr";
_unit addBackpack "B_Kitbag_base";
_unit addItem "Medikit";
_unit addHeadgear "H_HelmetB_plain_mcamo";
_unit addGoggles "G_Combat";
_unit addWeapon "binocular";
_unit addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
_unit addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
_unit addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
_unit addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
_unit addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
_unit addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
_unit addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
_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 "arifle_MXC_F";
_unit addPrimaryWeaponItem "optic_Hamr";
_unit addPrimaryWeaponItem "acc_pointer_IR";

There you go custom equipment.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Hey guys,

Was pulling my hair out after creating customs loadouts for each class in my mission only to have it bug out on the dedicated server or while trying to host. What is in this thread is perfect except I have items that I have assigned into the backpack with the following code:

(unitBackpack this) additemCargo ["FirstAidKit",2];

(unitBackpack this) additemCargo ["muzzle_snds_H_MG",1];

(unitBackpack this) additemCargo ["acc_flashlight",1];

(unitBackpack this) additemCargo ["optic_Nightstalker",1];

(unitBackpack this) addmagazinecargo ["200Rnd_65x39_cased_Box",3];

What would be the correct way to include this in the sqf file?

All help is greatly appreciated.

EDIT: Scratch the backpack items as it's not really needed which I knew but wanted to keep the load-outs a bit cleaner. The issue I'm having now is I'm running the mission on a dedicated server and JIP will spawn you with no uniform and some items missing and if someone joins it will randomly remove someones uniform and items similar to the initial spawn issue. I'm not sure if this is a server problem (It's our own server which hasn't been used a great deal but has been reliable up to this point) or it's the game itself causing the problem. We also had in testing duplicate soldiers (player controlled) spawn in which makes me think it could be the server.

Anyway it would be great to know if anyone has had similar issues or knows a fix.

Cheers

Edited by AusCleaver

Share this post


Link to post
Share on other sites

Guys I am terribly sorry to ask this but I just can't get it to work, this is my first time even creating a mission, and I'm brand new to arma.

What I want to do is simple, have all of the units in BLUFOR respawn with the same loadout they started with. All of the units are using the same loadout.

I keep respawning with the default stuff and can't figure what is wrong.

Here is what I have so far:

(your help will be really appreciated) :butbut:

Init.SQF

null = [this] execVM "customloadout.SQF"; 
this addeventhandler ["respawn","_this execVM 'customloadout.SQF'"];

DESCRIPTION.EXT

respawn = "base";
respawndelay = 15;
respawndialog = false;

customloadout.sqf

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

_unit = _this select 0;


removeallweapons this;
removeallassigneditems this;
removeallcontainers this;
removeuniform this;
removevest this;
removebackpack this;

this addVest 'V_PlateCarrier2_rgr';


this addBackPack 'B_AssaultPack_rgr';



this addmagazine "20Rnd_762x51_Mag"; 
this addmagazine "20Rnd_762x51_Mag"; 
this addmagazine "20Rnd_762x51_Mag"; 
this addmagazine "20Rnd_762x51_Mag"; 
this addmagazine "20Rnd_762x51_Mag"; 
this addmagazine "20Rnd_762x51_Mag"; 
this addmagazine "20Rnd_762x51_Mag"; 
this addmagazine "20Rnd_762x51_Mag"; 

this addmagazine "11Rnd_45ACP_Mag";
this addmagazine "11Rnd_45ACP_Mag";
this addmagazine "11Rnd_45ACP_Mag";
this addmagazine "11Rnd_45ACP_Mag";

this addWeapon "srifle_EBR_MRCO_pointer_F";

this addPrimaryWeaponItem "optic_DMS";



this addWeapon "hgun_Pistol_heavy_01_MRD_F";


this addmagazine "smokeshell";
this addmagazine "smokeshell";
this addmagazine "smokeshell";
this addmagazine "handgrenade";
this addmagazine "handgrenade";
this addmagazine "handgrenade";
this addmagazine "handgrenade";
this addmagazine "handgrenade";

(unitbackpack this) additemcargo ["FirstAidKit", 5];

this additem "itemcompass";
this assignitem "itemcompass";

this additem "itemmap";
this assignitem "itemmap";

this additem "itemgps";
this assignitem "itemgps";

this additem "itemwatch";
this assignitem "itemwatch";

this additem "itemradio";
this assignitem "itemradio";

this additem "nvgoggles";
this assignitem "nvgoggles";

this setFace "WhiteHead_11";

this addGoggles "G_Tactical_Black";

this addHeadgear "H_Watchcap_camo";

this addUniform  "U_B_CombatUniform_mcam_tshirt";

if(true) exitWith{};

Share this post


Link to post
Share on other sites
Guys I am terribly sorry to ask this but I just can't get it to work, this is my first time even creating a mission, and I'm brand new to arma.

What I want to do is simple, have all of the units in BLUFOR respawn with the same loadout they started with. All of the units are using the same loadout.

I keep respawning with the default stuff and can't figure what is wrong.

Here is what I have so far:

(your help will be really appreciated) :butbut:

Hi Dan!

Taking a look at your code, I think the problem might stem from your use of the 'this' variable in your init.sqf. See, the thing with 'this' is that it's a self-referencing term.

Take the init box of a soldier, for example: When you reference 'this' in the init, the engine automatically knows the code in that box refers to that specific unit. What this means in your specific situation is that when you've referenced the 'this' in the init.sqf, the engine doesn't quite know what you're referring to. If you name the unit you're trying to add the load-out to in the init.sqf, the engine knows to apply it to that specific soldier. Lets say the unit you're working with is going to be named simply Dan in the editor. You'd want your init to look like this:

init.sqf

null = [Dan] execVM "customloadout.SQF"; 
Dan addeventhandler ["respawn","_this execVM 'customloadout.SQF'"];

Kind of a lengthy and long-winded explanation, but knowing is half the battle after all.

Hope it helps!

Edit: Seems I hit the enter button to early. The other thing you'll want to look at is in your customloadout.sqf; You'll want to perhaps change all the 'this' variables into _unit, so that customloadout.sqf performs all those inventory actions on the unit passed to it from the eventhandler.

Edited by Adombom
I'm forgetful

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

×