Teleport

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
Wecth
Posts: 13
Joined: April 14th, 2023, 9:07 am

Teleport

Post by Wecth »

So I made a custom teleport ability that can allow units to teleport next to units with a location ability, however it seems that units can teleport next to enemy units with location ability. How do I add a requirement that units can only teleport next to friendly units

Code: Select all

#define ABILITY_TELEPORT
    [teleport]
        id=teleportloc
#      name= _ "Teleport"
#      description= _ ""
        [tunnel]
            id=tunnel
            [source]
            [/source]

            [target]
                [filter_adjacent_location]
                    [filter]
                        is_enemy=no
	                ability=location
                    [/filter]
                [/filter_adjacent_location]
            [/target]

            [filter]
                ability=teleportloc
            [/filter]
        [/tunnel]
    [/teleport]
#enddef

Code: Select all

#define ABILITY_LOCATION
    [teleport]
        id=location
#      name= _ "Teleport Location"
#      description= _ "Allows Teleport units to teleport next to it"
        [tunnel]
            id=tunnel
            [source]
            [/source]

            [target]
                [filter_adjacent_location]
                    [filter]
                        is_enemy=no
			ability=location			
                    [/filter]
                [/filter_adjacent_location]
            [/target]

            [filter]
                ability=location
            [/filter]
        [/tunnel]
    [/teleport]
#enddef
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: Teleport

Post by Toranks »

The correct syntax should be:

Code: Select all

[target]
    [filter]
        [filter_adjacent]
            is_enemy=no
            ability=location
If I understand correctly, the target hex must have an adjacent non-enemy unit with the location ability.
Post Reply