The RPG is set up in a very open way such that all gameplay objects and behaviour can be modified in a script file, currently in data/game_rpg.cfg (this will change later to be on a per-map basis).
This file simply lists all gameplay objects, which can then be placed in the level editor. For example, by writing:
spawn_apple = [ r_worth 20 ]you define a script that gets executed when an apple is spawned. You place this apple either directly in the world or as part of another objects inventory. To place it in the world, you create an entity of type "spawn" with a name attached. This is best done by typing:
newrpgspawn appleWhat is important to realize is that most r_ commands work with what is called the RPG stack. This makes it possible to apply properties and actions to things without having to specify all the time which object you are talking about. For example, when the spawn_apple script gets executed, the apple object will be on the top of the RPG stack, so any commands such as r_worth that apply to an object, will automatically apply to it. It is a stack, because during the initialization of one object you may spawn another, which means all r_ commands will apply to the new object, until it is done, when the RPG stack returns to the previous object. Following is a list of all commands... unless otherwise noted, they apply to the current object (top of the RPG stack).
r_pop
Removes the top object from the RPG stack
r_spawn N
creates a new object, places it on the top of the RPG stack, then executes spawn_N to initialize it.
r_contain T
Takes the object on the top of the stack, and makes it part of the inventory of the object on the stack below it. T is the type of inventory object, see the convenient scripts r_inventory, r_loot, r_fortrade instead.
r_gold G
G gold is owned by this object for use in trading. Only makes sense for player/NPCs
r_worth V
This object has base value V when used in trading
r_stat ST V
This object has value V for stat type ST (see stats.h)
r_model M
Specify model M to represent this object visually when placed in the world
r_ai
Signifies that this object should run AI code when placed in the world, used for NPCs/monsters, not items.
r_action N A
defines a custom action the player can take on this object. N is the tag word that describes the action, visible in the objects menu in the game world, and A is the script that gets executed when the player selects it.
r_say T
Make text T the last thing this object said to the player
r_take N A NA
Attempt to take object with name N from the player inventory, and place it in the objects inventory. If the item was succesfully grabbed (it was present), action A is executed. If the item was not available, NA is executed. r_take is the preferred way to structure resolution of quests, i.e. everything the player ever needs to do should go via token items.
r_give N
give the player an item with name N