Jump to content
Sign in to follow this  
Tactical_Idiot

Reaspawn and Loadout scripts not working (CODE INSIDE)

Recommended Posts

Hello all,

I cannot get a loadout and respwan script to work correctly. I've had help to take it to this point, but we cant get it to fully work. I have troubleshooted some, and am stuck. I know it is something to do with Units 3-6 and something to do with the loadouts, as the Marksman loadout works absolutely fine, but none of the others do.

Can anyone help?

In the loadouts.sqf

Grenadier_Stuff ={

_unit = _this;

removeAllWeapons _unit;

removeAllAssigneditems _unit;

removeAllContainers _unit;

_unit addvest "V_TacVest_khk";

_unit addbackpack "B_AssaultPack_khk";

_unit addheadgear "H_HelmetSpecB";

_unit addGoggles "G_Shades_Black";

_unit adduniform "U_B_SpecopsUniform_sgg";

(unitBackpack _unit) additemCargo ["FirstAidKit",5];

_muzzle = [_unit, "arifle_MX_GL_Hamr_pointer_F", 9] call BIS_fnc_addWeapon;

_unit addmagazines ["3Rnd_Smoke_Grenade_shell", 2];

_unit addmagazines ["3Rnd_HE_Grenade_shell", 4];

_muzzle = [_unit, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon;

_unit addmagazines ["smokeshell", 4];

_unit addmagazines ["handgrenade", 5];

{_unit linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"];

_unit addweapon "Binocular";

_unit additem "optic_ACO_grn";

};

Marksman_Stuff ={

_unit = _this;

removeAllWeapons _unit;

removeAllAssigneditems _unit;

removeAllContainers _unit;

_unit addvest "V_TacVest_khk";

_unit addbackpack "B_AssaultPack_khk";

_unit addheadgear "H_HelmetSpecB";

_unit addGoggles "G_Shades_Black";

_unit adduniform "U_B_SpecopsUniform_sgg";

(unitBackpack _unit) additemCargo ["FirstAidKit",5];

_muzzle = [_unit, "srifle_EBR_ARCO_pointer_snds_F", 11] call BIS_fnc_addWeapon;

_unit addPrimaryWeaponItem "optic_Nightstalker";

_muzzle = [_unit, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon;

_unit addmagazines ["smokeshell", 4];

_unit addmagazines ["handgrenade", 5];

{_unit linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"];

_unit addweapon "Binocular";

_unit additem "optic_ACO_grn";

};

AutoRifleman_Stuff ={

_unit = _this;

removeAllWeapons _unit;

removeAllAssigneditems _unit;

removeAllContainers _unit;

_unit addvest "V_TacVest_khk";

_unit addbackpack "B_AssaultPack_khk";

_unit addheadgear "H_HelmetSpecB";

_unit addGoggles "G_Shades_Black";

_unit adduniform "U_B_SpecopsUniform_sgg";

(unitBackpack _unit) additemCargo ["FirstAidKit",5];

_muzzle = [_unit, "arifle_MX_SW_Hamr_pointer_F", 6] call BIS_fnc_addWeapon;

_muzzle = [_unit, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon;

_unit addmagazines ["smokeshell", 4];

_unit addmagazines ["handgrenade", 5];

{_unit linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"];

_unit addweapon "Binocular";

_unit additem "optic_ACO_grn";

};

Medic_Stuff ={

_unit = _this;

removeAllWeapons _unit;

removeAllAssigneditems _unit;

removeAllContainers _unit;

_unit addvest "V_TacVest_khk";

_unit addbackpack "B_AssaultPack_khk";

_unit addheadgear "H_HelmetSpecB";

_unit addGoggles "G_Shades_Black";

_unit adduniform "U_B_SpecopsUniform_sgg";

(unitBackpack _unit) additemCargo ["MediKit", 1];

(unitBackpack _unit) additemCargo ["FirstAidKit", 10];

_muzzle = [_unit, "arifle_MXC_ACO_pointer_F", 9] call BIS_fnc_addWeapon;

_muzzle = [_unit, "hgun_ACPC2_snds_F", 3] call BIS_fnc_addWeapon;

_unit addmagazines ["smokeshell", 4];

_unit addmagazines ["handgrenade", 5];

{_unit linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"];

_unit addweapon "Binocular";

_unit additem "optic_ACO_grn";

};

functionsLoaded = true;

In the init.sqf

[] execVM "loadouts.sqf";

waitUntil {!isNil "functionsLoaded"};

_loadout1 = unit1 call Marksman_Stuff;

_loadout2 = unit2 call Marksman_Stuff;

_loadout3 = unit3 call Medic_Stuff;

_loadout4 = unit4 call Grenadier_Stuff;

_loadout5 = unit5 call Grenadier_Stuff;

_loadout6 = unit6 call AutoRifleman_Stuff;

In each units init line in the editor

Unit 1+2 Marksmen: These two units work fine, both spawning with the custom loadout and respawning with the custom loadout. Works great.

this addMPEventhandler ["MPRespawn", {(_this select 0) call Marksman_Stuff}];

Unit3 Combat life saver: Doesn't spawn with the custom loadout and doesn't respawn with the custom loadout.

this addMPEventhandler ["MPRespawn", {(_this select 0) call Medic_Stuff}];

Unit4+5 Grenadiers: Doesn't spawn with the custom loadout and doesn't respawn with the custom loadout.

this addMPEventhandler ["MPRespawn", {(_this select 0) call Grenadier_Stuff}];

Unit 6 Autorifleman: Doesn't spawn with the custom loadout and doesn't respawn with the custom loadout.

this addMPEventhandler ["MPRespawn", {(_this select 0) call AutoRifleman_Stuff}];

I then save, then save as/export to MP mission, then quit editor, then load up MP mission on a LAN server.

The hint is whether they all spawn with silenced weapons, and the machine gunner has an MK200

Here is a link to the full mission folder, feel free to download (its 9mb) and see for yourself exactly what happens. Its actually a great mission with custom music, etc and I'm finished and ready for workshop as soon as I fix the bloody loadouts and respawning for units 3-6.

https://www.dropbox.com/s/299d4isce42t5z3/Operation_Pegasus_Loadout_Test.Stratis.rar

For ANYONE who fixes this t make it working I'll paypal £5 as a thanks, sorta like buying you a couple beers for the help.

J

Share this post


Link to post
Share on other sites

I know it is mate (this is the very helpful guy that's helped me this far). How can I host on a locally hosted server so I can see if it works my end?

Did you get it to also work when you followed my steps, ie exporting to MP mission and doing a LAN host like I did?

Share this post


Link to post
Share on other sites

Then we're both stumped, perhaps another can help? Its now isolated to units 3-6 not working....so whatever works for units 1-2 or whatever is different about their script is what the issue is I'm sure of it.

Share this post


Link to post
Share on other sites

have you tried

[] execVM "loadouts.sqf";

waitUntil {!isNil "functionsLoaded"};
waituntil {player ==player};
_loadout1 = unit1 call Marksman_Stuff;
_loadout2 = unit2 call Marksman_Stuff;
_loadout3 = unit3 call Medic_Stuff;
_loadout4 = unit4 call Grenadier_Stuff;
_loadout5 = unit5 call Grenadier_Stuff;
_loadout6 = unit6 call AutoRifleman_Stuff;

the wait until makes sure the player unit has initialised before calling the relevant script.

Share this post


Link to post
Share on other sites

Hello,

It works fine on dedicated server, except the uniform.

When a player arrives, he is OK, but the others suddenly have no more uniform.

I know there is a problem with uniform as it is local instead of global, but i dont see how to avoid this.

Thanks

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  

×