[RELEASE] Custom loadouts per player

FallingSheep

OpenDayZ Lord!
Name: Custom loadouts per player

Description: creates load out based on player GUID

so modified the random loadout scripts from below to allow a custom loadout per player (based on GUID/SteamID)


open init.c and replace this
Code:
override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
/*
        player.RemoveAllItems();

        EntityAI item = player.GetInventory().CreateInInventory(topsArray.GetRandomElement());
        EntityAI item2 = player.GetInventory().CreateInInventory(pantsArray.GetRandomElement());
        EntityAI item3 = player.GetInventory().CreateInInventory(shoesArray.GetRandomElement());
*/
        EntityAI itemEnt;
        ItemBase itemBs;
       
        itemEnt = player.GetInventory().CreateInInventory("Rag");
        itemBs = ItemBase.Cast(itemEnt);
        itemBs.SetQuantity(4);
        SetRandomHealth(itemEnt);

        itemEnt = player.GetInventory().CreateInInventory("RoadFlare");
        itemBs = ItemBase.Cast(itemEnt);
    }
with this
Code:
override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
        player.RemoveAllItems();     
       
        EntityAI itemEnt;
        ItemBase itemBs;
        //get player SteamID
        GUID = player.GetIdentity().GetPlainId();//Steam 64

        player1 = 78787877878;//Steam 64
        player2 = 78787877878;//Steam 64
        player3 = 78787877878;//Steam 64
       
        //custom load out
        if(GUID == player1)
        {
            EntityAI item = player.GetInventory().CreateInInventory("SVD");
            itemBs = ItemBase.Cast(itemEnt);
            SetHealth(itemEnt, 20);
           
            itemEnt = player.GetInventory().CreateInInventory("Rag");
            itemBs = ItemBase.Cast(itemEnt);
            itemBs.SetQuantity(4);
            SetRandomHealth(itemEnt);
           
            itemEnt = player.GetInventory().CreateInInventory("HuntingBag");
            itemBs = ItemBase.Cast(itemEnt);
            SetRandomHealth(itemEnt);
              
        }
        else if(GUID == player2)
        {
               EntityAI item = player.GetInventory().CreateInInventory("SVD");
            itemBs = ItemBase.Cast(itemEnt);
            SetHealth(itemEnt, 20);
           
            itemEnt = player.GetInventory().CreateInInventory("Rag");
            itemBs = ItemBase.Cast(itemEnt);
            itemBs.SetQuantity(4);
            SetRandomHealth(itemEnt);
           
            itemEnt = player.GetInventory().CreateInInventory("HuntingBag");
            itemBs = ItemBase.Cast(itemEnt);
            SetRandomHealth(itemEnt);
        }
        else if(GUID == player3)
        {
               EntityAI item = player.GetInventory().CreateInInventory("SVD");
            itemBs = ItemBase.Cast(itemEnt);
            SetHealth(itemEnt, 20);
           
            itemEnt = player.GetInventory().CreateInInventory("Rag");
            itemBs = ItemBase.Cast(itemEnt);
            itemBs.SetQuantity(4);
            SetRandomHealth(itemEnt);
           
            itemEnt = player.GetInventory().CreateInInventory("HuntingBag");
            itemBs = ItemBase.Cast(itemEnt);
            SetRandomHealth(itemEnt);
        }else{
         //standard loadout
            EntityAI itemEnt;
            ItemBase itemBs;
           
            itemEnt = player.GetInventory().CreateInInventory("Rag");
            itemBs = ItemBase.Cast(itemEnt);
            itemBs.SetQuantity(4);
            SetRandomHealth(itemEnt);
   
            itemEnt = player.GetInventory().CreateInInventory("RoadFlare");
            itemBs = ItemBase.Cast(itemEnt);
        }
      
    }
make sure to change player1,2,3 etc to your Steam64 id
 

n0yz

New Member
Is this possible?
police = 78787877878,75577847578,74567356857;//Steam 64
biker = 78787877878;//Steam 64
medic = 78787877878;//Steam 64
 

FallingSheep

OpenDayZ Lord!
Is this possible?
police = 78787877878,75577847578,74567356857;//Steam 64
biker = 78787877878;//Steam 64
medic = 78787877878;//Steam 64
hmm not sure dont think so as thats an array and the script looks for and eaxct match, i could prob change it to accept an array
 

n0yz

New Member
[QUOTE = "FallingSheep, post: 123771, miembro: 4806"] hmm no estoy seguro, no lo creo, ya que eso es una matriz y la secuencia de comandos busca y eaxct coincide, probablemente podría cambiarlo para aceptar una matriz [/ QUOTE]
Please :)
 
Doesnt work for me :/ i cant join the Server after i implementing this changes.
when i click Play, then i stuck in the first loading screen... Dont know whats wrong

Then if i Restart the game, Server Shows not more in the Server list.
 
Last edited:
Hey, i'm new here and works on my Server and the Loadout doesnt work for me, in row "GUID = player.GetIdentity().GetPlainId();" cant find variable 'GUID':D
 
I get the same issue.....any response on this yet? Great Idea and i would love to implement it. Even a hint as to where to get the relevant classes to figure it out myself would be great!
OK I figured it out...

You need to declare the variables for GUID, player1 etc...at the beginning of the init.c file and it works...
 
Folks, just to share my solution.... I am no expert programmer so it's likely not beautiful but it works. This code is implemented on my test server and works. It provides 5 of my testers preassigned kit on spawn and spawns them into the Prison. This works fully with the current Dayz Standalone distribution.

I am modifying it to clean up and reduce the code, using arrays for the kit. Also I am converting the code to provide pre-assembled weapons...I didn't know how to do that until last night. The ability to spawn in the prison is nice, because we have been stress testing the server by playing some scenarios and i have been manually loading up the server with AI...they were dying and I was having to teleport them.

The actual GUIDs have been removed...replace with real ones. I hope it helps...please ping me and share if you improve or have other ideas... I am just learning as I go. This also provides you with a bridge to Prison Island that I created and also Skalisti Island. If you use the bridges, I would appreciate a mention "Snifferson's bridges" it took me a while to do them...not rocket science but would appreciate it. Also feel free to visit us as we build our server, test and play at [EU] EG-1|1PP HC|Persistance|Building|Redux|Mods as I mod the server, anything I build or code I will share.

Snifferson

file here:
http://s000.tinyupload.com/?file_id=05416983691440225298
 
Top