Help please
Ok so I decided to mess around with modding, (All I'm doing is adding weapons and vehicles for now), and I made a new admin gun. I would like this weapon to be in the admin's loadout, just like the SCG. I'm a bit of a newbie at this, so I have no idea what to edit to make this happen. I'm working with Metallic v1.4Beta in case that changes anything.
Comments
Thar you be.
Heres a little dissection of what we just did, if you're interested:
>InventoryHud.cs<
This script file is used for... well, the loadout hud, but also Construction's Buyfavorites, and all the Deployable's/Pack's/Weapon's
"CommonName to DatablockName" conversion tables, as well as the player datablock conversion table.
>Player.setInventory(ItemData, Amount, Force)<
This is a script function defined in Inventory.cs, it's used to virtually add things to your players inventory. You can use the item name or the item's ID, both work.
Everytime the function is called, it adds a dynamic field to your player.
Player.Inv[ITEM_DATA_NAME] = #;
which tells any function dealing with inventory, that you have an "Amount", of that item.
FORCE, is a boolean variable, which if FALSE, it will use the maximum allowed inventory amounts defined on the player datablock, in Player.cs; If TRUE,
it forces the "amount" onto the player's inventory, regardless of Inventory restrictions.
So if you put in:
Player.setInventory(Grenade, 12, true);
the player will have 12 grenades to use. If you make 'force', false, the player will only have 4 grenades to use, because it's the amount defined in the player's datablock.