DoomRL > Modding

Mod Ports (from older versions)

<< < (6/8) > >>

Game Hunter:

--- Quote from: tinyrodent on January 15, 2012, 17:20 ---With further experimentation I found that Level.fill and Level.place_tile both cause crash.
--- End quote ---
I think I know the problem: permanent cell tiles have been removed. There are some ways to set permanence to cells separately which allows for fewer cells to be loaded. You probably have some "pwall"s or "prwall"s in your code, which no longer exist. Replacing these with "wall" or "rwall" (respectively) should take care of the problem. (The only exception to this are fluids: "pwater", "pacid", and "plava" still exist because they're normally passable, so they act differently from cells with CF_BLOCKMOVE.)

If you want to set a cell to be permanent, there are two ways to do this. (Just as a reminder, a permanent cell is one that cannot be destroyed except by nukes.) The first involves setting them to be permanent at creation:

--- Code: ---Create = function()
  ....
  local translation = {
    ["#"] = {"wall", flags = {LFPERMANENT} },
    ....
  }
  ....
}

--- End code ---
This will make any #s you place on the map a permanent wall cell. The second method is done after the map is created:

--- Code: ---Generator.set_permanence( area )

--- End code ---
This will make any cells within the area permanent. Usually it's used if you're planning on making the map static (i.e., no wall-busting) and can be placed alongside the Level.player() function. Of course, you can set a cell to be permanent when you create it, but this is typically done by setting the armor and hp of the cell to zero.

Hope this helps!

tinyrodent:
Thanks again, yes pwall was the problem.

tinyrodent:
But there are surely many more compatibility problems. I tried to make a simple example lever (source below) but this crashes when Level.place_tile is called: Lua error : lua\level.lua:348: attempt to index field '?' (a nil value)

Is there any particular reason that the lua sources of DoomRL (such as level.lua) need to be closed?


--- Code: ---Items {
id = "lever_win",
name = "lever",
color = MAGENTA,
color_id = "lever",
sprite = 169,
weight = 0,
type = ITEMTYPE_LEVER,
good = "asdf",
desc = "asdf",
flags = { IF_NODESTROY },
OnUse = function(self,being)
player:win()
end,
}

--- End code ---

Game Hunter:

--- Quote from: tinyrodent on January 16, 2012, 09:09 ---I tried to make a simple example lever (source below) but this crashes when Level.place_tile is called: Lua error : lua\level.lua:348: attempt to index field '?' (a nil value)
--- End quote ---
This sort of error (that is, a level.lua crash due to bad indexing) is almost always because a tile has been used on the "map" without being added to the "translation". Since you've probably at least attempted to do this correctly, my guess is that your notation is off. Here are some examples for tile translations using items and beings:

--- Code: ---local translation = {
  ["#"] = "wall",                                        -- tile with cell by itself
  ["}"] = { "floor", item = "pistol" }                   -- tile with cell and item
  ["h"] = { "floor", being = "former" }                  -- tile with cell and being
  ["U"] = { "floor", being = "former", item = "pistol" } -- tile with cell, being, and item
}

--- End code ---
You can find this sort information in the tutorial Constructing a Map (it's not in the step-by-step but it exists on the review source). I still need to update it for stuff like definition and field changes, but the overall process for setting up maps is virtually unchanged. (I will spend some time this week to update the tutorials for 0995, possibly write a few more now that modders can setup entire episodes.)


--- Quote from: tinyrodent on January 16, 2012, 09:09 ---Is there any particular reason that the lua sources of DoomRL (such as level.lua) need to be closed?
--- End quote ---
You'll have to wait for Kornel to reply on this one.

tinyrodent:
Thanks I got it working sort of. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version