Assets
Modding
Modding
  • Introduction
  • How to add new items
  • How to add new events
  • How to add new stashes
  • How to add new tutorial message
  • How to add weapon HUD image
  • How to add new weapon and ammo
  • How to edit traders
  • How to add language
  • How to add new quest
  • How to add PDA markers
  • How to change in-game SFX
  • How to add ambient sounds to level
  • How to add new dialogue
  • How to change player data
  • How to add new enemy
Powered by GitBook
On this page

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:

traders.json
"village_trader": {
  "dont_want_to_buy": [
    "w_pistol",
    "radio_first",
    "flashlight"
  ],
  "items": [
    "medkit",
    "antirad",
    "w_viper5",
    "ammo_viper5",
    "jacket",
    "jacket_bandit"
  ]
}
Properties description
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 buy

This is JSON structure of trader character data:

characters.json
"village_trader_profile":{
  "name": "npc.village.trader.name",
  "trader_profile": "village_trader",
  "texture": "pstalker",
  "idle_animation": "sit_on_greenbox_2",
  "weapon": "w_ak",
  "gasmask": false,
  "gasmask_type": "antigas",
  "weapon_hold": "r_hand",
  "dialogues": [
    {
  	"dialogue": "no_dialogue"
    }
  ]
}
village_trader_profile = Profile unique ID, used when NPC spawn
name = Hint name text, that appear when player look at NPC
trader_profile = Unique ID from traders.json
texture = Texture name of NPC model from assets/textures/
idle_animation = Base idle animation that plays after spawning, 
weapon = Model name from assets/models/
gasmask = Show/hide gasmask
gasmask_type = Type of gasmask ( or )
weapon_hold =  = where weapon model will be attached
dialogues = Array of dialogues, for trader it must contain same structure as above

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:

Files & 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

traders.json
"my_mod_trader": {
  "dont_want_to_buy": [
    "w_pistol",
    "radio_first",
    "flashlight"
  ],
  "items": [
    "medkit_army",
    "ammo_ak",
    "ammo_viper5",
    "jacket_bandit"
  ]
}

Add new character structure to assets/creatures/characters.json

"my_mod_new_trader_profile":{
  "name": "npc.village.trader.name",
  "trader_profile": "my_mod_trader",
  "texture": "pbandit",
  "idle_animation": "sit_ground",
  "weapon": "w_ak",
  "gasmask": false,
  "gasmask_type": "antigas",
  "weapon_hold": "backpack",
  "dialogues": [
    {
  	"dialogue": "no_dialogue"
    }
  ]
}

Now open assets/scripts/p_game.gd and spawn NPC using new profile ID with function SpawnNPC() from:

After spawning check game:

PreviousHow to add new weapon and ammoNextHow to add language

Last updated 5 months ago

How to add new events
How to add new events
Trader with sit animation
Trader's goods based on list from traders.json