How to add new weapon and ammo
Tutorial help you to understand how to add new weapons and ammo to the game
Files & folders needed:
assets/gameplay/items.json
assets/gameplay/weapons.json
assets/texts/lang_*.json
In previous tutorial we created obrez weapon hud:
How to add weapon HUD imageNow lets create in any image editor ammo icon for this obrez weapon:

Save it to assets/ui/items/.
Open assets/gameplay/items.json and create new duplicate ammo structure and change it's ID to new one:
Add name and caption texts to the assets/texts/lang_*.json (* - means any language available there)
Create duplacate copy of existing weapon item in assets/gameplay/items.json:
Then open assets/gameplay/weapons.json to create new weapon JSON structure profile:
To connect "HUD Coordinator" to the game, open assets/scripts/p_game.gd script and type this code into _ready() function:
Tool can move HUD and muzzle flash on screen by arrow keys. Basic controls is F3 for enable/disable in-game utility, UP, DOWN, LEFT, RIGHT, hold SHIFT to move muzzle flash instead HUD, press SPACE to copy positions in ready-to-use JSON properties to clipboard, then after you can Ctrl+V to paste values in weapons.json:

Now that's all. Add new weapon to the traders or add to inventory at the game start with scripts.


Last updated