RPG configuration
Contents
[hide]Intro
To create a new game, you have to create a cfg file in in data/rpg/games/ which contains the respective title of your game. This configuration file would either host the definitions, or execute additional configuration files. These files may not be in data/rpg/games/, but they can utilize a sub folder, such as data/rpg/games/bongo/. Here are a few useful tips
- execute the contents of data/rpg/games/common, this folder contains several generic but useful things
- don't define the indices explicitly! use aliases to store the index and query it when needed
The various commands here only apply to the last defined item. If an item is not defined, or if it's not compatible with the last created item, an inconsequential error will simply display on screen.
Aliases
An important note is that aliases are not saved. If you choose to use them make sure that everything is substituted inline. In short use an @ for every pair of [] brackets that surround the statement and $ when not inside [] brackets. See the Cubescript page for more information.
The only exception to this rule is the aliases defined in data/rpg/game.cfg
When you invoke either the *_new or *_dup variants of the commands, it will return the index.
//generic_item_script will be set to 0, assuming this is the first defined script
generic_item_script = (r_script_new)
....
//to make an item use it, I can simply go
r_item_script $generic_item_script
Scripts
These commands are all prefixed with r_script_
Note that creatures and objects default to script 0, and items to script 1.
Commands
- new - creates a new slot and returns the index
- dup INDEX - duplicates the provided slot and returns the new index.
- say TEXT SCRIPT - creates an additional dialogue node, when this node is reached the SCRIPT is executed
- currently not used
Slots
Strings
- approach - executed when you notice someone approaching you.
- UNUSED
- death - executed when the user dies
- drop - executed when an item is dropped
- UNUSED
- equip - executed when an item is equipped
- interact - executed when interacted with
- spawn - executed when you spawn
- use - executed when you use an item, or attack with a weapon
- UNUSED
- hit - executed when hit
- UNUSED
- collide - executed when something collides with you