Jump to content
Mack2923

Custom Loadouts

Recommended Posts

Hello Community.

I am a brand new server owner and am, like many others, trying to customize the experience for my players.

I am not a programmer, coder, modder. I am a player that is trying to expand his knowledge and create something unique. I do have a strong background in MS Excel so I am not totally ignorant to opening and closing operators, arguments, etc. This background has helped me quite a bit so far but i keep running into the same wall....i don't know this language, its operators, commands, etc.

I look through the int c file and my eyes get blurry and sometimes i drool in confusion.

I do best when i can actually comprehend what the code says instead of just copy/paste and fiddle with it until it works. Ideally I would like to be able to read a line of code in my init.c file and be able to read it like a sentence in a book.

If anyone can point me towards a good reference it would be much appreciated. 

 

Specifically i am trying to customize the load out for new spawns. I have seen many examples while sifting through search results. I have seen pages that detail multiple loadouts, arrays of loadouts, etc.

I am just trying to get one simple yet generous loadout for my players.

1. Is there any way to get a rifle to spawn in a specific rifle slot? I saw one post that suggested to put rifles first as the AI will automatically put it in a rifle slot. The post also detailed to put the attachments to the rifle next in terms of code as not to have the attachments end up in the jacket or pants inventory.

2. This is what I have pieced together so far:

player.RemoveAllItems();

        EntityAI itemEnt;
        ItemBase itemBs;
        float rand;

        player.GetInventory().CreateInInventory("ChestHolster");itemBs = ItemBase.Cast(itemEnt);
        player.GetInventory().CreateInInventory("MakarovIJ70");itemBs = ItemBase.Cast(itemEnt);
        player.GetInventory().CreateInInventory("Mag_MakarovPB_8Rnd");itemBs = ItemBase.Cast(itemEnt);
        player.GetInventory().CreateInInventory("PistolSuppressor");itemBs = ItemBase.Cast(itemEnt); 
        player.GetInventory().CreateInInventory("BeanieHat_Black");itemBs = ItemBase.Cast(itemEnt);
        player.GetInventory().CreateInInventory("HikingBoots_Brown");itemBs = ItemBase.Cast(itemEnt);
        player.GetInventory().CreateInInventory("WorkingGloves_Beige");itemBs = ItemBase.Cast(itemEnt);
        player.GetInventory().CreateInInventory("HikingJacket_Green");itemBs = ItemBase.Cast(itemEnt); 
        player.GetInventory().CreateInInventory("CargoPants_Beige");itemBs = ItemBase.Cast(itemEnt); 
        player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt); 
        player.GetInventory().CreateInInventory("CombatKnife");itemBs = ItemBase.Cast(itemEnt); 

            SetRandomHealth(itemEnt);

The way i read this is (the first line):

I understand player.getinventory().createininventory("chestholster"); 

what i do not understand is: itemBs = ItemBase.Cast(itemEnt); - to me this says itemBs is equal to item base as referenced under player.removeallitems(); and the statement itembase.cast(itemEnt) is saying that itembase.cast <-does this mean cast as in itembase puts or casts the item to itemEnt? where itemEnt is the EntityAI...the "AI" that handles new spawns or characters will put the item where it is programmed as being allowed to go...weapon slot, shirt slot, pants slot etc.

so if itembase.cast(itemEnt) passes the referenced item, in this case a chest holster, to an AI code in the background that will put the chest holster where it is primarily programmed to go, why can't we replace itemEnt with the actual name of the slot on the player. A chest holster, empty, can also be put in inventory.

I saw one post where the poster assigned a variable called pgun to an inventory item and had the code to automatically assign that gun to a hotbar slot, the code was from ribeye007 in 2019 (https://steamcommunity.com/app/221100/discussions/0/1631916406850850260/?l=japanese😞

pGun = player.GetInventory().CreateInInventory("MP5K"); itemBs = ItemBase.Cast(itemEnt); // added the gun before any backpacks so attachments would be added to the gun and not in the players inventory

with pGun being a variable (not sure if that is the correct term in this language) and the code to assign it to the hotbar was:

player.SetQuickBarEntityShortcut(pGun, 0, true);

This code is using the variable pGun and telling the AI to place that item in that slot.

So would I be able to assign a variable to the chest holster statement and then tell the AI to put the pistol in the holster? example could be:

holster = player.GetInventory().CreateInInventory("ChestHolster");itemBs = ItemBase.Cast(itemEnt);
player.GetInventory().CreateInInventory("MakarovIJ70");itemBs = ItemBase.Cast(holster); <--is this statement telling the AI to put the makarov into the chest holster?

Or do i have this all or partially wrong and i am just confusing myself and anyone who reads this???? HAHAHAHAHAHA

Any help from the community would be much appreciated.

 

Update: I actually tried to put the above code in my init.c file and while my server did restart, i could not log in.

 

 

Edited by Mack2923
Update

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

×