Jump to content
NachoNinjaGnome

Custom Loadouts

Recommended Posts

I am, currently, trying to create some custom random starting loadouts for my server and I know how to use the "player.RemoveAllItems();" to clear the default clothing and add what I want with the whole "player.GetInventory().CreateInInventory("________");itemBs = ItemBase.Cast(itemEnt);"... but, I was wondering if there's a way to determine the player's gender before specifying which "case" of the "switch" function to use, so that I may make two different sets of random loadouts for male and female characters.  That way women don't spawn in equipped with a "ManSuit" and men don't end up with a "WomanSuit" or any of the various dresses, skirts and short shorts, though, that would be funny.

I was also wondering if there's a way to have a character spawn in with, for instance, a belt with a sheath attached and a knife attached to the sheath, or maybe to have a character start with a IJ-70 with a full mag and a suppressor attached, or to have them start with a rifle with an attached optic that has a battery attached already.

On a related note, would it be possible to have a character spawn in with a container, like a First Aid Kit with medical supplies in its inventory?

Any help on the matter would be greatly appreciated.

Share this post


Link to post
Share on other sites

I've played on a few deathmatch servers and it seems that the guns spawn with their attachments but are not loaded.  I have no idea how to do this only that part of what your are requesting does seem possible.

Share this post


Link to post
Share on other sites
3 hours ago, aaronlands said:

I've played on a few deathmatch servers and it seems that the guns spawn with their attachments but are not loaded.  I have no idea how to do this only that part of what your are requesting does seem possible.

Yeah, you can edit those in the cfgspawnabletypes.xml file and are part of most servers as many vanilla weapons are configured that way by default.  If I had a test server, I'd just play around with the code to see if the various functions I've encountered in the server files will work in other contexts, and if so, in what format.  I don't know what programming language these files are written, but the syntax feels very foreign to me and my knowledge of the games functions and variables is limited.

Share this post


Link to post
Share on other sites
if(player.IsMale())
{
  //Male loadout
}
else
{
  //Female loadout
}
EntityAI Belt = Player.GetInventory().CreateInInventory("BeltClassname");
ItemBase Sheath = Belt.GetInventory().CreateAttachment("SheathClassname");
Sheath.GetInventory().CreateAttachment("KnifeClassname");

I'm not sure how the second one works but I think that'd be correct. Find the belt, sheath, and knife classnames you want and try it out!

Share this post


Link to post
Share on other sites
On 9/17/2019 at 4:21 AM, Spatsiba said:

if(player.IsMale())
{
  //Male loadout
}
else
{
  //Female loadout
}

EntityAI Belt = Player.GetInventory().CreateInInventory("BeltClassname");
ItemBase Sheath = Belt.GetInventory().CreateAttachment("SheathClassname");
Sheath.GetInventory().CreateAttachment("KnifeClassname");

I'm not sure how the second one works but I think that'd be correct. Find the belt, sheath, and knife classnames you want and try it out!

Yeah, I figured out the attachment to attachment and the check for gender already.  Still can't figure out how to attach a magazine without it glitching out the weapon.  Thanks for the reply though.

Edited by NachoNinjaGnome

Share this post


Link to post
Share on other sites
On ‎9‎/‎12‎/‎2019 at 4:43 AM, NachoNinjaGnome said:

On a related note, would it be possible to have a character spawn in with a container, like a First Aid Kit with medical supplies in its inventory?

Any help on the matter would be greatly appreciated.

Yes you can add a FirstAidKit with items inside it by doing something like this:

   ItemBase FirstA = Bpack.GetInventory().CreateInInventory("FirstAidKit");
   FirstA.GetInventory().CreateInInventory ("BandageDressing");
   FirstA.GetInventory().CreateInInventory ("BandageDressing");
   FirstA.GetInventory().CreateInInventory ("BloodBagEmpty");
   FirstA.GetInventory().CreateInInventory ("SurgicalGloves_Blue");
   FirstA.GetInventory().CreateInInventory("BloodTestKit");

On ‎9‎/‎12‎/‎2019 at 4:51 AM, aaronlands said:

I've played on a few deathmatch servers and it seems that the guns spawn with their attachments but are not loaded.  I have no idea how to do this only that part of what your are requesting does seem possible.

Weapons with attachments I do like this and they are attached to the weapons on spawn:

   ItemBase PrimGun = player.GetHumanInventory().CreateInInventory("Mosin9130");
   PrimGun.GetInventory().CreateAttachment("Mosin_Compensator");
   PrimGun.GetInventory().CreateAttachment("PUScopeOptic");

Or for weapons with battery powered attachments this:

   ItemBase PrimGun = player.GetHumanInventory().CreateInInventory("M4A1");
   PrimGun.GetInventory().CreateAttachment("M4_RISHndgrd");
   PrimGun.GetInventory().CreateAttachment("M4_CQBBttstck");
   PrimGun.GetInventory().CreateAttachment("M4_Suppressor");
   ItemBase PrimLight = PrimGun.GetInventory().CreateAttachment("UniversalLight");
   PrimLight.GetInventory().CreateAttachment("Battery9V");
   ItemBase PrimSight = PrimGun.GetInventory().CreateAttachment("M68Optic");
   PrimSight.GetInventory().CreateAttachment("Battery9V");

 

I'm not sure on adding a weapon with a mag attached already, I do see the gun bug out if I try some options tho.

  • Thanks 1

Share this post


Link to post
Share on other sites

Is there any way to simply edit the contents of the topsArray and pantsArray that define starting clothes, or do you have to create custom loadouts to get newspawns to start with other clothes than the default hoodie/jeans?

Basically, I want newspawns to have tracksuit pants and t-shirts or other low-end tops like sports shirt, telnyashka, sweater etc.

Share this post


Link to post
Share on other sites
On 9/27/2019 at 5:47 PM, Smokeydapot said:

Yes you can add a FirstAidKit with items inside it by doing something like this:

   ItemBase FirstA = Bpack.GetInventory().CreateInInventory("FirstAidKit");
   FirstA.GetInventory().CreateInInventory ("BandageDressing");
   FirstA.GetInventory().CreateInInventory ("BandageDressing");
   FirstA.GetInventory().CreateInInventory ("BloodBagEmpty");
   FirstA.GetInventory().CreateInInventory ("SurgicalGloves_Blue");
   FirstA.GetInventory().CreateInInventory("BloodTestKit");

Weapons with attachments I do like this and they are attached to the weapons on spawn:

   ItemBase PrimGun = player.GetHumanInventory().CreateInInventory("Mosin9130");
   PrimGun.GetInventory().CreateAttachment("Mosin_Compensator");
   PrimGun.GetInventory().CreateAttachment("PUScopeOptic");

Or for weapons with battery powered attachments this:

   ItemBase PrimGun = player.GetHumanInventory().CreateInInventory("M4A1");
   PrimGun.GetInventory().CreateAttachment("M4_RISHndgrd");
   PrimGun.GetInventory().CreateAttachment("M4_CQBBttstck");
   PrimGun.GetInventory().CreateAttachment("M4_Suppressor");
   ItemBase PrimLight = PrimGun.GetInventory().CreateAttachment("UniversalLight");
   PrimLight.GetInventory().CreateAttachment("Battery9V");
   ItemBase PrimSight = PrimGun.GetInventory().CreateAttachment("M68Optic");
   PrimSight.GetInventory().CreateAttachment("Battery9V");

 

I'm not sure on adding a weapon with a mag attached already, I do see the gun bug out if I try some options tho.

This really helped out a lot. Thanks for posting this. 
Makes it much easier to get my players setup for a hunting expedition. 

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

×