How to add new weapon and ammo
Tutorial help you to understand how to add new weapons and ammo to the game
Last updated
Tutorial help you to understand how to add new weapons and ammo to the game
Last updated
Files & folders needed:
assets/gameplay/items.json
assets/gameplay/weapons.json
assets/texts/lang_*.json
In previous tutorial we created obrez weapon hud:
Now 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:
fire_sound use sound name from assets/sounds/ folder.
sparkle_position and hud_position is [X, Y, Z] position on screen. Actually HUD and sparkle is 3D planes that very close to camera. You can use my utility script "HUD Coordinator"
.
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.