Andro ID Gaming 0 Posted December 16, 2023 Hello, I created an init.c, when I respawn the game selects one of twelve players, it works but I still have the following problem: - Equipment is all flawless, how can I set it to only have 50% - how can I get weapons with attachments, I currently have the attachments placed under the weapon, which works, only the magazine is in the inventory. - Silencer or bayonet, currently I have a silencer equipped and the bayonet is supposed to be in a backpack, 1. Bayonet he holds in his hand, 2. is not there. - Glow stick is attached to the backpack, but walkie talkie is not. Maybe someone could change the init.c for me (this is just the beginning of the init.c) paste.bin: https://pastebin.com/kGXfGMZ3 Share this post Link to post Share on other sites
Sid Debian 132 Posted December 21, 2023 On 12/16/2023 at 4:55 PM, Andro ID Gaming said: Hello, I created an init.c, when I respawn the game selects one of twelve players, it works but I still have the following problem: - Equipment is all flawless, how can I set it to only have 50% - how can I get weapons with attachments, I currently have the attachments placed under the weapon, which works, only the magazine is in the inventory. - Silencer or bayonet, currently I have a silencer equipped and the bayonet is supposed to be in a backpack, 1. Bayonet he holds in his hand, 2. is not there. - Glow stick is attached to the backpack, but walkie talkie is not. Maybe someone could change the init.c for me (this is just the beginning of the init.c) paste.bin: https://pastebin.com/kGXfGMZ3 I'm sorry not really interested to use pastebin so here the code: Spoiler ntityAI itemEnt; EntityAI entyAI; EntityAI subEntyAI; Weapon_Base wpnbs; switch (Math.RandomInt(0, 12)) { case 0: // WinterGear_MountainBag // Weapons + Attachments // M4 // Ammunation + Magazine in Inventory (Backpack) entyAI = player.GetInventory().CreateInInventory("WinterGear_M4"); // Let's guess that's an M4 entyAI.SetHealth((entyAI.GetMaxHealth() / 2)); // Each item has own ammount of thealth. So get max and devive on 2 = 50% player.SetQuickBarEntityShortcut(entyAI, 0, true); // Slot First weapon to ours 1st quickbar slot entyAI.GetInventory().CreateInInventory("M4_OEBttstck"); entyAI.GetInventory().CreateInInventory("M4_RISHndgrd"); entyAI.GetInventory().CreateInInventory("UniversalLight"); entyAI.GetInventory().CreateInInventory("Battery9V"); entyAI.GetInventory().CreateInInventory("ACOGOptic_6x"); entyAI.GetInventory().CreateInInventory("M4_Suppressor"); //wpnbs = Weapon_Base.Cast(entyAI); // Recast to Weapon firearm for chambering & attach the magazine on spawn //wpn_bs.SpawnAttachedMagazine("Mag_CMAG_40Rnd"); // Weapons + Attachments // AKM // Ammunation + Magazine in Inventory (Backpack) entyAI = player.GetInventory().CreateInInventory("WinterGear_AKM"); entyAI.SetHealth((entyAI.GetMaxHealth() / 2)); // Each item has own ammount of thealth. So get max and devive on 2 = 50% player.SetQuickBarEntityShortcut(entyAI, 1, true); // Slot Second weapon to ours 2nd quickbar slot entyAI.GetInventory().CreateInInventory("AKS74U_Bttstck"); entyAI.GetInventory().CreateInInventory("AK_RailHndgrd_Black"); entyAI.GetInventory().CreateInInventory("UniversalLight"); entyAI.GetInventory().CreateInInventory("Battery9V"); subEntyAI = entyAI.GetInventory().CreateInInventory("PSO11Optic"); // Create opticks on AK subEntyAI.GetInventory().CreateInInventory("Battery9V"); // And slot the battery entyAI.GetInventory().CreateInInventory("AK_Suppressor"); //wpnbs = Weapon_Base.Cast(entyAI); // Recast to Weapon firearm for chambering & attach the magazine on spawn //wpn_bs.SpawnAttachedMagazine("Mag_AKM_30Rnd"); // Clothing - Boots + Vest + Attachments entyAI = player.GetInventory().CreateInInventory("WinterGear_MilitaryBoots"); entyAI.GetInventory().CreateInInventory("CombatKnife"); // Create in the boots entyAI = player.GetInventory().CreateInInventory("MilitaryBelt"); entyAI.GetInventory().CreateInInventory("NylonKnifeSheath"); // Create on th belt entyAI.GetInventory().CreateInInventory("PlateCarrierHolster_Camo"); // Create on th belt entyAI.GetInventory().CreateInInventory("Canteen"); // Create on th belt entyAI = player.GetInventory().CreateInInventory("WinterGear_PlateCarrierVest"); entyAI.GetInventory().CreateInInventory("M67Grenade"); // Create granade on the plate carrier! entyAI.GetInventory().CreateInInventory("M67Grenade"); // Create granade on the plate carrier! entyAI.GetInventory().CreateInInventory("M67Grenade"); // Create granade on the plate carrier! entyAI.GetInventory().CreateInInventory("M67Grenade"); // Create granade on the plate carrier! entyAI.GetInventory().CreateInInventory("WinterGear_PlateCarrierHolster"); // Slot attachments to the platecarrier entyAI.GetInventory().CreateInInventory("WinterGear_PlateCarrierPouches"); // Backpack + Attachments entyAI = player.GetInventory().CreateInInventory("WinterGear_MountainBag"); entyAI.GetInventory().CreateInInventory("Chemlight_White"); subEntyAI = entyAI.GetInventory().CreateInInventory("WalkieTalkie"); subEntyAI.GetInventory().CreateInInventory("Battery9V"); // create batter attached to waliketalkie // Heatpack ALL ITEMS WOULD INSIDE BACKPACK entyAI.GetInventory().CreateInInventory("Heatpack"); entyAI.GetInventory().CreateInInventory("SuperHeatpack"); // Inventory - Attachments + Magazines + Ammunation entyAI.GetInventory().CreateInInventory("Mag_AKM_30Rnd"); //Throw items to the backpack entyAI.GetInventory().CreateInInventory("Mag_CMAG_40Rnd"); entyAI.GetInventory().CreateInInventory("AmmoBox_556x45_20Rnd"); entyAI.GetInventory().CreateInInventory("AmmoBox_762x54_20Rnd"); entyAI.GetInventory().CreateInInventory("M9A1_Bayonet"); entyAI.GetInventory().CreateInInventory("AK_Bayonet"); // Inventory - Food + Medic player.GetInventory().CreateInInventory("WaterBottle"); player.GetInventory().CreateInInventory("PainkillerTablets"); player.GetInventory().CreateInInventory("CanOpener"); player.GetInventory().CreateInInventory("HuntingKnife"); player.GetInventory().CreateInInventory("CharcoalTablets"); player.GetInventory().CreateInInventory("PurificationTablets"); player.GetInventory().CreateInInventory("Morphine"); player.GetInventory().CreateInInventory("BandageDressing"); player.GetInventory().CreateInInventory("BandageDressing"); player.GetInventory().CreateInInventory("BandageDressing"); // Clothing + without Attachments player.GetInventory().CreateInInventory("WinterGear_M65Jacket_camo"); player.GetInventory().CreateInInventory("WinterGear_CargoPants_camo"); player.GetInventory().CreateInInventory("WinterGear_Ushanka"); player.GetInventory().CreateInInventory("WinterGear_Balaclava"); player.GetInventory().CreateInInventory("WinterGear_TacticalGloves"); player.GetInventory().CreateInInventory("Armband_White"); break; case 1: // WinterGear_TaloonBag I didn't check the result of that code but in your example there's a tons of bad behaviors: 1. Too many unnecessary code like "itemBs = ItemBase.Cast(itemEnt);" - if you don't use the item don't recast it. just leave it alone. 2. Using ItemBase when Unit.GetInventory().CreateInInventory returns the EntityAI, and it's child from ItemBase (the parent class). Aware of those mistakes it's slowdown your server and eating much memory for nothing! Also I'd leaved the commented strings uner M4 & AKM - comment them and get already attached mag with ammo in chamber @ the spawn! I hope that will help you to understand how it all working. 1 Share this post Link to post Share on other sites
Sid Debian 132 Posted December 21, 2023 On 12/16/2023 at 4:55 PM, Andro ID Gaming said: Hello, I created an init.c, when I respawn the game selects one of twelve players, it works but I still have the following problem: - Equipment is all flawless, how can I set it to only have 50% - how can I get weapons with attachments, I currently have the attachments placed under the weapon, which works, only the magazine is in the inventory. - Silencer or bayonet, currently I have a silencer equipped and the bayonet is supposed to be in a backpack, 1. Bayonet he holds in his hand, 2. is not there. - Glow stick is attached to the backpack, but walkie talkie is not. Maybe someone could change the init.c for me (this is just the beginning of the init.c) paste.bin: https://pastebin.com/kGXfGMZ3 Sorry the forum blocked my code so i'll upload to pastebin.PasteBin I didn't check the result of that code but in your example there's a tons of bad behaviors: 1. Too many unnecessary code like "itemBs = ItemBase.Cast(itemEnt);" - if you don't use the item don't recast it. just leave it alone. 2. Using ItemBase when Unit.GetInventory().CreateInInventory returns the EntityAI, and it's child from ItemBase (the parent class). Aware of those mistakes it's slowdown your server and eating much memory for nothing! Also I'd leaved the commented strings uner M4 & AKM - comment them and get already attached mag with ammo in chamber @ the spawn! I hope that will help you to understand how it all working. 1 Share this post Link to post Share on other sites
Sid Debian 132 Posted December 21, 2023 (edited) Here for you your code PasteBin Edited December 21, 2023 by Sid Debian 1 Share this post Link to post Share on other sites
Sid Debian 132 Posted December 21, 2023 On 12/16/2023 at 4:55 PM, Andro ID Gaming said: Hello, I created an init.c, when I respawn the game selects one of twelve players, it works but I still have the following problem: - Equipment is all flawless, how can I set it to only have 50% - how can I get weapons with attachments, I currently have the attachments placed under the weapon, which works, only the magazine is in the inventory. - Silencer or bayonet, currently I have a silencer equipped and the bayonet is supposed to be in a backpack, 1. Bayonet he holds in his hand, 2. is not there. - Glow stick is attached to the backpack, but walkie talkie is not. Maybe someone could change the init.c for me (this is just the beginning of the init.c) paste.bin: https://pastebin.com/kGXfGMZ3 Idk cant post answer here. try other way: https://pastebin.com/FAzMZ15L 1 Share this post Link to post Share on other sites