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). The idea is that every map comes with its own "mod", and that gameplay can be influenced by level designer, allowing gameplay types spanning from a stat/story influenced FPS game, an action RPG, all the way to more complex quest/story/stat based RPGs.
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 (in the console):
newrpgspawn apple
which will show you your new entity in the editor. Running the map then will create a new apple object at that location, with all stats set to your liking (in this case just its worth).
What 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_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
melee | amount of damage when using a melee weapon (fists, swords, axes...) |
ranged | amount of damage when using a ranged weapon (crossbow, shotgun, ...) |
magic | amount of damage when using an attack spell (fireball...), level of utility when using healing/creation spells |
regen | amount of hp regenerated per second. regen is the only defense stat, it replaces the tradition armour or resistence stats. regen is more flexible in the sense that it is time based, so your effectiveness depends on being able to give or take sustained damage, and deals better with the effects of running away mid-fight etc. |
focus | amount of mana regenerated per second |
attackspeed | reduces time delay between two attacks for any attack (melee/ranged/magic) |
movespeed | |
jumpheight | |
maxhp | maximum health you will regenerate to |
maxmana | maximum mana you can store |
tradeskill | will give your better deals when trading |
feared | the higher this stat, the more likely people are likely to comply with your wishes |
stealth | reduces npc fov & distance when stealing stuff |
hostility | |
stata, statb, statc | generic stats, i.e. their meaning is map-specific. they can be set and accumulated like any other stat, then scripts can use the results in any way they wish. |
health | set to maxhp when an AI object spawns in the world, and regens to maxhp |
mana | set to maxmana upon spawn, and regens to focus |
gold | how much money is owned by the object (mostly for npcs/player only) |
worth | base value when this object is sold by an npc (not necessarily when sold TO an npc) |
ai | 0: no AI (a lifeless object, default), 1: a friendly AI (npc), 2: hostile AI (animals/monsters) |
useamount | amount of uses this object has. items such as melee weapons have a certain amount of uses before they break, and potion bottles may have a certain content. |
usetype |
if this item is used, what happens: 0: nothing, 1: melee weapon, 2: ranged weapon, 3: magic (projectile) |
damage | if not 0, this object can be used a weapon |
maxrange | max range within which objects can be targeted when this object is used |
maxangle | max angle from "forward" that objects can be targeted |
selected | 0/1: a selected object indicates a preferred object to be used in an action when many alternatives are available in the inventory. for example, it indicates which weapon is to be used in an attack. More than one item can be selected at once, this simply means the items will be used in sequence, if necessary. |
attra, attrb, attrc | generic attributes, can be set by the script code to implement gameplay features not foreseen by the system |