Page 1 of 2
Question for learning to make a module.
Posted: Wed Sep 21, 2011 7:39 am
by Kats
Ok, Here's a list of questions I have about making a module.
In game\modules\MODULE NAME\data\zones\ZONE NAME\zone.lua
What does
do? I've seen it in the example module, and some other mods.
What does
Code: Select all
startx = 7
starty = 1
stopx = 7
stopy = 1
in game\modules\MODULE NAME\data\maps\zones\ZONE.lua actually do? I have a hunch that start x and start y indicate the starting position, but I don't know what the stopx, stopy do. Also, do they start counting from line and column 0?
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 8:04 am
by Grey
It's decay of items and enemies from the level. I kinda ignore it in my games since I don't expect people to backtrack.
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 8:25 am
by Kats
I'm trying to load the game in a static map, but I have had no success so far. The module loads, but keeps loading indefinetly after the name and role check.
What I did:
1. Made a static map in game\modules\dynasty\data\maps\zones, named temple.lua.
It contains:
Code: Select all
defineTile('^', "WALL")
defineTile(".", "FLOOR")
startx = 2
starty = 4
stopx = 2
stopy = 4
return [[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^................................................^
^................................................^
^................................................^
^................................................^
^................................................^
^................................................^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
]]
2. Made a directory in game\modules\dynasty\data\zones named temple.
Made 5 files in it, all copied from the dungeon directory.
3. Edited game\modules\dynasty\data\zones\temple\zone.lua
It reads now:
Code: Select all
return {
name = "Ruined Temple",
level_scheme = "fixed",
decay = {300, 800},
max_level = 1,
width = 50, height = 8,
persistent = "zone",
all_lited = true,
all_remembered = true,
generator = {
map = {
class = "engine.generator.map.Static",
map = "zones/temple",
},
},
}
4. edited game\modules\dynasty\class\Game.lua so that it reads:
Code: Select all
function _M:newGame()
self.player = Player.new{name=self.player_name, game_ender=true}
Map:setViewerActor(self.player)
self:setupDisplayMode()
self.creating_player = true
local birth = Birther.new(nil, self.player, {"base", "role" }, function()
self:changeLevel(1, "temple")
print("[PLAYER BIRTH] resolve...")
self.player:resolve()
self.player:resolve(nil, true)
self.player.energy.value = self.energy_to_act
self.paused = true
self.creating_player = false
print("[PLAYER BIRTH] resolved!")
end)
self:registerDialog(birth)
end
What did I do wrong?
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 10:52 am
by Grey
The first file should end like thus:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^]]
Otherwise the extra line break gets included in the map definition and it doesn't fit your requirements of height = 8.
Also I think your zone file should define "zones/temple.lua".
If you ever have a problem with the module not loading or getting stuck on an infinite loop then check the te4_log.txt file in the main engine directory and look for lua errors. These help a lot!
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 12:03 pm
by Kats
If ToME gets stuck in an infinite loop, is there a dedicated way to close it, or I need to end it from task manager?
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 12:50 pm
by Grey
Task manager, alas.
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 1:42 pm
by Kats
Still doesn't work. I corrected the last line in the map file.
Code: Select all
[CPU] Detected 4 CPUs
OpenAL device available: DirectSound Default (default DirectSound Default)
OpenAL device available: WaveOut Default (default DirectSound Default)
OpenAL device available: No Output (default DirectSound Default)
Available video driver: windows
Available video driver: dummy
NO SELFEXE: bootstrapping from CWD
Booting T-Engine from: C:\Tome\Beta34\t-engine.exe
SelfExe gave us app directory of: C:\Tome\Beta34\
LuaVM: LuaJIT 2.0.0-beta8 x86
Creating particles thread 0
Creating particles thread 1
Creating particles thread 2
LuaVM: LuaJIT 2.0.0-beta8 x86
LuaVM: LuaJIT 2.0.0-beta8 x86
LuaVM: LuaJIT 2.0.0-beta8 x86
[DO RESIZE] 800x600 (0)
OpenGL max texture size: 8192
OpenGL max texture size: 8192
===fbo 1
Running lua loader code...
Reboot using te4 LATEST boot player false
[ENGINE LOADER] available from teae: te4-0.9.34
[ENGINE LOADER] found engines te4={[1]={[1]=0.000000 , [2]=9.000000 , [3]=34.000000 , [4]="te4" , [5]=16.000000 , ["load_teae"]="/engines/te4-0.9.34.teae" , } , } __byname={["te4-0.9.34"]=true , }
[ENGINE LOADER] looked in:
C:\Users\Victor\\T-Engine\4.0
bootstrap
C:\Tome\Beta34\\game\thirdparty
C:\Tome\Beta34\\game
[ENGINE LOADER] sorted: te4 0 9 34
[ENGINE LOADER] loading engine: 0 9 34 te4
[ENGINE LOADER] using archived engine: /engines/te4-0.9.34.teae
Using cached font /data/font/Vera.ttf 12
Available resolutions: 1366x768x32
Available resolutions: 1360x768x32
Available resolutions: 1280x768x32
Available resolutions: 1280x720x32
Available resolutions: 1024x768x32
Available resolutions: 800x600x32
Available resolutions: 720x576x32
Available resolutions: 720x480x32
Available resolutions: 640x480x32
Available resolutions: 1366x768x16
Available resolutions: 1360x768x16
Available resolutions: 1280x768x16
Available resolutions: 1280x720x16
Available resolutions: 1024x768x16
Available resolutions: 800x600x16
Available resolutions: 720x576x16
Available resolutions: 720x480x16
Available resolutions: 640x480x16
[KEYBINDER] Loaded keybinds: move
[KEYBINDER] Loaded keybinds: hotkeys
[KEYBINDER] Loaded keybinds: inventory
[KEYBINDER] Loaded keybinds: actions
[KEYBINDER] Loaded keybinds: interface
[KEYBINDER] Loaded keybinds: debug
Switching resolution to 1362x742 1362 742 false
Setting resolution to 1362x742 (windowed)
[DO RESIZE] 1362x742 (0)
OpenGL max texture size: 8192
[RESOLUTION] changed to 1362 742 from 1362 742
Creating profile thread
[PROFILE] mounted online on /current-profile
LuaVM: LuaJIT 2.0.0-beta8 x86
TE4Online starting...
[PROFILE] unmounted online from /current-profile
[ONLINE PROFILE] auth
[PROFILE] waiting for first auth
[PROFILE] Thread connected to te4.org
[PROFILE] logged in! kats
[PROFILE] Main thread got authed Azo
[ENGINE] Setting requested FPS to 10 (100 ms)
[ENGINE] Switching to turn based
Creating module boot-te4-0.9.34-nomusic.team :: (as dir) false :: (as team) 24
Module mismatch engine version boot-0.9.29 using engine te4-0.9.29
Loaded module definition for boot-0.9.29 using engine te4-0.9.29
Creating module dynasty :: (as dir) true :: (as team) nil
Loaded module definition for dynasty-0.0.1 using engine te4-0.9.34
Creating module example :: (as dir) true :: (as team) nil
Loaded module definition for example-1.0.0 using engine te4-0.9.34
Creating module example_realtime :: (as dir) true :: (as team) nil
Loaded module definition for example_realtime-1.0.0 using engine te4-0.9.34
Creating module tome-3.9.34-nomusic.team :: (as dir) false :: (as team) 20
Loaded module definition for tome-3.9.34 using engine te4-0.9.34
tome boot
example tome
boot example
dynasty boot
boot example_realtime
boot dynasty
boot tome
example example_realtime
dynasty example
* Module: tome
** 3.9.34
* Module: boot
** 0.9.29
* Module: dynasty
** 0.0.1
* Module: example
** 1.0.0
* Module: example_realtime
** 1.0.0
After fs.reset
[1] = {
[path] = C:\Tome\Beta34\\game\engines\te4-0.9.34.teae
}
[ENGINE] Switching to turn based
Make wait background texture 2 : 1362x742 (2048, 1024)
[PROFILE] Pull socket connected to te4.org
[ONLINE PROFILE] reconnecting to channels
Using cached font /data/font/Vera.ttf 12
[ONLINE PROFILE] current character game did not tell us
[ENGINE] Switching to realtime, interval 125 ms
[MODULE LOADER] loading module T-Engine4 Main Menu [mod.load] :: nil nil
[GAMMA] Setting gamma correction using SDL 1.2
[ENGINE] Switching to turn based
[GAMMA] Setting gamma correction using SDL 1.2
[ONLINE PROFILE] current character Main Menu
Using cached font /data/font/Vera.ttf 12
[TALENT] player 1 learning T_MANATHRUST true 2
[TALENT] player 1 learning T_FLAME true 2
[TALENT] player 1 learning T_FIREFLASH true 2
[TALENT] player 1 learning T_LIGHTNING true 2
[TALENT] player 1 learning T_SUNSHIELD true 2
[TALENT] player 1 learning T_FLAMESHOCK true 2
Using cached font /data/font/VeraMoBd.ttf 22
Using cached font /data/font/VeraMoBd.ttf 22
Using cached font /data/font/VeraMoBd.ttf 22
Using cached font /data/font/VeraMoBd.ttf 22
Using cached font /data/font/VeraMoBd.ttf 22
Using cached font /data/font/VeraMoBd.ttf 22
Using cached font /data/font/VeraMoBd.ttf 22
[SHADER] Loading from /data/gfx/shaders/main_fbo.lua
New GL Shader program 1
New GL Shader 2 of type 35632
[SHADER] created fragment shader from /data/gfx/shaders/main_fbo.frag
*p 1: Uniform: 0: 1406 blur
*p 1: Uniform: 1: 8B52 colorize
*p 1: Uniform: 2: 1406 hp_warning
*p 1: Uniform: 3: 1406 motionblur
*p 1: Uniform: 4: 8B5E noisevol
*p 1: Uniform: 5: 8B5E tex
*p 1: Uniform: 6: 8B50 texSize
*p 1: Uniform: 7: 1406 tick
[SHADER] Loading from /data/gfx/shaders/full_fbo.lua
New GL Shader program 3
New GL Shader 4 of type 35632
[SHADER] created fragment shader from /data/gfx/shaders/full_fbo.frag
*p 3: Uniform: 0: 1406 gamma
*p 3: Uniform: 1: 8B5E sceneBuffer
[GAMMA] Setting gamma correction using fullscreen shader 1.2
Loading entities file from file /data/zones/dungeon/npcs.lua
Loading entities file from file /data/general/npcs/skeleton.lua
Loading entities file from file /data/general/npcs/canine.lua
Loading entities file from file /data/general/npcs/troll.lua
Loading entities file from file /data/zones/dungeon/grids.lua
Loading entities file from file /data/general/grids/basic.lua
Loading entities file from file /data/general/grids/forest.lua
Loading entities file from file /data/general/grids/water.lua
Loading entities file from file /data/general/grids/underground.lua
Loading entities file from file /data/zones/dungeon/objects.lua
Loading entities file from file /data/zones/dungeon/traps.lua
Initiated zone Forest with base_level 1
C Map size 28:15 :: 420
C Map seens texture: 38 (50x50)
Stored entities list actor table: 0x08a57e58
Stored entities list object table: 0x08a59190
Stored entities list trap table: 0x08a59218
loaded room generator random_room function: 0x08a0b360
room generator function: 0x08a0b360 is making a room
loaded room center_arrows 11 15
alloc center_arrows
room allocated at 35 14 with center 40 21
room generator function: 0x08a0b360 is making a room
loaded room weird1 9 9
alloc weird1
room allocated at 1 17 with center 5 21
room generator function: 0x08a0b360 is making a room
loaded room inner_cross 10 10
alloc inner_cross
room allocated at 2 7 with center 6 11
room generator function: 0x08a0b360 is making a room
loaded room pilar_big 10 10
alloc pilar_big
room allocated at 3 34 with center 7 38
room generator function: 0x08a0b360 is making a room
loaded room oval 10 14
alloc oval
room allocated at 18 10 with center 22 16
room generator function: 0x08a0b360 is making a room
loaded room cells3 10 8
alloc cells3
room allocated at 24 38 with center 28 41
room generator function: 0x08a0b360 is making a room
loaded room cells9 18 5
alloc cells9
room allocated at 28 7 with center 36 9
room generator function: 0x08a0b360 is making a room
loaded room generator simple function: 0x08aa56e0
alloc simple10x12
room allocated at 36 30 with center 40 35
room generator function: 0x08a0b360 is making a room
loaded room multi_pillar 12 9
alloc multi_pillar
room allocated at 10 24 with center 15 28
room generator function: 0x08a0b360 is making a room
alloc simple12x6
room allocated at 22 30 with center 27 32
Begin tunnel 10 table: 0x08ab7118
Loading tile terrain/granite_wall1.png
Loading tile terrain/marble_floor.png
Loading tile terrain/granite_door1.png
Loading tile npc/skeleton_warrior.png
Loading tile npc/troll_s.png
Talent resolver for skeleton mage : T_MANATHRUST => 3
[TALENT] skeleton mage 288 learning T_MANATHRUST true 3
Talent resolver for skeleton mage : T_FLAME => 2
[TALENT] skeleton mage 288 learning T_FLAME true 2
Loading tile npc/skeleton_mage.png
Loading tile npc/canine_w.png
Loading tile npc/canine_warg.png
Loading tile npc/troll_f.png
Loading tile npc/troll_c.png
Loading tile npc/troll_m.png
Loading tile npc/degenerated_skeleton_warrior.png
Loading tile terrain/granite_wall1_3.png
Loading tile terrain/granite_wall1_2.png
Loading tile terrain/granite_wall1_4.png
Loading tile terrain/granite_wall1_5.png
Loading tile terrain/granite_wall2.png
Loading tile terrain/granite_wall3.png
Loading tile terrain/granite_wall1_1.png
Loading tile terrain/granite_wall_pillar_8.png
Loading tile terrain/marble_floor.png
Loading tile terrain/granite_wall_pillar_2.png
Loading tile terrain/granite_wall_pillar_1.png
Loading tile terrain/granite_wall_pillar_7.png
Loading tile terrain/granite_wall_pillar_small.png
Loading tile terrain/granite_wall_pillar_small_top.png
Loading tile terrain/marble_floor.png
Loading tile terrain/granite_door1_vert.png
Loading tile terrain/granite_door1_vert_north.png
Loading tile terrain/granite_wall2_8.png
Loading tile terrain/granite_wall2_11.png
Loading tile terrain/granite_wall_pillar_3.png
Loading tile terrain/granite_wall_pillar_9.png
Loading tile terrain/granite_wall2_14.png
Loading tile terrain/granite_wall2_7.png
Loading tile terrain/granite_wall2_15.png
Loading tile terrain/granite_wall2_5.png
Loading tile terrain/granite_wall2_16.png
Loading tile terrain/granite_wall2_12.png
Loading tile terrain/granite_wall2_10.png
Loading tile terrain/granite_wall2_4.png
Loading tile terrain/granite_wall2_17.png
Loading tile player/humanoid_halfling_protector_myssil.png
[MUSIC] loading The saga begins.ogg Error loading sound "/data/music/The saga begins.ogg": The system cannot find the file specified.
[COROUTINE] registering getnews thread: 0x089fe478
[ENGINE] Setting requested FPS to 10 (100 ms)
[MODULE LOADER] done loading module T-Engine4 Main Menu
[PROFILE] mounted online on /current-profile
[PROFILE] unmounted online from /current-profile
Wait finished, counted 1239, 1295 ticks
[PROFILE] mounted online on /current-profile
[PROFILE] unmounted online from /current-profile
[ONLINE PROFILE] get news
[PROFILE] mounted online on /current-profile
[PROFILE] unmounted online from /current-profile
[PROFILE THREAD] batching CSETs
[PROFILE THREAD] flushing CSETs
[SOUND] loading from /data/sound/ui/subtle_button_sound.ogg :=: sound "/data/sound/ui/subtle_button_sound.ogg" : <static>
Creating module boot-te4-0.9.34-nomusic.team :: (as dir) false :: (as team) 24
Creating module dynasty :: (as dir) true :: (as team) nil
Loaded module definition for dynasty-0.0.1 using engine te4-0.9.34
Creating module example :: (as dir) true :: (as team) nil
Loaded module definition for example-1.0.0 using engine te4-0.9.34
Creating module example_realtime :: (as dir) true :: (as team) nil
Loaded module definition for example_realtime-1.0.0 using engine te4-0.9.34
Creating module tome-3.9.34-nomusic.team :: (as dir) false :: (as team) 20
Loaded module definition for tome-3.9.34 using engine te4-0.9.34
tome dynasty
example tome
dynasty example
example_realtime dynasty
dynasty example_realtime
dynasty tome
example example_realtime
* Module: tome
** 3.9.34
* Module: dynasty
** 0.0.1
* Module: example
** 1.0.0
* Module: example_realtime
** 1.0.0
After fs.reset
[1] = {
[path] = C:\Tome\Beta34\\game\engines\te4-0.9.34.teae
}
[PROFILE THREAD] batching CSETs
[PROFILE THREAD] flushing CSETs
[ENGINE] Switching to turn based
[PROFILE] mounted online on /current-profile
[PROFILE] unmounted online from /current-profile
[MAIN] rebooting lua state: te4 0.9.34 dynasty-0.0.1 Az true
[ENGINE] Switching to turn based
NO SELFEXE: bootstrapping from CWD
Booting T-Engine from: C:\Tome\Beta34\t-engine.exe
SelfExe gave us app directory of: C:\Tome\Beta34\
LuaVM: LuaJIT 2.0.0-beta8 x86
Destroying particle thread 0 (waiting for mutex)
Destroying particle thread 0
Destroying particle thread 0 (waiting for thread 3ee78)
Cleaning up particle thread 0
Cleaned up particle thread 0
Destroyed particle thread 0 (0)
Destroying particle thread 1 (waiting for mutex)
Destroying particle thread 1
Destroying particle thread 1 (waiting for thread 3f600)
Cleaning up particle thread 1
Cleaned up particle thread 1
Destroyed particle thread 1 (0)
Destroying particle thread 2 (waiting for mutex)
Destroying particle thread 2
Cleaning up particle thread 2
Cleaned up particle thread 2
Destroying particle thread 2 (waiting for thread 25f7fe8)
Destroyed particle thread 2 (0)
Creating particles thread 0
LuaVM: LuaJIT 2.0.0-beta8 x86
Creating particles thread 1
LuaVM: LuaJIT 2.0.0-beta8 x86
Creating particles thread 2
Running lua loader code...
Reboot using te4 0.9.34 dynasty-0.0.1 Az true
[ENGINE LOADER] available from teae: te4-0.9.34
[ENGINE LOADER] found engines te4={[1]={[1]=0.000000 , [2]=9.000000 , [3]=34.000000 , [4]="te4" , [5]=16.000000 , ["load_teae"]="/engines/te4-0.9.34.teae" , } , } __byname={["te4-0.9.34"]=true , }
[ENGINE LOADER] looked in:
C:\Users\Victor\\T-Engine\4.0
bootstrap
C:\Tome\Beta34\\game\thirdparty
C:\Tome\Beta34\\game
[ENGINE LOADER] loading engine: 0 9 34 te4
[ENGINE LOADER] using archived engine: /engines/te4-0.9.34.teae
LuaVM: LuaJIT 2.0.0-beta8 x86
Using cached font /data/font/Vera.ttf 12
Available resolutions: 1366x768x32
Available resolutions: 1360x768x32
Available resolutions: 1280x768x32
Available resolutions: 1280x720x32
Available resolutions: 1024x768x32
Available resolutions: 800x600x32
Available resolutions: 720x576x32
Available resolutions: 720x480x32
Available resolutions: 640x480x32
Available resolutions: 1366x768x16
Available resolutions: 1360x768x16
Available resolutions: 1280x768x16
Available resolutions: 1280x720x16
Available resolutions: 1024x768x16
Available resolutions: 800x600x16
Available resolutions: 720x576x16
Available resolutions: 720x480x16
Available resolutions: 640x480x16
[KEYBINDER] Loaded keybinds: move
[KEYBINDER] Loaded keybinds: hotkeys
[KEYBINDER] Loaded keybinds: inventory
[KEYBINDER] Loaded keybinds: actions
[KEYBINDER] Loaded keybinds: interface
[KEYBINDER] Loaded keybinds: debug
Switching resolution to 1362x742 1362 742 false
Setting resolution to 1362x742 (windowed)
[DO RESIZE] 1362x742 (0)
OpenGL max texture size: 8192
[RESOLUTION] changed to 1362 742 from 1362 742
[PROFILE] mounted online on /current-profile
[PROFILE] unmounted online from /current-profile
[ONLINE PROFILE] auth
[PROFILE] waiting for first auth
[ENGINE] Setting requested FPS to 10 (100 ms)
[ENGINE] Switching to turn based
Creating module boot-te4-0.9.34-nomusic.team :: (as dir) false :: (as team) 24
Module mismatch engine version boot-0.9.29 using engine te4-0.9.29
Loaded module definition for boot-0.9.29 using engine te4-0.9.29
Creating module dynasty :: (as dir) true :: (as team) nil
Loaded module definition for dynasty-0.0.1 using engine te4-0.9.34
Creating module example :: (as dir) true :: (as team) nil
Loaded module definition for example-1.0.0 using engine te4-0.9.34
Creating module example_realtime :: (as dir) true :: (as team) nil
Loaded module definition for example_realtime-1.0.0 using engine te4-0.9.34
Creating module tome-3.9.34-nomusic.team :: (as dir) false :: (as team) 20
Loaded module definition for tome-3.9.34 using engine te4-0.9.34
tome boot
example tome
boot example
dynasty boot
boot example_realtime
boot dynasty
boot tome
example example_realtime
dynasty example
* Module: tome
** 3.9.34
* Module: boot
** 0.9.29
* Module: dynasty
** 0.0.1
* Module: example
** 1.0.0
* Module: example_realtime
** 1.0.0
After fs.reset
[1] = {
[path] = C:\Tome\Beta34\\game\engines\te4-0.9.34.teae
}
[ENGINE] Switching to turn based
Make wait background texture 2 : 1362x742 (2048, 1024)
Using cached font /data/font/Vera.ttf 12
[MODULE LOADER] module MD5 40f269eadadacb2f0ce
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 2:00 pm
by Grey
Hmm, I'm at work at the mo and can't help till I can look at my own code at home. I suggest you take a look at how Broken Bottle implements this though, since I did an almost identical starting room in it. Check for what differences there might be in the files and functions.
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 2:09 pm
by Kats
Ok found the mistake.
Also I think your zone file should define "zones/temple.lua".
This is wrong. The definition should be without extension.
Code: Select all
generator = {
map = {
class = "engine.generator.map.Static",
map = "zones/temple",
},
}
Is the correct syntax.
*squeal* I have an empty room now! Next step: Making an overland map, and linking my empty room to it!
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 2:57 pm
by Grey
Heh, nice.
The overland map is just a big room really. Stairs are easy enough to implement. Again, check out Broken Bottle for how to link dungeons together. An overworld map just involves multiple links in place. Make sure you define your different entrance types in grids.lua.
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 3:29 pm
by Kats
Oh also.
What does:
Code: Select all
startx = 2
starty = 4
stopx = 2
stopy = 4
do?
I asked once but it fell through the cracks. And I'm afraid it will break something further one. I'm particularily interested in stopx and stopy.
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 3:59 pm
by Grey
I think the starts are for the player starting position, though be aware that the numbers start from 0 (so 0,0 is normally your first tile). No idea what the stop numbers are for though - I've always just set them as the same as the start numbers.
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 4:05 pm
by Kats
Grey wrote:Heh, nice.
The overland map is just a big room really. Stairs are easy enough to implement. Again, check out Broken Bottle for how to link dungeons together. An overworld map just involves multiple links in place. Make sure you define your different entrance types in grids.lua.
Another question.
If the wilderness is just one big room, can it be randomly generated with a generator? If it can, can it still have different entrance types?
(I mean, for example, generate a wilderness map randomly with a generator, and in that wilderness to have multiple exits to dungeon A, dungeon B, Dungeon C, Town A, and so on?) Also, if this is possible, the generator will not place exits in the same tiles, right?
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 5:18 pm
by Kats
Another question. What am I missing?
In order to connect zones I need to edit my static map file.
Like so:
Code: Select all
defineTile('^', "WALL")
defineTile(".", "FLOOR")
definetile("<", "UP_WILDERNESS")
startx = 2
starty = 4
stopx = 2
stopy = 4
return [[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^................................................^
^................................................^
^...............................................<^
^................................................^
^................................................^
^................................................^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^]]
Next, I must make sure that whatever I'm defining exits in the grid. It does.
In game\modules\dynasty\data\general\grids\basic.lua there's a block that reads:
Code: Select all
newEntity{
define_as = "UP_WILDERNESS",
name = "exit to the wilds",
display = '<', color_r=255, color_g=0, color_b=255, back_color=colors.DARK_GREY,
always_remember = true,
notice = true,
change_level = 1,
change_zone = "wilderness",
}
After, I must make sure that there's a zone named wilderness, and a map named wilderness.
In order to not make mistakes, I just copied the temple...template, and tested with that, only altering a few things.
\game\modules\dynasty\data\zones\wilderness\zone.lua
Code: Select all
return {
name = "Wilderness",
level_scheme = "fixed",
decay = {300, 800},
max_level = 1,
width = 50, height = 8,
persistent = "zone",
all_lited = true,
all_remembered = true,
generator = {
map = {
class = "engine.generator.map.Static",
map = "zones/wilderness",
},
},
}
and \game\modules\dynasty\data\maps\zones\wilderness.lua
Code: Select all
defineTile('^', "WALL")
defineTile(".", "FLOOR")
return [[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^................................................^
^................................................^
^................................................^
^................................................^
^................................................^
^................................................^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^]]
What am I missing? What am I doing wrong? It won't work.
Re: Question for learning to make a module.
Posted: Wed Sep 21, 2011 6:48 pm
by Grey
A starting x and y in the wilderness zone!
A random generator with multiple entrances is possible, but you'll have to code it yourself, as the default generators presume only 1 or 2 zone changes.