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 add new items

Tutorial "How to add new item to the game"

Files & folders needed:

assets/gameplay/items.json

assets/ui/items/

assets/scripts/p_game.gd

Inside items.json we can add new items, from assets/ui/items/ we can get items icons.

Healing item JSON structure:

"medkit": {
	"name": "itm.medkit.name",
	"caption": "itm.medkit.caption",
	"icon": "assets/ui/items/medkit.png",
	"price": 100,
	"weight": 0.1,
	"type": "usable",
	"on_use": {
		"heal": 25
	}
}

Artifact item JSON structure:

"af_fireball": {
	"name": "itm.af.fireball.name",
	"caption": "itm.af.fireball.caption",
	"icon": "assets/ui/items/af_fireball.png",
	"price": 500,
	"weight": 0.5,
	"slot": "belt",
	"type": "equipment",
	"on_use": {
		"armor": 10,
		"weight": -10
	}
}

Armor item JSON structure:

"jacket": {
	"name": "itm.jacket.name",
	"caption": "itm.jacket.caption",
	"icon": "assets/ui/items/jacket.png",
	"price": 200,
	"weight": 3,
	"slot": "outfit",
	"type": "equipment",
	"on_use": {
		"armor": 10,
		"rad_resist": 0,
		"anomaly_resist": 10
	}
}

Weapon item JSON structure:

"w_pistol": {
        "name": "itm.pistol.name",
        "caption": "itm.pistol.caption",
        "icon": "assets/ui/items/w_pistol.png",
        "price": 0,
        "weight": 0.83,
        "slot": "pistol",
        "type": "weapon",
        "profile": "w_pistol"
}

Ammo item JSON structure:

"ammo_ak": {
        "name": "itm.ammo.ak.name",
        "caption": "itm.ammo.ak.caption",
        "icon": "assets/ui/items/ammo_ak.png",
        "price": 60,
        "weight": 0.3,
        "type": "item"
}

Custom start-dialogue item JSON structure: (But same feature can be made using event keys)

"radio_first": {
	"name": "itm.radio.name",
	"caption": "itm.radio.caption",
	"icon": "assets/ui/items/hand_radio.png",
	"price": 0,
	"weight": 0,
	"type": "usable",
	"on_use": {},
	"dialogue": {
		"id": "radio_dialogue_first",
		"name": "npc.radio"
	}
}

Let's understand keys and what the do in-game:

"name" : "Name of the item, can be text, or language key from lang_*.json file"

"caption" : "Item description, can be text, or language key from lang_*.json file"

"icon" : "Inventory icon image file. Need full path relative to game exe"

"price" : "Item buy/sell price"

"weight" : "Item weight, float value"

"type" : "Item type, this affects how item will be used and it's additional keys"

[Types]: , , , 

usable = must have on_use
equipment = must have slot, on_use
weapon = must have slot, profile | must exclude on_use
item = must exclude everything above | on_use, slot, profile

"on_use" : "In-game effects that caused by item when used, like healing, armor increasing"

[on_use]: , , , , , , ,
, 

"slot": "where item can be equipped, like belt, outfit, rifle, pistol"

"profile" : "ID of the weapon profile from assets/gameplay/weapons.json"

"dialogue" : "if this key exist in usable item, dialogue will be shown, need dialogue ID and NPC name"

Let's add new consumable item, yellow eco medkit!

Duplicate medkit structure and paste it after.

Now rename it. For now we can ignore using langage keys, so we don't need to create keys in lang_* files for now, but for multilanguage it must have!

Change price to 300 and set new icon path (we don't create it for now, but will do it later), make it heal more, 100% of max health and give it new [on_use] effect from antirad!

Now duplicate medkit icon at assets/ui/items/ and change it's color in any image editor. I will do it with paint.net.

All done! We create new item! but how we can get this into inventory in game? There are a few ways:

  1. Add it by script into inventory from game start

  2. Add it to the traders

For now, let's add it from the game start. Open assets/scripts/p_game.gd file with Visual Studio Code or other editor that will save TAB indentiation in GD script. Find function:

func on_level_changed(level_id):

Go inside function to:

match level_id:

And look for intro level id string:

"intro":

And add new item using inventory.AddItem(id) function. Write it after:

await gui.IntroWindow.hidden

It must looks like this:

"intro":
    gui.ShowIntroMessageCustom("start.game.info")
    #print("waint until gui intro will be hidden")
    await gui.IntroWindow.hidden
    inventory.AddItem("medkit_eco") # <- new item that we created!
    #GM.AddEventKey("intro.cutscene")

Save files and run new game!

PreviousIntroductionNextHow to add new events

Last updated 5 months ago

medkit eco structure under original medkit
Our new item with changed name, caption, price, icon and new effect
Changed medkit icon
Eco medkit