R0T 1 Posted April 22, 2013 Hey, i have a problem with my mission or maybe i get here something not right. I have 4 unit in my mission and each unit has the following code in its init code block in the editor. They get ported in the boot and all get the same equipment this moveInCargo Boat2;this addbackpack "b_kitbag_base"; (unitBackpack this) addmagazineCargo ["SatchelCharge_Remote_Mag",2]; this addItem "optic_Hamr"; this addPrimaryWeaponItem "muzzle_snds_H"; this addmagazine "smokeshell"; this addmagazine "smokeshell"; this addmagazine "handgrenade"; this addmagazine "handgrenade"; this addmagazine "handgrenade"; this addmagazine "handgrenade"; this addWeapon "Binocular"; Now one player reports me that only one unit has the Satchel Charges in the inventory. I check the mission in the Editor and in Multiplayer on my own machine and there all the units have them. Could it be that this only works on on the server and not on the clients ??? I thought that this init is called on any pc or is this not right ??? And what can i cange too make it work. Or has the player maybe a broken file ?? Thx in advance for the help ! The mission is her Download on Armaholic Share this post Link to post Share on other sites
cobra4v320 27 Posted April 23, 2013 (edited) Placed into each of the 4 units init: this assignAsCargo boat2; this moveInCargo Boat2; Placed into your init.sqf file: // Add Weapons & Gear changeLoadout = { private ["_unit"]; _unit = _this; // Add the backpack _unit addBackpack "b_kitbag_base"; private ["_backpack"]; // Change the backpack's loadout _backpack = unitBackpack _unit; clearMagazineCargoGlobal _backpack; _backpack addmagazineCargoGlobal ["SatchelCharge_Remote_Mag", 2]; _backpack addItem "optic_Hamr"; // Add other gear _unit addPrimaryWeaponItem "muzzle_snds_H"; _unit addmagazines ["smokeshell",2]; _unit addmagazines ["handgrenade",4]; _unit addWeapon "Binocular"; }; // 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 { _x addEventHandler [ // Change loadout upon respawn "Respawn", // Respawn event handler { // Find the newly-respawned unit private ["_unit"]; _unit = _this select 0; // Change loadout _unit call changeLoadout; } ]; } forEach playableUnits; Edited April 24, 2013 by cobra4v320 Share this post Link to post Share on other sites
R0T 1 Posted April 23, 2013 (edited) First THX very very much for you answer but i really want to lerne this and not just copy past it. So please help me get this straight ! So this is what i understand you are doing ..... With this you are define a function with the Name changeLoadout changeLoadout = { private ["_unit"]; _unit = _this; _unit addBackpack "b_kitbag_base"; private ["_backpack"]; _backpack = unitBackpack _unit; clearMagazineCargoGlobal _backpack; _backpack addmagazineCargoGlobal ["SatchelCharge_Remote_Mag", 2]; _backpack addItem "optic_Hamr"; _unit addPrimaryWeaponItem "muzzle_snds_H"; _unit addmagazines ["smokeshell",2]; _unit addmagazines ["handgrenade",4]; _unit addWeapon "Binocular"; }; after that you check if its a dedicated server if this is true you wait till there is a player ?! And call the changeLoadout function for the player ?! if (!(isDedicated)) then { waitUntil {!(isNull player)}; player call changeLoadout; }; This Part i commented out in the init because im using =BTC= Revive and i think this one call the function again when theplayer get respawnt right ?! But i want the =BTC Revive skript let handel the gear thing if someone dies snd get revived. { _x addEventHandler [ "Respawn", { private ["_unit"]; _unit = _this select 0; _unit call changeLoadout; } ]; } forEach playableUnits; But what happens when i want too play the mission with the AI ??? I understand it that way that they don't get the charges and muzzles ... thats right ? Because there are not players so the function don't get called Now Just one more Question ..... why is this making any difference to my solution . is the init line in the editor only get processed on the host or server and not on the clients ??? Why is my solution not working . Is there a guide or something that can help me too understand that issue ?? I found somthing on the wiki but that is not going very deep and is about armed assault with sqs syntax... ;( Thx again for the help in advance !!! Edited April 23, 2013 by R0T Share this post Link to post Share on other sites
R0T 1 Posted April 26, 2013 Can maybe someone else explain this too me ??? I really want too understand this ! Share this post Link to post Share on other sites