Jump to content
Sign in to follow this  
kocrachon

Ammo not loading at launch

Recommended Posts

So I am trying to run a local server on my machine for hosting missions. In order to load gear, I have this running in the init of the game logic. For some reason, my guy, has everything he is suppose to. Everyone else, there is NOTHING in the backpack, so they don't have any ammo at the start. But everything else loads, just not the stuff in the backpack. Where as for my guy, the backpack loads fine.

If I run this as a script, such as having gamelogic launch it as an sqf, non of them load with the gear, but mine do.

If I run it by launching in the init.sqf, then it gives everyone ELSE ammo and gear and not me, plus it also gives them too much. For example, man2, ended up having 8 med kits (which means he got 2 med kits for everyone else for some reason)

If it run it in init.sqf with if (isserver), then the same issue arises, only I get gear, and no one else does.

if (isserver) then {

removeAllWeapons man1;  
man1 addWeapon "arifle_MX_ARCO_point_grip_F"; 
(unitBackpack man1) addMagazineCargo ["30Rnd_65x39_caseless_mag",8];
(unitBackpack man1) addMagazineCargo ["HandGrenade", 4];  
man1 addmagazine ["30Rnd_65x39_caseless_mag",8];
man1 additem "FirstAidKit";  
man1 additem "FirstAidKit";  
man1 moveInCargo bird1;  
man1 addITEM "NVGoggles";  
man1 assignItem "NVGoggles";  
man1 addItem "muzzle_snds_H";  
unit1 = group man1;  
man1 addMagazine ["DemoCharge_Remote_Mag",2];
man1 additem "optic_Holosight";      

removeAllWeapons man2;  
man2 addbackpack "B_AssaultPack_blk";  
man2 addWeapon "arifle_MX_ARCO_point_grip_F";  
(unitBackpack man2) addMagazineCargo ["30Rnd_65x39_caseless_mag",8];
(unitBackpack man2) addMagazineCargo ["HandGrenade", 4];
man2 additem "FirstAidKit";  
man2 additem "FirstAidKit";  
man2 moveInCargo bird1;  
man2 addITEM "NVGoggles";  
man2 assignItem "NVGoggles";  
man2 addItem "muzzle_snds_H";  
man2 additem "optic_Holosight";    
man2 addMagazine ["DemoCharge_Remote_Mag",2];    

removeAllWeapons man3;  
man3 addbackpack "B_AssaultPack_blk";  
man3 addWeapon "arifle_MX_ARCO_point_grip_F";  
(unitBackpack man3) addMagazineCargo ["30Rnd_65x39_caseless_mag",8];
(unitBackpack man3) addMagazineCargo ["HandGrenade", 4]; 
man3 additem "FirstAidKit";  
man3 additem "FirstAidKit";   
man3 moveInCargo bird1;  
man3 addITEM "NVGoggles";  
man3 assignItem "NVGoggles";  
man3 addItem "muzzle_snds_H";  
man3 addMagazine ["DemoCharge_Remote_Mag",2];
man3 additem "optic_Holosight";        

removeAllWeapons man4;  
man4 addbackpack "B_AssaultPack_blk";  
man4 addWeapon "srifle_EBR_Hamr_point_grip_F";    
(unitBackpack man4) addMagazineCargo ["20Rnd_762x45_Mag",8];
(unitBackpack man4) addMagazineCargo ["HandGrenade", 4];  
man4 additem "FirstAidKit";  
man4 additem "FirstAidKit";  
man4 moveInCargo bird1;  
man4 addITEM "NVGoggles";  
man4 assignItem "NVGoggles";  
man4 addItem "muzzle_snds_b";  
man4 addMagazine ["DemoCharge_Remote_Mag",2];  
man4 additem "optic_Holosight";  

removeAllWeapons man5;  
man5 addbackpack "B_AssaultPack_blk";  
man5 addWeapon "arifle_MX_ARCO_point_grip_F";    
(unitBackpack man5) addMagazineCargo ["30Rnd_65x39_caseless_mag",8];
(unitBackpack man5) addMagazineCargo ["HandGrenade", 4];  
man5 additem "FirstAidKit";  
man5 additem "FirstAidKit";  
man5 addITEM "NVGoggles";  
man5 assignItem "NVGoggles";  
man5 addItem "muzzle_snds_b";  
man5 addMagazine ["DemoCharge_Remote_Mag",2]; 
man5 additem "optic_Holosight";}

Edited by HavocDemon

Share this post


Link to post
Share on other sites

Have you tried it?

	// Add backpack
_unit addBackpack "B_AssaultPack_blk";

// Change the backpack's loadout
private ["_backpack"];
_backpack = unitBackpack _unit;
clearMagazineCargoGlobal _backpack;
_backpack addmagazineCargoGlobal ["20rnd_762x45_mag", 2];
_backpack addmagazineCargoGlobal ["DemoCharge_Remote_Mag", 4];
_backpack additemCargoGlobal ["FirstAidKit", 1];
_backpack additemCargoGlobal ["optic_holosight",1];
_backpack additemCargoGlobal ["acc_flashlight",1];

Edited by cobra4v320

Share this post


Link to post
Share on other sites
Have you tried it?

	// Add backpack
_unit addBackpack "B_AssaultPack_blk";

// Change the backpack's loadout
private ["_backpack"];
_backpack = unitBackpack _unit;
clearMagazineCargoGlobal _backpack;
_backpack addmagazineCargoGlobal ["20rnd_762x45_mag", 2];
_backpack addmagazineCargoGlobal ["DemoCharge_Remote_Mag", 4];
_backpack additemCargoGlobal ["FirstAidKit", 1];
_backpack additemCargoGlobal ["optic_holosight",1];
_backpack additemCargoGlobal ["acc_flashlight",1];

new strange issue, so now the guns load, but I dont see them with the right guns. So I see players with their old gear (some of them anyways), but some players I see with the new gear. on them.

Share this post


Link to post
Share on other sites

This is what I like to use, but all the playable units get the same gear.

// Add Weapons & Gear
changeLoadout = {
private ["_unit"];
_unit = _this;

// Remove the unit's default weapons and items
removeallweapons _unit;
removeallassigneditems _unit;

// Add rifle with suppressor and magazines
_unit addMagazines ["20rnd_762x45_mag",9];
_unit addWeapon "arifle_MXM_F";
_unit addPrimaryWeaponItem "muzzle_snds_B";
_unit addPrimaryWeaponitem "optic_Arco"; 
_unit addprimaryweaponitem "acc_pointer_IR"; 

// Add pistol and magazines
_unit addMagazines ["16rnd_9x21_mag",2];
_unit addWeapon "hgun_P07_F";
_unit addHandgunItem "muzzle_snds_L";

// Add items
_unit additem "nvgoggles";
_unit  assignItem "nvgoggles";
_unit additem "ItemCompass"; 
_unit assignItem "ItemCompass"; 
_unit assignItem "ItemMap"; 
_unit additem "itemgps"; 
_unit assignitem "itemgps";
_unit additem "FirstAidKit"; 
_unit addGoggles "G_Diving";

// Add backpack
_unit addBackpack "B_AssaultPack_blk";

// Change the backpack's loadout
private ["_backpack"];
_backpack = unitBackpack _unit;
clearMagazineCargoGlobal _backpack;
_backpack addmagazineCargoGlobal ["20rnd_762x45_mag", 2];
_backpack addmagazineCargoGlobal ["DemoCharge_Remote_Mag", 4];
_backpack additemCargoGlobal ["FirstAidKit", 1];
_backpack additemCargoGlobal ["optic_holosight",1];
_backpack additemCargoGlobal ["acc_flashlight",1];
};

// Doesn't need to be run on the dedicated server itself
if (!(isDedicated)) then {
// Wait for JIP
waitUntil {!(isNull player)};

// Change the player's loadout initially
player call changeLoadout;
};

// Apply to all units set to Playable
{
// Change loadout upon respawn
_x addEventHandler [
	"Respawn",	// Respawn event handler
	{
		// Find the newly-respawned unit
		private ["_unit"];
		_unit = _this select 0;

		// Change loadout
		_unit call changeLoadout;
	}
];
} forEach playableUnits;

Share this post


Link to post
Share on other sites

I have almost same problem, my coop mission starting items work fine with AI but when trying with players everyone start loosing backbags/ammo.

Share this post


Link to post
Share on other sites
I have almost same problem, my coop mission starting items work fine with AI but when trying with players everyone start loosing backbags/ammo.

Same basic issue for me in this thread: http://forums.bistudio.com/showthread.php?150478-Scripts-work-for-myself-and-for-AIs-but-not-for-other-players

Stuff works fine for the host and AI, but not for players

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  

×