Closed ChawDinky closed 5 years ago
Please read "readme"
No loadouts are working. I have tried to do all i can. It would be greatly appropriated if someone could help me with this problem. After reinstall of this mod still no loadouts are working. Static or random. @Da0ne or @chinayern can one of you please help me. I understand your busy. I have discord.
There has to be a way around this.
I don't think you have operated according to "readme". Resulting in missing files.
Step One: Go to your server directory and create a folder, name the folder what ever you desire son. (just give it a damn name that is not NewFolder) Step Two: open the folder 'mpmissions' in your server directory, copy the file 'DayZSurvival.chernarusplus' and place it in there. (If you had any edits done to your loot xmls and wish to keep the storage make sure you replace it with the ones that are in 'DayZSurvival.chernarusplus' ) The db folder contains NO MODDED features/changes its all vanilla same goes with other xmls. Replace it with your modded xmls if you wish to. Step Three: The server config file 'serverDZ.cfg' is in the main directory (Vanilla Fresh copy from steam), MOVE that file into the folder you created in step 1 Open up the config file and go to the bottom where you see 'dayzOffline.chernarusplus' REPLACE IT with 'DayZSurvival.chernarusplus' Save and exit. Step Four: Place the foler 'ModdedScripts' into your main DayZ Server directory where the .exe is and all that stuff. Step Five: add the following startup command lines to your server: -mod=ModdedScripts -config=NameOfFolderFromStep1\serverDZ.cfg -profiles=NameOfFolderFromStep1 -name=myServerName The -name command will change the name that shows up in global chat. When players join/leave/getkilled and other GlobalMessages. if you wish to actiavte any other mods listed in the Features list. Just add the command line to whatever starts your server exe.
Did you ever get this figured out? I am having the exact issue and I have gone over the readme file step by step several times and can not see what I am doing wrong. Can you please post your solution if so?
My solution 1.Check that the ModdedScripts directory exists in the DayZServer directory. 2.Check that the "DayZSurvival. chernarusplus" directory exists in "DayZServer mpmissions" 3.Check "serverDZ.cfg". class Missions { class DayZ { template="DayZSurvival.chernarusplus"; //used mission //first part is mission name, second part is used map }; }; 4.Check Start.bat Include the following contents start "Dayz_SA" /wait /affinity FF /high "DayZServer_x64.exe" -mod=ModdedScripts 5.Do not make any script modifications before running successfully 6.Close your eyes and think about it. Is there anything else that could go wrong? 7.Start Server
ONLY install the admintool
You need to inherit and rewrite related functions yourself
So the error in the function 'spawnInGun' in the AdvancedLoadouts.c script comes from this line
if (isMainGun) { itemAI = player.GetHumanInventory().CreateInHands( item );
where for some reason the character already spawns with a pile of rags in hand(I have not found where that is yet). If you change this to
itemAI = player.GetHumanInventory().CreateInInventory( item );
(I guess this defeats the purpose of the "main gun" "secondary gun" option...)
then there are nor longer any errors in this script and the character spawns in the the weapon in inventory. However this is problematic with the default Jeans and Hoodie clothes because there isnt enough room but when 'm_RandomizedLoadouts = true' it works out fine.
So basically the problem lies in a player respawning with its hands already full and when you try to spawn a gun in the had it breaks the script. I will keep looking but if anyone knows how this might be fixed please feel free to chime in.
Ok think I found it...
AdvanvedLoadouts.c
`void LoadRndGenLoadout(PlayerBase player) { ItemBase itemBs; EntityAI itemEnt; player.RemoveAllItems();
if (Bags.Count() > 0) { player.GetInventory().CreateInInventory( Bags.GetRandomElement() ); }
if (Gloves.Count() > 0) { player.GetInventory().CreateInInventory( Gloves.GetRandomElement() ); }
if (Vests.Count() > 0) { player.GetInventory().CreateInInventory( Vests.GetRandomElement() ); }
if (Tops.Count() > 0) { player.GetInventory().CreateInInventory( Tops.GetRandomElement() ); }
if (Pants.Count() > 0) { player.GetInventory().CreateInInventory( Pants.GetRandomElement() ); }
if (Boots.Count() > 0) { player.GetInventory().CreateInInventory( Boots.GetRandomElement() ); }
if (HeadGear.Count() > 0) { player.GetInventory().CreateInInventory( HeadGear.GetRandomElement() ); }
player.GetInventory().CreateInInventory( "Battery9V" );
player.GetInventory().CreateInInventory( "Rag" ); // Spawns a Rag in inventory correctly
//Commented out the code below and rag no long spawns in hand breaking the gun inhand
//itemEnt = player.GetInventory().CreateInInventory( "Rag" );
//itemBs = ItemBase.Cast(itemEnt);
//itemBs.SetQuantity(6);
player.SetQuickBarEntityShortcut(itemBs, 0, true);
}`
In this function it removes all player items then does the if checks and adds the random item for the loadout, then at the bottom it creates a battery in inventory which works fine but then below creates a random pile of rags. Once I comment out these rag lines, the rest of the script functions seemingly fine with the "main" gun spawning inHand as mentioned in my above comment.
I am still working through the code to see if this is it for sure but progress is looking good so far.
Ok next when
protected bool m_StaticLoadouts = true; protected bool m_RandomizedLoadouts = false; protected bool m_SpawnArmed = true;
At the top of 'AdvancedLoadouts.c' the random rag in the hand comes back and breaks the script again so I found and edited it out near the end of the 'SpawnLoadout' function as below
`void SpawnLoadout(PlayerBase player, bool status, array
ref TStringArray arrAttachments = new TStringArray;
ref map<string, TStringArray> ItemInSlotChildren = new map<string, TStringArray>;
ref map<string,map<string, TStringArray>> ItemInInentory = new map<string,map<string, TStringArray>>;
ref map<string,map<string,map<string, TStringArray>>> ItemInSlot = new map<string,map<string,map<string, TStringArray>>>;
ref map<string,map<string,map<string,map<string, TStringArray>>>> ContainerObject = new map<string,map<string,map<string,map<string, TStringArray>>>>;
string MainDirectoy = "$profile:Static_Loadouts";
if (status)
{
string SelectedLoadout = Directorys.Get(GimmeRandom(Directorys.Count()));
TStringArray stSlots = {"Hands","Shoulder","Melee","HeadGear","Mask","EyeWear","Gloves","Armband","Body","Vest","Back","Legs","Feet"};
string CurentCatagory;
for (int i = 0; i < stSlots.Count(); ++i)
{
CurentCatagory = stSlots.Get(i);
string jsonSavePath = MainDirectoy + "\\" + SelectedLoadout + "\\" + CurentCatagory +".json";
if (FileExist(jsonSavePath))
{
JsonFileLoader<map<string,map<string,map<string,map<string,map<string, TStringArray>>>>>>.JsonLoadFile(jsonSavePath, SavedData);
arrAttachments = new TStringArray;
ItemInSlotChildren = new map<string, TStringArray>;
ItemInInentory = new map<string,map<string, TStringArray>>;
ItemInSlot = new map<string,map<string,map<string, TStringArray>>>;
ContainerObject = new map<string,map<string,map<string,map<string, TStringArray>>>>;
string mKey,strAttachments,strClassName,strType,strSlot,strFatherslot;
int x = 0;
//Read maps
for (x = 0; x < SavedData.Count(); ++x)
{
mKey = SavedData.GetKey(x);
strFatherslot = mKey;
ContainerObject = SavedData.Get(mKey);
}
for (x = 0; x < ContainerObject.Count(); ++x)
{
mKey = ContainerObject.GetKey(x);
strSlot = mKey;
ItemInSlot = ContainerObject.Get(mKey);
}
for (x = 0; x < ItemInSlot.Count(); ++x)
{
mKey = ItemInSlot.GetKey(x);
strType = mKey;
ItemInInentory = ItemInSlot.Get(mKey);
}
for (x = 0; x < ItemInInentory.Count(); ++x)
{
mKey = ItemInInentory.GetKey(x);
strClassName = mKey;
ItemInSlotChildren = ItemInInentory.Get(mKey);
}
arrAttachments = LoadParameterArray(ItemInSlotChildren,"Inventory");
ItemBase itemBs;
EntityAI itemEnt;
TStringArray ExtrasArray;
TStringArray AttachmentsArray;
int j = 0;
if (GetGame().IsKindOf( strClassName, "Rifle_Base"))
{
ExtrasArray = {};
AttachmentsArray = {};
if (arrAttachments.Count() >= 1)
{
for (j = 0; j < arrAttachments.Count(); ++j)
{
if (GetGame().IsKindOf( arrAttachments.Get(j), "Magazine_Base") && ! (GetGame().IsKindOf( arrAttachments.Get(j), "Ammunition_Base")) )
{
ExtrasArray.Insert( arrAttachments.Get(j) );
}
else
{
AttachmentsArray.Insert( arrAttachments.Get(j) );
}
}
}
if (CurentCatagory == "Shoulder")
{
SpawnGunIn( player , strClassName, false, AttachmentsArray, ExtrasArray );
}
else { SpawnGunIn( player , strClassName, true, AttachmentsArray, ExtrasArray ); }
}
else
{
itemEnt = player.GetInventory().CreateInInventory( strClassName );
itemBs = ItemBase.Cast(itemEnt);
if (arrAttachments.Count() >= 1)
{
for (j = 0; j < arrAttachments.Count(); ++j)
{
ExtrasArray = {};
AttachmentsArray = {};
if (GetGame().IsKindOf( arrAttachments.Get(j), "Pistol_Base"))
{
if (GetGame().IsKindOf( arrAttachments.Get(j), "Magazine_Base") && ! (GetGame().IsKindOf( arrAttachments.Get(j), "Ammunition_Base")) )
{
ExtrasArray.Insert( arrAttachments.Get(j) );
}
else
{
AttachmentsArray.Insert( arrAttachments.Get(j) );
}
SpawnGunIn( player , arrAttachments.Get(j), false, AttachmentsArray, ExtrasArray );
}
else
{
itemBs.GetInventory().CreateInInventory( arrAttachments.Get(j) );
}
}
}
}
}
}
}
else
{
//Do Vanilla if no other loadouts are found
ItemBase TrashBase;
EntityAI ShitBase;
/*Commented all this out as it causes a rag to spawn in player hand and break the spawn
with gun in hand function.*/
//ShitBase = player.GetInventory().CreateInInventory( "Rag" );
//TrashBase = ItemBase.Cast(ShitBase);
//TrashBase.SetQuantity(1);
Print("StartingEquipSetup>>ERROR:: No Static Custom Loadouts were found!");
}
}`
Still cannot get "export" to work and create an exported loadout though...
OK with the above errors seemingly fixed (for me at least) I was able to see an erro when the "/export" command was executed.
Class: 'AdvancedLoadouts' Function: 'ConstructCargoArray' Stack trace: $CurrentDir://mpmissions//DayZSurvival.chernarusplus//ScriptedMods//Modules//AdvancedLoadouts//AdvancedLoadouts.c:106 $CurrentDir://mpmissions//DayZSurvival.chernarusplus//ScriptedMods//Modules//AdvancedLoadouts//AdvancedLoadouts.c:159 $CurrentDir://mpmissions//DayZSurvival.chernarusplus//ScriptedMods//Modules//AdvancedLoadouts//AdvancedLoadouts.c:148 $CurrentDir://mpmissions//DayZSurvival.chernarusplus//ScriptedMods//Modules//AdminTool//AdminTool.c:339 $CurrentDir://mpmissions//DayZSurvival.chernarusplus//ScriptedMods//Modules//ServerMission//DayZSurvival.c:183 scripts/3_Game/dayzgame.c:872
So no saving of a load out until this is corrected if anyone else has a fix for this or it is working fine please let me know.
I can confirm #43 does not fix this Crash - Waiting for a fix