Teleport bug?

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
Efinari
Posts: 103
Joined: January 25th, 2011, 3:07 am
Location: Grakvr Peak, Eastlands

Teleport bug?

Post by Efinari »

Hi, I was wondering if anyone could help me with a problem I've been having.

I want to grant my units the "teleport" ability. I use

Code: Select all

[object]
silent=yes
duration=forever
[effect]
apply_to=new_ability
[abilities]
{ABILITY_TELEPORT}
[/abilities]
[/effect]
[/object]
That grants them the teleport ability, sure, but introduces some bugs which do not exist when the ability is given in the unit's .cfg file. They can no longer teleport from a village they are standing on (they have to get off first); and village owner is completely ignored (they can teleport from an unowned village to an unowned village; presumably also to and from villages owned by other players). I took a peek at the teleport code in abilities.cfg, and I can't understand how it works in the first place--it looks like everything is backwards (as I see it, the code tells it to do exactly what it's doing for me; but should not work properly for the Silver Mage unit).

I'm sorry if this is a bug that was fixed in a later version--I'm running 1.10.0 (yes, I know that's a little out-dated). I don't know why it would be a bug though--the teleport ability has been standard for a good long while.

If this was corrected in a bugfix, could someone tell me? I don't really like reinstalling Wesnoth on a whim. If not, can someone help me get it working properly?

Thanks,
Kallin Efinari
---Creator of "LOTE Unit Release", "7p - Afterwards", and "Chain Lightning"
(Working on 1.12 port of "7p - Afterwards")
Managing compatibility between 4000K people's ideas of what happens? Forget it!
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: Teleport bug?

Post by tekelili »

you need use delayed variable substitution when using TELEPORT macro outside unit_type. One easy way is use an [object] like this:

Code: Select all

    [object]
        silent=yes
        duration=forever
        delayed_variable_substitution=yes 
        [filter]
            x,y=$unit.x,$unit.y
        [/filter]
        [effect]
            apply_to=new_ability
            [abilities]
                {ABILITY_TELEPORT}
            [/abilities]
        [/effect]
    [/object]
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
Efinari
Posts: 103
Joined: January 25th, 2011, 3:07 am
Location: Grakvr Peak, Eastlands

Re: Teleport bug?

Post by Efinari »

Wow! It's amazing how something that simple can make such a difference! :D

It all works perfectly now. Thanks a million!
Kallin Efinari
---Creator of "LOTE Unit Release", "7p - Afterwards", and "Chain Lightning"
(Working on 1.12 port of "7p - Afterwards")
Managing compatibility between 4000K people's ideas of what happens? Forget it!
grrr
Posts: 252
Joined: May 25th, 2007, 9:49 pm

Re: Teleport bug?

Post by grrr »

easy, you forgot the [volcano] tag!
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Teleport bug?

Post by 8680 »

grrr wrote:easy, you forgot the [volcano] tag!
There is no such thing as a [volcano] tag in WML.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: Teleport bug?

Post by tekelili »

8680 wrote:
grrr wrote:easy, you forgot the [volcano] tag!
There is no such thing as a [volcano] tag in WML.
Just for information: grrr had been posting lot of troll coments with no sense at all. Thats why the [volcano] tag... :roll:
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
Post Reply