Example project made with Godot 3.2 beta4
No longer developed and therefor archived.
- Prepared template resources for
new items
anditem slots
- Example for creating new items with
rarity levels
from a base item with visual item rarity border and background coloring - Example for
mouse drag & drop
with differentdropzones
andreturns on reset
depending onitem ownership
- Example for
price calculation
depending onexchange rates
between the parties - Example for
item tooltip on mouse hover
that scales and alwaysstays inside the viewport
size - Example for
doubleclick items
and addeditem comparison
to the tooltip with a keymodifier - Example for stacking
notification messages
that autohide after a few seconds - Scripts for
utility
thatscans for images and items
in defined folders at startup and create a dictionary for convenient access by filename. This way you can always reorganize your image / item folder structure without breaking a million filepaths on projects that grow large - Ruby colors!
- Yasmin my trader girl from the demo is not included, bring your own 3d character actors.
- Layout is not intended for anything below full hd resolution ( well ... who wants to suffer a mouse controlled desktop game below this anyway )
The example project comes with a premade trading scene that autostarts and various helper scripts to get you started but first we need some item images.
Place all your images in the assets/images/
folder or below in as many subfolders as you need for your project and use unique filenames
for them.
The image script scans for .webp, .png.
and .jpg
file endings.
All found images are added as key:value
pair to a dictionary with the imagename as key and the loadpath as value. From now on you can access the loadpath of images by typing game.image_data.get("unique_image_name")
from everywhere in your game without caring for the excact path as long as you keep your imagenames unique e.g. with a prefix. If you need other formats edit the scan_dir_for_images()
function in the data
script.
Place all your item resources in the data/items/
folder or below in any subfolder. The scripts scans for all .tres
resource files so don't mix them with anything else in the items subfolders. Same as with images, all items are added to a dictionary and you access them with game.item_data.get("unique_item_name")
.
Edit your item resources one by one. Give them a unique item_id
, a display_name
, a desription
and your image. Some stats are already for the next expensions and have no effect rightnow apart from visuals like max_stack
and unique
. sellable
prevents the items from showing up in trade, the base_price
is the cost and sell value of the item before exchange modifiers are applied. category
, rarity
and slot
are self-explanatory and pick from the pulldown menu what you see fit..
You can add as many new trader npcs as you want with their own inventories.
The current setup is, that you add them as a child node to the characters
node, name them how you want and attach the NPC.gd
Script to the node.
At the moment there is a project cheat that adds all created items to both player and npc trader at the game start.
You find this block in the game
script in the _ready()
function. There you can see a script example how to create and add items as well as money to the inventories of both player and npc.
You can control the trade window manually by calling game.start_trading( "the_trader_name" )
function from everywhere with the traders name as a text string
.
There are two optional parameters as well. inventory_id
replaces the npcs real inventory temporarily. This is usefull for quests or other special events where you want to hide the real inventory of the npc for this interaction. Selling and buying is still possible and sold player items are added to the real inventory to not get lost. The dialog_id
at the moment serves no purpose but will be important when the dialog addon is added.
MIT.