How to edit traders
Tutorial help with editing existing traders or adding new ones to the game
Files & folders needed:
assets/creatures/traders.json
assets/creatures/characters.json
This is JSON structure of trader items data:
"village_trader": {
"dont_want_to_buy": [
"w_pistol",
"radio_first",
"flashlight"
],
"items": [
"medkit",
"antirad",
"w_viper5",
"ammo_viper5",
"jacket",
"jacket_bandit"
]
}village_trader = Unique ID, used in assets/creatures/characters.json
dont_want_to_buy = list of items IDs, player can't sell to trader
items = list of items IDs, player can buyThis is JSON structure of trader character data:
You can edit existing values and see how it works.
To create new trader, we need to create new character structure and new trader structure. How to spawn NPC, you can learn in this tutorial:
How to add new eventsFiles & folders needed for adding new trader NPC:
assets/creatures/traders.json
assets/creatures/characters.json
assets/scripts/p_game.gd
Add new trader structure to assets/creatures/traders.json
Add new character structure to assets/creatures/characters.json
Now open assets/scripts/p_game.gd and spawn NPC using new profile ID with function SpawnNPC() from:
How to add new eventsAfter spawning check game:


Last updated