impassable overlay removing Plank Bridge

The place to post your WML questions and answers.

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.
User avatar
Helmet
Posts: 331
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

impassable overlay removing Plank Bridge

Post by Helmet »

In the map editor, I made a Regular Chasm on hex (1,5) and placed a Plank Bridge in the same hex. I wanted to make the Plank Bridge impassable, so I applied an Impassable Overlay. My problem is this: When I placed the overlay, the bridge vanished, leaving nothing but the chasm.

When I played the scenario, yep, no Plank Bridge.

Is this normal behavior? Like, I have to pick one: Plank Bridge or Overlay. I can't have both.

If so, is there a workaround?
User avatar
Lord-Knightmare
Discord Moderator
Posts: 1362
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: impassable overlay removing Plank Bridge

Post by Lord-Knightmare »

Helmet wrote: December 2nd, 2020, 2:44 pm In the map editor, I made a Regular Chasm on hex (1,5) and placed a Plank Bridge in the same hex. I wanted to make the Plank Bridge impassable, so I applied an Impassable Overlay. My problem is this: When I placed the overlay, the bridge vanished, leaving nothing but the chasm.

When I played the scenario, yep, no Plank Bridge.

Is this normal behavior? Like, I have to pick one: Plank Bridge or Overlay. I can't have both.

If so, is there a workaround?
This is normal. The plank bridge itself is an overlay. You can even place bridges over grassland/chasm/lava (not sure why anyone would do woodenbridge over lava though).
The workaround is making your own new terrain type with impassable and the bridge.
User avatar
Helmet
Posts: 331
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: impassable overlay removing Plank Bridge

Post by Helmet »

Lord-Knightmare wrote: December 2nd, 2020, 3:08 pm This is normal. The plank bridge itself is an overlay. You can even place bridges over grassland/chasm/lava (not sure why anyone would do woodenbridge over lava though).
The workaround is making your own new terrain type with impassable and the bridge.
Oh, okay. Thanks for the info.

That hex is the "arrival hex." If one of the player's units is positioned there and then a new unit arrives, the arriving unit gets displaced into the cavern wall. Which is a bummer. I wish there was something simpler than a new terrain type, though.

I guess I could make an event, so that if a unit moves to hex (1,5), he says "Oh, no! I'm losing my balance! I'm falling! Aaaaa!"...and then I [kill] the unit. But that would be mean.
User avatar
octalot
Developer
Posts: 548
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: impassable overlay removing Plank Bridge

Post by octalot »

Does [whichever WML tag is making these units arrive] have a check_passability attribute?
User avatar
Helmet
Posts: 331
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: impassable overlay removing Plank Bridge

Post by Helmet »

octalot wrote: December 2nd, 2020, 3:45 pm Does [whichever WML tag is making these units arrive] have a check_passability attribute?
I checked the Wiki, and I think the answer is no. Unless I missed it.

It's nothing fancy. On turn 3, a unit appears on the plank bridge and says something, then continues into the cave.

Code: Select all

[event]
	name=turn 3
	[unit]
		side=1
...
		x=1
		y=5
	[/unit]
	[message]
		speaker=Bittil
		message="Hello?"
	[/message]
Last edited by Helmet on December 2nd, 2020, 4:54 pm, edited 1 time in total.
User avatar
Helmet
Posts: 331
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: impassable overlay removing Plank Bridge

Post by Helmet »

Lord-Knightmare wrote: December 2nd, 2020, 3:08 pm The workaround is making your own new terrain type with impassable and the bridge.
I tried to make the custom terrain. The code almost works. In the map editor, I see the plank bridge as my cursor, and I can add it to my map, but it leaves gaps.

The Regular Chasm is not under my plank bridge. How do I include it?

Code: Select all

# An impassable plank bridge
[terrain_type]
    symbol_image=impassable_bridge-se	# the image which appears on the map itself
    editor_image=impassable_bridge-se 	# the image displayed in the menu of terrain choices   
    editor_name= _ "Impassable Bridge"
    editor_group=TPoE
    id=impassable_bridge
    string=^Ejz
    aliasof=_bas
    editor_group=TPoE
[/terrain_type]
{OVERLAY *^Ejz (impassable_bridge-se)}
User avatar
Lord-Knightmare
Discord Moderator
Posts: 1362
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: impassable overlay removing Plank Bridge

Post by Lord-Knightmare »

I think your problem is with TerrainWML and the TerrainGraphics. They are not my forte so I cannot be of much assistance.
The Regular Chasm is not under my plank bridge. How do I include it?
I think you have to include a default_base=Qxu inside the [terrain_type][/terrain_type]
User avatar
Helmet
Posts: 331
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: impassable overlay removing Plank Bridge

Post by Helmet »

Lord-Knightmare wrote: December 2nd, 2020, 5:20 pm I think you have to include a default_base=Qxu inside the [terrain_type][/terrain_type]
Thank you! As it turns out, that was the part I couldn't figure out -- and it wasn't in the code examples I was referencing.

The custom terrain works now. The bridge is impassable.

I had to make a custom sprite, but that was no biggy.
custom_bridge.png
custom_bridge.png (11.54 KiB) Viewed 357 times
Shiki
Developer
Posts: 317
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: impassable overlay removing Plank Bridge

Post by Shiki »

Looked into it too, but all solutions have some quirks …
Made a symbol image which you could use though.

Another option is to block the terrain by putting a petrified unit onto the hex, or teleporting units which step onto it.
Attachments
impassable-bridge-se-nw-tile.png
impassable-bridge-se-nw-tile.png (7.9 KiB) Viewed 337 times
Try out the dark board theme.
User avatar
Helmet
Posts: 331
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: impassable overlay removing Plank Bridge

Post by Helmet »

Shiki wrote: December 2nd, 2020, 6:42 pm Looked into it too, but all solutions have some quirks …
Made a symbol image which you could use though.
I added it. It looks good, thanks.
Shiki wrote: December 2nd, 2020, 6:42 pm Another option is to block the terrain by putting a petrified unit onto the hex, or teleporting units which step onto it.
Clever! That's one of the fun thing about WML: Finding solutions allow you to be creative. Another possibility would be to make the advancing unit step back to its previous hex. But then that raises another question: What if another unit was already there?

Anyhow, I had tried to make a unit back-up a hex, but couldn't get the code to work. I knew $x2 and $y2 were the previous hex, so I thought it would be easy. But nope.
Shiki
Developer
Posts: 317
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: impassable overlay removing Plank Bridge

Post by Shiki »

It actually is easy. For an enter hex event x2,y2 would be the adjacent hex which can be full. For a moveto event it can be farther away, but it's empty.

Code: Select all

[event]
    name=moveto
    first_time_only=no
    [filter]
        x,y=1,5
    [/filter]

    {TELEPORT_TILE 1 5 $x2 $y2}
[/event]
Uses the macro from here
Try out the dark board theme.
User avatar
Helmet
Posts: 331
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: impassable overlay removing Plank Bridge

Post by Helmet »

Oh! Thanks. I didn't think of teleporting. That does look easy. Thanks for answering that question.
User avatar
octalot
Developer
Posts: 548
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: impassable overlay removing Plank Bridge

Post by octalot »

Helmet wrote: December 2nd, 2020, 4:01 pm
octalot wrote: December 2nd, 2020, 3:45 pm Does [whichever WML tag is making these units arrive] have a check_passability attribute?
I checked the Wiki, and I think the answer is no. Unless I missed it.
I forgot the [unit] tag, for which that attribute is inconsistently named. Please try placement=map with passable=yes.
User avatar
Helmet
Posts: 331
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: impassable overlay removing Plank Bridge

Post by Helmet »

octalot wrote: December 2nd, 2020, 8:37 pm I forgot the [unit] tag, for which that attribute is inconsistently named. Please try placement=map with passable=yes.
Cool! I tested it; it works like a charm. The unit will land on a nearby available hex.

The Wiki says: "placement: How the unit should be placed: can be one value or a comma-separated list of values."

Does that mean I could make a short list of x,y locations, and the unit will test them, in order, to find an available hex? That's what I thought, but it doesn't seem to work.

Here's my code. The unit could not occupy (1,5) because another unit was there, so I wanted the unit to try (7,7) next, which was unoccupied. But it didn't work. The unit went to a hex near (1,5) instead.

Code: Select all

x=1,7
y=5,7
placement=map
passable=yes
User avatar
octalot
Developer
Posts: 548
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: impassable overlay removing Plank Bridge

Post by octalot »

The comma-separated bit means it can do a fallback like this placement=map,leader. I haven't tested that, so probably worth noting that it's only used in LoW and there's no unit-test checking that it hasn't become buggy...
Post Reply