Guide: How to add a new zone
Posted: Fri Jul 06, 2012 6:59 pm
Guide: Adding a new zone to the game by making an addon
Last update for b41
This guide is intended to help people make their first zone. It is not a complete guide to all the functions / tables / etc used in this code.
These are only the first few steps to get you started.
Step 1: Creating a new addon
First, we have to create a new addon.
This is done by making a folder in:
Create a folder called overload:
It is best that you go look at other zones to see how they are generated. You can find examples by extracting the tome module and looking in:
game/engines/te4/engine/generator
For static maps, you have to put your map in
You have to create 3 more files. In these files you have to put something like: load("/data/general/npcs/thieve.lua")
This is needed to load the right files to generate the map.
For a zone in the East, use: load("/data/general/objects/objects-far-east.lua")
Step 4: Putting your zone on the world map
You have to edit two files:
In eyal.lua, add the following:
Then put [[yourzonename]] somewhere in the map grid.
Last update for b41
This guide is intended to help people make their first zone. It is not a complete guide to all the functions / tables / etc used in this code.
These are only the first few steps to get you started.
Step 1: Creating a new addon
First, we have to create a new addon.
This is done by making a folder in:
Let us create a new folder. The name has to start with "tome-" followed by the name of your addon:/game/addons
Inside this folder we make a file called init.luatome-youraddonname
/game/addons/tome-youraddonname/init.lua
You might wonder what all these things mean. The most important thing:long_name = "The name of your addon"
short_name = "youraddonname"
for_module = "tome"
version = {3,9,41}
weight = 100
author = { "your name"}
homepage = "http://tome.te4.org/"
description = [[Describe your addon here.]]
overload = true
superload = false
hooks = false
data = false
- short_name has to be the same as the folder name after "tome-"
- The version has to be the latest version. For example, {3,9,41} refers to beta 41. {3,9,42} might refer to beta 42.
Create a folder called overload:
Inside overload, create a folder called data/game/addons/tome-youraddonname/overload
Inside data, create a folder called zone/game/addons/tome-youraddonname/overload/data
Finally, inside zone, make a folder with the name of your new zone:/game/addons/tome-youraddonname/overload/data/zone
Step 3: Create your zone files/game/addons/tome-youraddonname/overload/data/zone/yourzonename
Inside this file, you have to put something like:/game/addons/tome-youraddonname/overload/data/zone/yourzonename/zone.lua
Code: Select all
return {
name = "yourzonename",
level_range = {1, 15},
level_scheme = "player",
actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() + level.level-1 + rng.range(-1,2) end,
update_base_level_on_enter = true,
max_level = 1,
width = 30, height = 20,
decay = {300, 800},
persistent = "zone",
all_remembered = false,
all_lited = true,
day_night = true,
min_material_level = function() return game.state:isAdvanced() and 3 or 1 end,
max_material_level = function() return game.state:isAdvanced() and 4 or 2 end,
ambient_music = "Rainy Day.ogg",
generator = {
map = {},
actor = {},
object = {},
trap = {},
},
levels = {},
post_process = function(level)
end,
foreground = function(level, x, y, nb_keyframes)
end,
}
Randomly generated maps will have to use a script. This can be found by extracting the game engine, and going to:game/module/tome/data/zones
game/engines/te4/engine/generator
For static maps, you have to put your map in
Static map generator code:/game/addons/tome-youraddonname/overload/data/maps/zones/yourzonename.lua
Code: Select all
generator = {
map = {
class = "engine.generator.map.Static",
map = "zones/yourzonename",
},
},
This is needed to load the right files to generate the map.
Data found in game/module/tome/data/general/npcs//game/addons/tome-youraddonname/overload/data/zone/yourzonename/npcs.lua
Data found in game/module/tome/data/general/grids//game/addons/tome-youraddonname/overload/data/zone/yourzonename/grids.lua
Data found in game/module/tome/data/general/traps//game/addons/tome-youraddonname/overload/data/zone/yourzonename/traps.lua
For a zone in the West, use: load("/data/general/objects/objects-maj-eyal.lua")/game/addons/tome-youraddonname/overload/data/zone/yourzonename/objects.lua
For a zone in the East, use: load("/data/general/objects/objects-far-east.lua")
Step 4: Putting your zone on the world map
You have to edit two files:
Copy these files to your addon:data/maps/wilderness/eyal.lua
data/maps/zones/wilderness/grids.lua
Make a new entity in grids.lua. You can change your own RGB values etc./game/addons/tome-youraddonname-overload/data/maps/wilderness/eyal.lua
/game/addons/tome-youraddonname/overload/data/maps/zones/wilderness/grids.lua
Code: Select all
newEntity{ base="ZONE_PLAINS", define_as = "YOURZONENAME",
name="the name that is displayed",
color={r=250, g=250, b=250},
add_displays={class.new{image="terrain/road_going_right_01.png", display_w=2}},
change_zone="yourzonename",
}
Code: Select all
defineTile('yourzonename', "YOURZONENAME")