Tropycal RPG engine tutorial

Home Tutorial Home Sourceforge Home Downloads Contributions
Main configurations
The file settings.txt have the configurations of the engine, you can change it manually, or in the options menu in the game.
This file have these options to change:

Option Values Effect
up=KEY NUMBER KEY NUMBER The key used to move up
down=KEY NUMBER KEY NUMBER The key used to move down
left=KEY NUMBER KEY NUMBER The key used to move left
right=KEY NUMBER KEY NUMBER The key used to move right
action=KEY NUMBER KEY NUMBER The key used to do a action
cancel=KEY NUMBER KEY NUMBER The key used to cancel
attack=KEY NUMBER KEY NUMBER The key used to attack in battle
save=KEY NUMBER KEY NUMBER The key used to save the game
quit=KEY NUMBER KEY NUMBER The key used to exit the game
inv=KEY NUMBER KEY NUMBER The key used to open the inventory
party_change=KEY NUMBER KEY NUMBER The key used to change the current player
load_console=KEY NUMBER KEY NUMBER The key used to load a text box to write a engine command in game
message_lines=NUMBER NUMBER Number of lines in the message box
difficulty=NUMBER 0, 1, 2 Difficulty of the game, 0 is easy, 1 is normal and 2 is hard
editor_xsize=NUMBER NUMBER Weight of the Map Editor in pixels
editor_tilesize=NUMBER NUMBER OF TILES Number of tiles showed in Map Editor screen
fullscreen=NUMBER 0, 1 0 to use window, 1 to use fullscreen mode
usejoystick=NUMBER 0, 1 0 to not use joystick, 1 to use
joystick_number=NUMBER NUMBER Number of the joystick to use
joystick_action=NUMBER NUMBER Number of the joystick button to use for action
joystick_cancel=NUMBER NUMBER Number of the joystick button to use for cancel
joystick_lr_axis=NUMBER NUMBER Number of the joystick axis to use for left/right
joystick_ud_axis=NUMBER NUMBER Number of the joystick axis to use for up/down
name_of_the_script_file.txt=KEY NUMBER KEY NUMBER A custom button to execute a script.
battle_name_of_the_script_file.txt=KEY NUMBER KEY NUMBER A custom button to execute a script in battle.


The KEY NUMBER are numbers for pygame.K_KEYNAME, as listed at http://pygame.org/docs/ref/pygame_constants.html

TOP Games configurations
The modules folder have a default folder with data and images folder.

The data folder have settings for all game modules in that engine, and the images folder have the images used by the engine for all game modules.

If you change the icon.png image in the buttons folder for another image with the same name, the engine icon will be changed.

And the file settings.txt in the data folder will change some settings for all the games in that engine. This file can be automatically changed in the map editor or manually with a text editor
This file have these options to change:

Option Values Effect
mapsizex=NUMBER NUMBER OF TILES Size in horizontal tiles of the map
mapsizey=NUMBER NUMBER OF TILES Size in vertical tiles of the map
screen_xsize=NUMBER NUMBER Horizontal resolution of the window
screen_ysize=NUMBER NUMBER Vertical resolution of the window
iconsize=NUMBER NUMBER Size of the icons
width=NUMBER NUMBER Width of interface element
change_pos_stat_x=NUMBER NUMBER X position of the stat area, it will add/remove pixels of the default engine position, negative numbers allowed.
change_pos_stat_y=NUMBER NUMBER Y position of the stat area, negative numbers allowed.
change_pos_message_x=NUMBER NUMBER X position of the messages area, negative numbers allowed.
change_pos_message_y=NUMBER NUMBER Y position of the messages area
change_pos_daystatus_x=NUMBER NUMBER X position of the daystatus icon
change_pos_daystatus_y=NUMBER NUMBER Y position of the daystatus icon
change_pos_character_x=NUMBER NUMBER X position of the actor image area
change_pos_character_y=NUMBER 0, 1, 2 Y position of the actor image area
timeeffects=STRING "yes" or "no" "yes" to activate the time effects in the game like day/night transition, "no" to deactivate.


Example:
timeeffects="no"
change_pos_stat_x=-20

It will disable timed effects from the engine and move the player status area 20 pixels to left.
TOP
Game module configuration

Each game have individual settings. The settings files of a game is in the data folder of it.
In the left menu are the buttons to see each file

variables.txt

This file have some configurations to the game module like custom buttons and name of stats.
Option Values Effect
game_name=STRING Name of the game The name of this game, will be showed in titlebar.
default_player_name=STRING Default player name The default player name
hp=DICE 2d4 , 8d3+10 Dice values to change the health randomly in the game begin menu
attack=DICE 2d4 , 8d3+10 Dice values to change the attack randomly in the game begin menu
defense=DICE 2d4 , 8d3+10 Dice values to change the defense randomly in the game begin menu
gold=DICE 2d4 , 8d3+10 Dice values to change the money randomly in the game begin menu
tilesize=NUMBER NUMBER Size of the tiles used in this game module
name_name=STRING NAME of the stat 'name' Change the name of the stat name
hp_name=STRING NAME of the stat 'name' Change the name of the stat hp
ep_name=STRING NAME of the stat 'name' Change the name of the stat ep
attack_name=STRING NAME of the stat 'name' Change the name of the stat attack
defense_name=STRING NAME of the stat 'name' Change the name of the stat defense
gold_name=STRING NAME of the stat 'name' Change the name of the stat gold
skill_name=STRING NAME of the stat 'name' Change the name of the stat skillpoints
exp_name=STRING NAME of the stat 'name' Change the name of the stat exp
level_name=STRING NAME of the stat 'name' Change the name of the stat level
:name_of_the_script_file.txt=KEY NUMBER KEY NUMBER A custom button to execute a script.
:battle_name_of_the_script_file.txt=KEY NUMBER KEY NUMBER A custom button to execute a script in battle.
color_NAMEOFCOLOR=RGB_VALUE Interface color(rrrgggbbb) You can change a engine color like color_black or create a new color. Example: color_orange=200150100

TOP
newgame.txt

This file is executed by the engine when the player start a new game. It have TP-1 scripts commands, see the scripting section.
In that file you can reset the stats, variables, play a starting music or animation...
TOP endgame.txt

This file is executed by the engine when the player lose the game, die or the game end somewhere. It have TP-1 scripts commands, see the scripting section.
In that file you can control the losing action
TOP loadgame.txt

This file is executed by the engine when the player load a old game. It have TP-1 scripts commands, see the scripting section.
In that file you can reset the stats, variables, show some info...
TOP wingame.txt

This file is executed by the engine when the player win the game. It have TP-1 scripts commands, see the scripting section.
In that file you can show dialog boxes, play a ending music or animation...
TOP levelup.txt

This file is executed by the engine when the player gain a level. It have TP-1 scripts commands, see the scripting section.
In that file you can control the stats of each player in the new level.
TOP hero_changes.txt

It is a important file, and you will need knowledge to edit it. It is executed by the engine when the player changes the playable actor or the player enter in a new map. With this file you can change the player picture or no.
It use a default variable change_hero to do the right actions. The value of this variable is:
-1 to not read this file again.
0 if the player is entering a new map.
1 if the player is changing the playable actor in map.
2 if the player is changing the playable actor in battle.
The minimal content of this file is:
set("name", stat("name"))
if(var("change_hero"), "=", 0)
set("change_hero", -1)
#actions to do if the player is entering a new map
endif

if(var("change_hero"), "=", 1)
set("change_hero", -1)
#actions to do if the player is changing the playable actor in map
endif

if(var("change_hero"), "=", 2)
set("change_hero", -1)
#actions to do if the player is changing the playable actor in battle.
endif


TOP monsters.txt

This file have a list of monsters and some attributes to them.
To add a monster to that list write :MONSTER, changing MONSTER to the name of the monster to add.
You can add a group of monsters, change the positions of the monsters and give a attack message.
Here a example of a list of monsters:
# One ant
:Ant
#name of the monster to add
monster=Ant
# Two ants
:Ants
# message to show when the player is attacked by this ant colony
attack=You found a ant colony!
# horizontal position of the first, and the second ant
x_pos = 40, 160
# vertical position of the first, and the second ant
y_pos = 10, 10
monster=Ant
monster=Ant

The monsters you are listing here must exist in the monsters folder. And each monster listed here will be used by the engine
TOP shops.txt

Give items to the shops. Very easy to use.
Example
Name of the shop
:Shop Bills Bar
Items to give to the shop
:Item Ale
:Item Ki Corn
:Item Wine

If you want to make a more customized shop:
:Shop Small Weapons Store
:Item Dagger
#Reconfigure the item price
cost=15
#Reconfigure the item power
power=2
#Reconfigure the item picture
picture=items/dagger.png
#Reconfigure the item description
description=A small but useful dagger
#Configure the item buy type (gold or skillpoints, for example)
buytype=gold 
#Some script actions to do when the player buy this item
if(item("dagger"), "=", 1)
pass()
else
end()
endif
#Will show this message when the player buy it
info("You buy a Dagger.")

The items listed here must exist in the items folder. And each shop created here will be used by the engine.
TOP skills.txt

This file configure skills, example of one:
#Name of the skill
:Healing
#Start the contents of the skill
:data
#Skillpoints required to adquire this skill
Level = 1
#Amount of energy used when the player do this skill
Price = 1
#Type of the skill
Type = 5
#The actor required to use this skill, if "player", then it is the main actor, if "no", then it is all actors.
restrictuse=player
#Description of the skill
Description = Heals a few wounds using surrounding plants
#Tile picture of the skill
Picture = items/healing.png
#Start scripting actions below
:scripting

info("You heal some damage.")
give("hp", stat("level"))
give("hp", 1)
#Finish the contents of the skill
:data

TOP perturn.txt

This file have TP-1 script action to be executed by the engine ever the player moves. It have controls of the quantity of movements done to execute the actions. It is readed in map and in battle.
If you want to execute a action after 5 steps, write :0, 5, 10, 15, 20, 25 and below the actions to do.
The maximum number is 29
Example:
:0, 5, 10, 15, 20, 25
#After 5 steps, do the actions below
info("You give five steps")

TOP battle.txt

This file is optional, if exists, the engine will execute the TP-1 script actions writed in it before each battle. To cancel the battle, write end() in it
TOP party.txt

This file is optional, if exists, the engine will execute the TP-1 script actions writed in it before the player changes the playable actor. To cancel the changing, write end() in it
When this file is in a game module, the engine dont ask for a actor name.
TOP walk_defs.txt

This file have the default walk values of each tile. It is useful in Map Editor.
To set the walk value of a tile just write the location of the respective image and the number 0 to not walk, or 1 to walk in that tile for example, items/key.png 1.
TOP