Difference between revisions of "Creating Items"

From Tuxepedia
Jump to navigation Jump to search
Line 14: Line 14:
== Item Design ==
== Item Design ==
Items in Tuxemon can be created by adding a JSON file to the <code>resources/db/item</code> directory. With each new item, the following data must be specified:
Items in Tuxemon can be created by adding a JSON file to the <code>resources/db/item</code> directory. With each new item, the following data must be specified:
Here is an example of what a technique file might look like:
`resources/db/item/potion.json`
  json
  { 
  "conditions": [
    "is current_hp <,1.0",
    "is current_hp >,0"
  ],
  "effects": [
    "heal 20"
  ],
  "slug": "potion",
  "sort": "potion",
  "sprite": "gfx/items/potion.png",
  "category": "potion",
  "type": "Consumable",
  "usable_in": [
    "MainCombatMenuState",
    "WorldState"
  ],
  "use_failure": "generic_failure",
  "use_item": "combat_used_x",
  "use_success": "generic_success"
  }

Revision as of 10:01, 26 December 2023

When creating content, you might want to add your own cool item to the game. This page will walk you through creating your own item and discuss how you can use it in the game.

Creating Item Graphics

Item sprites should be PNG images that are 24 x 24 pixels in size. Here is an example of some item sprites:

BANANA 2.png Bug gym badge.png

After creating your item sprite, put your graphic under resources/gfx/items.

Using your item in Tuxemon

You can add your item to the player's inventory by creating an *action event* with an action type of "add_item" using the Tiled map editor. For more information on adding event actions and conditions to a map, check out the Map Editor Events.

Item Design

Items in Tuxemon can be created by adding a JSON file to the resources/db/item directory. With each new item, the following data must be specified:

Here is an example of what a technique file might look like:

`resources/db/item/potion.json`

 json
 {  
 "conditions": [
   "is current_hp <,1.0",
   "is current_hp >,0"
 ],
 "effects": [
   "heal 20"
 ],
 "slug": "potion",
 "sort": "potion",
 "sprite": "gfx/items/potion.png",
 "category": "potion",
 "type": "Consumable",
 "usable_in": [
   "MainCombatMenuState",
   "WorldState"
 ],
 "use_failure": "generic_failure",
 "use_item": "combat_used_x",
 "use_success": "generic_success"
 }