Jump to content
Sign in to follow this  
1para{god-father}

Kit Script issue

Recommended Posts

OK i have a Kit script that Works, but for some reason when we start a mission some players do not get any Mags and cannot pick any up , but if they go out to lobby again and back in they get what they should.

It is like a sysn issue on mission start , and suggestions ?

Player Init..

null = [this] execVM "kitscripts\Rifleman.sqf";

     waitUntil {!isNull player};      

        _unit = _this select 0;

       // Remove original equipment
       removeallweapons _unit;
       removeallassigneditems _unit;
       removeallcontainers _unit;


       // Add clothing
       _unit addUniform "U_B_CombatUniform_mcam";
       _unit addHeadgear "H_Booniehat_mcamo";
       _unit addVest "V_PlateCarrier1_cbr";
    //   _unit addBackpack "B_AssaultPack_base";
       _unit addGoggles "G_Shades_Black";

       // Add weapons & grenades
       _unit addWeapon "arifle_MX_GL_F";
       _unit addPrimaryWeaponitem "optic_Hamr";
       _unit addPrimaryWeaponItem "acc_pointer_IR";

       _unit addMagazines ["30Rnd_65x39_caseless_mag_Tracer", 8];
       _unit addMagazines ["3Rnd_HE_Grenade_shell", 3];


       _unit addWeapon "hgun_P07_F";
       _unit addMagazines ["30Rnd_9x21_Mag", 2];

       _unit addMagazines ["HandGrenade", 2];
       _unit addMagazines ["SmokeShellRed", 3];
       _unit addMagazines ["SmokeShellgreen", 1];


       // Add items
       _unit addWeapon "Binocular";

       _unit addItem "ItemRadio"; 
       _unit assignItem "ItemRadio"; 

       _unit addItem "g_tactical_clear"; 
       _unit assignItem "g_tactical_clear"; 

       _unit addItem "ItemCompass"; 
       _unit assignItem "ItemCompass"; 

       _unit addItem "ItemMap"; 
       _unit assignItem "ItemMap"; 

       _unit addItem "ItemWatch"; 
       _unit assignItem "ItemWatch"; 

       _unit addItem "ItemGPS"; 
       _unit assignItem "ItemGPS";

       _unit addItem "FirstAidKit"; 


if(true) exitWith{};

Share this post


Link to post
Share on other sites

you don't need to wait for player is true and exit

ex.

    //waitUntil {!isNull player};      

        _unit = _this select 0;

       // Remove original equipment
       removeallweapons _unit;
       removeallassigneditems _unit;
       removeallcontainers _unit;


       // Add clothing
       _unit addUniform "U_B_CombatUniform_mcam";
       _unit addHeadgear "H_Booniehat_mcamo";
       _unit addVest "V_PlateCarrier1_cbr";
    //   _unit addBackpack "B_AssaultPack_base";
       _unit addGoggles "G_Shades_Black";

       // Add weapons & grenades
       _unit addWeapon "arifle_MX_GL_F";
       _unit addPrimaryWeaponitem "optic_Hamr";
       _unit addPrimaryWeaponItem "acc_pointer_IR";

       _unit addMagazines ["30Rnd_65x39_caseless_mag_Tracer", 8];
       _unit addMagazines ["3Rnd_HE_Grenade_shell", 3];


       _unit addWeapon "hgun_P07_F";
       _unit addMagazines ["30Rnd_9x21_Mag", 2];

       _unit addMagazines ["HandGrenade", 2];
       _unit addMagazines ["SmokeShellRed", 3];
       _unit addMagazines ["SmokeShellgreen", 1];


       // Add items
       _unit addWeapon "Binocular";

       _unit addItem "ItemRadio"; 
       _unit assignItem "ItemRadio"; 

       _unit addItem "g_tactical_clear"; 
       _unit assignItem "g_tactical_clear"; 

       _unit addItem "ItemCompass"; 
       _unit assignItem "ItemCompass"; 

       _unit addItem "ItemMap"; 
       _unit assignItem "ItemMap"; 

       _unit addItem "ItemWatch"; 
       _unit assignItem "ItemWatch"; 

       _unit addItem "ItemGPS"; 
       _unit assignItem "ItemGPS";

       _unit addItem "FirstAidKit"; 


//if(true) exitWith{};

just if you use init.sqf to call the script you need to write there:

waitUntil {!isNull player};
player execVM "kitscripts\Rifleman.sqf";

but your script will become

       // Remove original equipment
       removeallweapons player;
       removeallassigneditems player;
       removeallcontainers player;


       // Add clothing
       player addUniform "U_B_CombatUniform_mcam";
       player addHeadgear "H_Booniehat_mcamo";
       player addVest "V_PlateCarrier1_cbr";
    //   player addBackpack "B_AssaultPack_base";
       player addGoggles "G_Shades_Black";

       // Add weapons & grenades
       player addWeapon "arifle_MX_GL_F";
       player addPrimaryWeaponitem "optic_Hamr";
       player addPrimaryWeaponItem "acc_pointer_IR";

       player addMagazines ["30Rnd_65x39_caseless_mag_Tracer", 8];
       player addMagazines ["3Rnd_HE_Grenade_shell", 3];


       player addWeapon "hgun_P07_F";
       player addMagazines ["30Rnd_9x21_Mag", 2];

       player addMagazines ["HandGrenade", 2];
       player addMagazines ["SmokeShellRed", 3];
       player addMagazines ["SmokeShellgreen", 1];


       // Add items
       player addWeapon "Binocular";

       player addItem "ItemRadio"; 
       player assignItem "ItemRadio"; 

       player addItem "g_tactical_clear"; 
       player assignItem "g_tactical_clear"; 

       player addItem "ItemCompass"; 
       player assignItem "ItemCompass"; 

       player addItem "ItemMap"; 
       player assignItem "ItemMap"; 

       player addItem "ItemWatch"; 
       player assignItem "ItemWatch"; 

       player addItem "ItemGPS"; 
       player assignItem "ItemGPS";

       player addItem "FirstAidKit"; 

you don't need "_this select" for player calling and it's executed locally on every player machine

but calling your script by unit init such as you've done, it's good but you don't need wait until !isnull player or your script ain't optimized and can show glitches and CPU load issues about your gaming experience (low FPS - lag), and the problems you're facing

Edited by Simon1279
grammar corrections, i'm not english

Share this post


Link to post
Share on other sites

It's not your problem, but it simplifies the code. You can use a weapon that already has items:

_unit addWeapon "arifle_MX_GL_F";
_unit addPrimaryWeaponitem "optic_Hamr";
_unit addPrimaryWeaponItem "acc_pointer_IR";

Can be replaced by(link):

_unit addWeapon "arifle_MX_GL_Hamr_point_F";

Share this post


Link to post
Share on other sites

many thanks ill give that a go !

you don't need to wait for player is true and exit

ex.

    //waitUntil {!isNull player};      

        _unit = _this select 0;

       // Remove original equipment
       removeallweapons _unit;
       removeallassigneditems _unit;
       removeallcontainers _unit;


       // Add clothing
       _unit addUniform "U_B_CombatUniform_mcam";
       _unit addHeadgear "H_Booniehat_mcamo";
       _unit addVest "V_PlateCarrier1_cbr";
    //   _unit addBackpack "B_AssaultPack_base";
       _unit addGoggles "G_Shades_Black";

       // Add weapons & grenades
       _unit addWeapon "arifle_MX_GL_F";
       _unit addPrimaryWeaponitem "optic_Hamr";
       _unit addPrimaryWeaponItem "acc_pointer_IR";

       _unit addMagazines ["30Rnd_65x39_caseless_mag_Tracer", 8];
       _unit addMagazines ["3Rnd_HE_Grenade_shell", 3];


       _unit addWeapon "hgun_P07_F";
       _unit addMagazines ["30Rnd_9x21_Mag", 2];

       _unit addMagazines ["HandGrenade", 2];
       _unit addMagazines ["SmokeShellRed", 3];
       _unit addMagazines ["SmokeShellgreen", 1];


       // Add items
       _unit addWeapon "Binocular";

       _unit addItem "ItemRadio"; 
       _unit assignItem "ItemRadio"; 

       _unit addItem "g_tactical_clear"; 
       _unit assignItem "g_tactical_clear"; 

       _unit addItem "ItemCompass"; 
       _unit assignItem "ItemCompass"; 

       _unit addItem "ItemMap"; 
       _unit assignItem "ItemMap"; 

       _unit addItem "ItemWatch"; 
       _unit assignItem "ItemWatch"; 

       _unit addItem "ItemGPS"; 
       _unit assignItem "ItemGPS";

       _unit addItem "FirstAidKit"; 


//if(true) exitWith{};

just if you use init.sqf to call the script you need to write there:

waitUntil {!isNull player};
player execVM "kitscripts\Rifleman.sqf";

but your script will become

       // Remove original equipment
       removeallweapons player;
       removeallassigneditems player;
       removeallcontainers player;


       // Add clothing
       player addUniform "U_B_CombatUniform_mcam";
       player addHeadgear "H_Booniehat_mcamo";
       player addVest "V_PlateCarrier1_cbr";
    //   player addBackpack "B_AssaultPack_base";
       player addGoggles "G_Shades_Black";

       // Add weapons & grenades
       player addWeapon "arifle_MX_GL_F";
       player addPrimaryWeaponitem "optic_Hamr";
       player addPrimaryWeaponItem "acc_pointer_IR";

       player addMagazines ["30Rnd_65x39_caseless_mag_Tracer", 8];
       player addMagazines ["3Rnd_HE_Grenade_shell", 3];


       player addWeapon "hgun_P07_F";
       player addMagazines ["30Rnd_9x21_Mag", 2];

       player addMagazines ["HandGrenade", 2];
       player addMagazines ["SmokeShellRed", 3];
       player addMagazines ["SmokeShellgreen", 1];


       // Add items
       player addWeapon "Binocular";

       player addItem "ItemRadio"; 
       player assignItem "ItemRadio"; 

       player addItem "g_tactical_clear"; 
       player assignItem "g_tactical_clear"; 

       player addItem "ItemCompass"; 
       player assignItem "ItemCompass"; 

       player addItem "ItemMap"; 
       player assignItem "ItemMap"; 

       player addItem "ItemWatch"; 
       player assignItem "ItemWatch"; 

       player addItem "ItemGPS"; 
       player assignItem "ItemGPS";

       player addItem "FirstAidKit"; 

you don't need "_this select" for player calling and it's executed locally on every player machine

but calling your script by unit init such as you've done, it's good but you don't need wait until !isnull player or your script ain't optimized and can show glitches and CPU load issues about your gaming experience (low FPS - lag), and the problems you're facing

Share this post


Link to post
Share on other sites

Well that made it even worse !

now when players spawn in they all other players get there kit !

Just realized using "player" will not work in MP , so back to the drawing board !

Anyone else can offer a solution ?

you don't need to wait for player is true and exit

ex.

    //waitUntil {!isNull player};      

        _unit = _this select 0;

       // Remove original equipment
       removeallweapons _unit;
       removeallassigneditems _unit;
       removeallcontainers _unit;


       // Add clothing
       _unit addUniform "U_B_CombatUniform_mcam";
       _unit addHeadgear "H_Booniehat_mcamo";
       _unit addVest "V_PlateCarrier1_cbr";
    //   _unit addBackpack "B_AssaultPack_base";
       _unit addGoggles "G_Shades_Black";

       // Add weapons & grenades
       _unit addWeapon "arifle_MX_GL_F";
       _unit addPrimaryWeaponitem "optic_Hamr";
       _unit addPrimaryWeaponItem "acc_pointer_IR";

       _unit addMagazines ["30Rnd_65x39_caseless_mag_Tracer", 8];
       _unit addMagazines ["3Rnd_HE_Grenade_shell", 3];


       _unit addWeapon "hgun_P07_F";
       _unit addMagazines ["30Rnd_9x21_Mag", 2];

       _unit addMagazines ["HandGrenade", 2];
       _unit addMagazines ["SmokeShellRed", 3];
       _unit addMagazines ["SmokeShellgreen", 1];


       // Add items
       _unit addWeapon "Binocular";

       _unit addItem "ItemRadio"; 
       _unit assignItem "ItemRadio"; 

       _unit addItem "g_tactical_clear"; 
       _unit assignItem "g_tactical_clear"; 

       _unit addItem "ItemCompass"; 
       _unit assignItem "ItemCompass"; 

       _unit addItem "ItemMap"; 
       _unit assignItem "ItemMap"; 

       _unit addItem "ItemWatch"; 
       _unit assignItem "ItemWatch"; 

       _unit addItem "ItemGPS"; 
       _unit assignItem "ItemGPS";

       _unit addItem "FirstAidKit"; 


//if(true) exitWith{};

just if you use init.sqf to call the script you need to write there:

waitUntil {!isNull player};
player execVM "kitscripts\Rifleman.sqf";

but your script will become

       // Remove original equipment
       removeallweapons player;
       removeallassigneditems player;
       removeallcontainers player;


       // Add clothing
       player addUniform "U_B_CombatUniform_mcam";
       player addHeadgear "H_Booniehat_mcamo";
       player addVest "V_PlateCarrier1_cbr";
    //   player addBackpack "B_AssaultPack_base";
       player addGoggles "G_Shades_Black";

       // Add weapons & grenades
       player addWeapon "arifle_MX_GL_F";
       player addPrimaryWeaponitem "optic_Hamr";
       player addPrimaryWeaponItem "acc_pointer_IR";

       player addMagazines ["30Rnd_65x39_caseless_mag_Tracer", 8];
       player addMagazines ["3Rnd_HE_Grenade_shell", 3];


       player addWeapon "hgun_P07_F";
       player addMagazines ["30Rnd_9x21_Mag", 2];

       player addMagazines ["HandGrenade", 2];
       player addMagazines ["SmokeShellRed", 3];
       player addMagazines ["SmokeShellgreen", 1];


       // Add items
       player addWeapon "Binocular";

       player addItem "ItemRadio"; 
       player assignItem "ItemRadio"; 

       player addItem "g_tactical_clear"; 
       player assignItem "g_tactical_clear"; 

       player addItem "ItemCompass"; 
       player assignItem "ItemCompass"; 

       player addItem "ItemMap"; 
       player assignItem "ItemMap"; 

       player addItem "ItemWatch"; 
       player assignItem "ItemWatch"; 

       player addItem "ItemGPS"; 
       player assignItem "ItemGPS";

       player addItem "FirstAidKit"; 

you don't need "_this select" for player calling and it's executed locally on every player machine

but calling your script by unit init such as you've done, it's good but you don't need wait until !isnull player or your script ain't optimized and can show glitches and CPU load issues about your gaming experience (low FPS - lag), and the problems you're facing

Share this post


Link to post
Share on other sites

We have also been tweaking around with loadouts because of the exact same problem you ran into, but we seem to have it fixed now, so perhaps this can help you.

rifleman.sqf

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

if(local _unit) then {



// Remove original equipment
removeallweapons _unit;
removeallassigneditems _unit;
removeallcontainers _unit;


// Add clothing
_unit addUniform "U_B_CombatUniform_mcam_vest";
_unit addHeadgear "H_HelmetB";
_unit addVest "V_PlateCarrierGL_rgr";
_unit addBackpack "B_AssaultPack_dgtl";


// Add weapons & grenades
_unit addMagazines ["30Rnd_65x39_caseless_mag", 9];
_unit addWeapon "arifle_MX_F";
_unit addPrimaryWeaponitem "optic_Holosight";
_unit addPrimaryWeaponItem "acc_pointer_IR";

_unit addMagazines ["30Rnd_9x21_Mag", 2];
_unit addWeapon "hgun_P07_F";

_unit addMagazines ["SmokeShellRed", 3];
_unit addMagazines ["SmokeShell", 3];
_unit addMagazines ["SmokeShellYellow", 3];
_unit addMagazines ["SmokeShellGreen", 3];
_unit addMagazines ["SmokeShellBlue", 3];
_unit addMagazines ["SmokeShellOrange", 3];
_unit addMagazines ["SmokeShellPurple", 3];

_unit addMagazines ["HandGrenade", 3];

_unit addMagazines ["Chemlight_green", 4];
_unit addMagazines ["Chemlight_blue", 4];


// Add items
_unit addMagazines ["FirstAidKit", 3];

_unit addWeapon "Binocular";

_unit addItem "g_tactical_clear"; 
_unit assignItem "g_tactical_clear"; 

_unit addItem "muzzle_snds_H"; 
_unit addItem "muzzle_snds_L"; 

_unit addItem "NVGoggles"; 
_unit assignItem "NVGoggles"; 

_unit addItem "ItemRadio"; 
_unit assignItem "ItemRadio"; 

_unit addItem "ItemCompass"; 
_unit assignItem "ItemCompass"; 

_unit addItem "ItemMap"; 
_unit assignItem "ItemMap"; 

_unit addItem "ItemWatch"; 
_unit assignItem "ItemWatch"; 

_unit addItem "ItemGPS"; 
_unit assignItem "ItemGPS";
};

And then initialize it the same way you are doing with the:

nul = [this] execVM "rifleman.sqf";

In the units init field.

Hope you can use this mate.

Edited by Byrgesen

Share this post


Link to post
Share on other sites

nul = [this] execVM "rifleman.sqf";

If you want the same loadout on respawn, change it to this...

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

Share this post


Link to post
Share on other sites

We are using custom respawn scripts so its not needed for us, but thx for the info though :)

Im sure someone else can use that.

Share this post


Link to post
Share on other sites

Thanks ill give that a go and let you know how i get on.

Cheers

We have also been tweaking around with loadouts because of the exact same problem you ran into, but we seem to have it fixed now, so perhaps this can help you.

rifleman.sqf

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

if(local _unit) then {



// Remove original equipment
removeallweapons _unit;
removeallassigneditems _unit;
removeallcontainers _unit;


// Add clothing
_unit addUniform "U_B_CombatUniform_mcam_vest";
_unit addHeadgear "H_HelmetB";
_unit addVest "V_PlateCarrierGL_rgr";
_unit addBackpack "B_AssaultPack_dgtl";


// Add weapons & grenades
_unit addMagazines ["30Rnd_65x39_caseless_mag", 9];
_unit addWeapon "arifle_MX_F";
_unit addPrimaryWeaponitem "optic_Holosight";
_unit addPrimaryWeaponItem "acc_pointer_IR";

_unit addMagazines ["30Rnd_9x21_Mag", 2];
_unit addWeapon "hgun_P07_F";

_unit addMagazines ["SmokeShellRed", 3];
_unit addMagazines ["SmokeShell", 3];
_unit addMagazines ["SmokeShellYellow", 3];
_unit addMagazines ["SmokeShellGreen", 3];
_unit addMagazines ["SmokeShellBlue", 3];
_unit addMagazines ["SmokeShellOrange", 3];
_unit addMagazines ["SmokeShellPurple", 3];

_unit addMagazines ["HandGrenade", 3];

_unit addMagazines ["Chemlight_green", 4];
_unit addMagazines ["Chemlight_blue", 4];


// Add items
_unit addMagazines ["FirstAidKit", 3];

_unit addWeapon "Binocular";

_unit addItem "g_tactical_clear"; 
_unit assignItem "g_tactical_clear"; 

_unit addItem "muzzle_snds_H"; 
_unit addItem "muzzle_snds_L"; 

_unit addItem "NVGoggles"; 
_unit assignItem "NVGoggles"; 

_unit addItem "ItemRadio"; 
_unit assignItem "ItemRadio"; 

_unit addItem "ItemCompass"; 
_unit assignItem "ItemCompass"; 

_unit addItem "ItemMap"; 
_unit assignItem "ItemMap"; 

_unit addItem "ItemWatch"; 
_unit assignItem "ItemWatch"; 

_unit addItem "ItemGPS"; 
_unit assignItem "ItemGPS";
};

And then initialize it the same way you are doing with the:

nul = [this] execVM "rifleman.sqf";

In the units init field.

Hope you can use this mate.

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  

×