Questions about terrain vision_alias.

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.
Post Reply
User avatar
IIIO_METAL
Posts: 202
Joined: January 18th, 2017, 5:03 pm
Location: japan

Questions about terrain vision_alias.

Post by IIIO_METAL »

The Terrain reference says that vision_alias doesn't work. Is there an alternative way to add this effect to the terrain?
I want to create a terrain that can't walk but doesn't block view.
Creator of "Mountain Witch" & "Castle of evil spirit"
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2340
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: Questions about terrain vision_alias.

Post by Lord-Knightmare »

I want to create a terrain that can't walk but doesn't block view.
May I suggest using [terrain_defaults][/terrain_defaults] for your new terrain to add vision costs for specific movement types or have it copy the vision costs of an existing terrain?
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
IIIO_METAL
Posts: 202
Joined: January 18th, 2017, 5:03 pm
Location: japan

Re: Questions about terrain vision_alias.

Post by IIIO_METAL »

That method seems worth trying. However, there are some uncertainties. It says that [terrain_defaults] is also broken, so this tag may be removed in the future as well.
Creator of "Mountain Witch" & "Castle of evil spirit"
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2340
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: Questions about terrain vision_alias.

Post by Lord-Knightmare »

It says that [terrain_defaults] is also broken, so this tag may be removed in the future as well.
It was fixed in 1.15.9 as far as I know. I use [resistance_defaults] a lot but have yet to try [terrain_defaults] though.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Questions about terrain vision_alias.

Post by octalot »

[terrain_defaults] only works for base terrains. Even if you set values for a mixed terrain, the calculations of mixed terrains' values decompose the mixed terrain to its base terrains before calculating the result, thus ignoring any patched values for mixed terrains. The tag can do it (with the 1.15.9 fix), but still needs a new base terrain.

A few scenario-specific workarounds that also work on 1.14:

Put a petrified unit on the hex, as in the MP maps Thousand Stings Garrison and Caves of the Basilisk.

THoT S12 gives the player's units vision through impassible:

Code: Select all

    [event]
        name=unit placed
        first_time_only=no
        [filter]
            side=1
        [/filter]

        [object]
            silent=yes
            [filter]
                x,y=$x1,$y1
            [/filter]
            [effect]
                apply_to=vision_costs
                replace=yes
                [vision_costs]
                    impassable=3
                [/vision_costs]
            [/effect]
        [/object]
    [/event]
Use a [tunnel] that allows vision, but put a guardian enemy on the tunnel's exit hex. This is done in SXC Pursuit, where a door allows enemies out (done with a separate [tunnel]), but doesn't allow the players in. When a player goes round the long way and kills the guards, a die event opens the door and removes all the tunnels.

Code: Select all

  [event]
    name=start
    # The dwarves' door blocks vision, which is bad when an ulf could teleport
    # through it. This tunnel provides vision for everyone, but the target hex
    # is occupied by the dwarvish guards, so no-one can travel through it.
    [tunnel]
      id=dwarven_south_west_door_vision
      bidirectional=no
      pass_allied_units=no
      [filter][/filter]
      [source]
        x,y=4,24
      [/source]
      [target]
        x,y=6,22
      [/target]
    [/tunnel]
  [/event]
User avatar
IIIO_METAL
Posts: 202
Joined: January 18th, 2017, 5:03 pm
Location: japan

Re: Questions about terrain vision_alias.

Post by IIIO_METAL »

Wow! Thanks for the nice solution. :D
Using [vision_costs] fits my purpose. I'm happy to find a solution.
Creator of "Mountain Witch" & "Castle of evil spirit"
Post Reply