walkable lava
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
walkable lava
Has anyone made a walkable lava yet? It seems like the kind of thing somebody would've done in a scenario. I'm a big believer in not reinventing the wheel whenever it can save me hours of debugging code.Celtic_Minstrel wrote: ↑December 26th, 2022, 10:39 pm You can make lava have its own movement cost in your addon. You need to make a custom "lava archetype" terrain, which will show up in the help but never be used on a map, and a custom version of the lava terrain that is an alias of the lava archetype instead of the unwalkable archetype. Then you need to use movetype patching (the[terrain_defaults]
tag) to set all units who don't declare a lava move cost to use the same as the unwalkable move cost. And of course you need to always use your custom lava terrain instead of the built-in one.
Do I need to add anything to the _main.cfg? That seems like a good step 1 question.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
- Lord-Knightmare
- Discord Moderator
- Posts: 2364
- Joined: May 24th, 2010, 5:26 pm
- Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
- Contact:
Re: walkable lava
Play _Tunnel of the Trolls_ of _Under the Burning Suns_walkable lava
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: walkable lava
I was going to post how to do it with actual code, but although I remember writing the code for it, I was unable to find it, so… sorry about that.
Re: walkable lava
It exists in Flight to Freedom: https://github.com/cooljeanius/Flight_Freedom/ ... /terrain/terrain.cfg#L14-L28Helmet wrote: ↑December 27th, 2022, 12:39 amHas anyone made a walkable lava yet? It seems like the kind of thing somebody would've done in a scenario. I'm a big believer in not reinventing the wheel whenever it can save me hours of debugging code.Celtic_Minstrel wrote: ↑December 26th, 2022, 10:39 pm You can make lava have its own movement cost in your addon. You need to make a custom "lava archetype" terrain, which will show up in the help but never be used on a map, and a custom version of the lava terrain that is an alias of the lava archetype instead of the unwalkable archetype. Then you need to use movetype patching (the[terrain_defaults]
tag) to set all units who don't declare a lava move cost to use the same as the unwalkable move cost. And of course you need to always use your custom lava terrain instead of the built-in one.
Wesnoth-related GitHub repos:
General mods collection, SotBEEE, AToTBWaTD, The Earth's Gut, A Little Adventure, FtF
Social media: Mastodon: @egallager@treehouse.systems, Steam: egallager
General mods collection, SotBEEE, AToTBWaTD, The Earth's Gut, A Little Adventure, FtF
Social media: Mastodon: @egallager@treehouse.systems, Steam: egallager
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: walkable lava
That looks a bit different… it's an alias of shallow water, not a separate terrain type.
Re: walkable lava
Everybody, let's all put walkable lava tiles on a map!
The Drake Clasher is too heavy to fly, so he can't cross lava like the other Drakes. Let's write some WML so the Drake Clasher can traverse lava!
I suggest we make his cautious footsteps represented by movement cost=3.
We need to do multiple things to make lava-walking happen. We need to create a new kind of lava tile, one that allows the Clasher to walk on it. Also, we need the new lava tile to appear in the Map Editor, so we can make a map that uses it (rather than the "old" lava).
Step 1, I guess, is to put some information in the _main.cfg, at the very bottom (outside the campaign tag).
"NU" is the abbreviation for my campaign, "New_Units_17." Substitute your own.
Is this correct? If not, why not?
Then create a text file within the utils folder, call it terrain.cfg.
Then create a text file within the utils folder, call it terrain_graphics.cfg.
Who wants to do the next step?
The Drake Clasher is too heavy to fly, so he can't cross lava like the other Drakes. Let's write some WML so the Drake Clasher can traverse lava!
I suggest we make his cautious footsteps represented by movement cost=3.
We need to do multiple things to make lava-walking happen. We need to create a new kind of lava tile, one that allows the Clasher to walk on it. Also, we need the new lava tile to appear in the Map Editor, so we can make a map that uses it (rather than the "old" lava).
Step 1, I guess, is to put some information in the _main.cfg, at the very bottom (outside the campaign tag).
"NU" is the abbreviation for my campaign, "New_Units_17." Substitute your own.
Is this correct? If not, why not?
Code: Select all
#ifdef EDITOR
[binary_path]
path=data/add-ons/New_Units_17
[/binary_path]
[editor_group]
id=NU
name= _ "My Custom Tileset"
icon="group_custom"
[/editor_group]
{~add-ons/New_Units_17/utils/terrain.cfg}
{~add-ons/New_Units_17/utils/terrain_graphics.cfg}
#endif
Then create a text file within the utils folder, call it terrain_graphics.cfg.
Who wants to do the next step?
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: walkable lava
For the terrain.cfg file, you need to define two terrains.
One of the custom terrains follows the format of the "unwalkable" terrain in the mainline file, which has the terrain code Qt, but of course you fill in all the fields with different values because it's meant to represent lava instead of "unwalkable". At minimum you need a custom ID and terrain code (string). This terrain should have a terrain code that ends in a lowercase t and is referred to as the "archetype". Since you're making a lava terrain, it would be the "lava archetype".
The other custom terrain is literally an exact copy of the existing lava terrain, but change the "aliasof" key to refer to the custom terrain code of the lava archetype terrain (and of course give it a custom ID and terrain code of its own). The terrain code of this one could be the same as the archetype, but drop the final t.
For the terrain_graphics.cfg file, you can copy the lines in the mainline terrain_graphics that refer to lava, and just change the terrain code to your custom lava terrain code.
The last thing you need to add is in your units.cfg file, which is a
Don't forget that terrain.cfg and terrain_graphics.cfg also need to be included outside of the
One of the custom terrains follows the format of the "unwalkable" terrain in the mainline file, which has the terrain code Qt, but of course you fill in all the fields with different values because it's meant to represent lava instead of "unwalkable". At minimum you need a custom ID and terrain code (string). This terrain should have a terrain code that ends in a lowercase t and is referred to as the "archetype". Since you're making a lava terrain, it would be the "lava archetype".
The other custom terrain is literally an exact copy of the existing lava terrain, but change the "aliasof" key to refer to the custom terrain code of the lava archetype terrain (and of course give it a custom ID and terrain code of its own). The terrain code of this one could be the same as the archetype, but drop the final t.
For the terrain_graphics.cfg file, you can copy the lines in the mainline terrain_graphics that refer to lava, and just change the terrain code to your custom lava terrain code.
The last thing you need to add is in your units.cfg file, which is a
[terrain_defaults]
tag that assigns the cost of the lava archetype terrain (using its ID) to be the same as unwalkable. This means that any unit that specifies an unwalkable movement cost but does not specify a lava movement cost (in other words, a whole bunch of mainline units) will be able to cross lava as if it were unwalkable.Don't forget that terrain.cfg and terrain_graphics.cfg also need to be included outside of the
#ifdef EDITOR
block, so they work when playing too.Re: walkable lava
I'm currently faking it. If you scatter Rubble (Map editor, "rough" category) onto lava it doesn't become walkable, BUT try this:
make a walkable path using "dry hills" (Same category in Map editor) through the lava field. Scatter rubble onto every hex of the path, and about the same number of lava-only hexes. Result: lava field has scattered rubble all over it, and *some* of the rubble is walkable, some isn't.
It's a kludge, but until I get deeper into the Wesnoth code, it's what I got.
make a walkable path using "dry hills" (Same category in Map editor) through the lava field. Scatter rubble onto every hex of the path, and about the same number of lava-only hexes. Result: lava field has scattered rubble all over it, and *some* of the rubble is walkable, some isn't.
It's a kludge, but until I get deeper into the Wesnoth code, it's what I got.