teleport help

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
fuzz579
Posts: 33
Joined: November 29th, 2008, 2:17 am
Location: kitty!

teleport help

Post by fuzz579 »

hi I want to make a custom teleport ability ie:my unit teleports from one deep water tile to another deep water tile that it is not connected to I have this but it doesn't work:

#define ABILITY_WATERPORT
[teleport]
id=waterport
name= _ "waterport"
name_inactive= _ "waterport"
description= _ "waterport"
description_inactive= _ "waterport"
affect_self=yes
[filter_self]
[filter_location]
terrain=Wo
[/filter_location]
[/filter_self]
[/teleport]
#enddef

I am testing it on the grim spawn from war of chaos and this is the section that defines abilitys:

unit_description= _ "A creature spawned to be agile and cunning, the grim spawn is small and physically weak, however it
is able to strike precisely in order to damage and weaken muscles, and is incredibley fast and agile making it a difficult target to
strike."
[abilities]
{ABILITY_SWAMP_KNOWLEDGE}
{ABILITY_WATERPORT}
[/abilities]
{DEFENSE_ANIM "Afflicted/grimspawn-death1.png" "Afflicted/grimspawn.png" sound=hiss-hit.wav }
die_sound=hiss-die.wav
every time my cat meows, something dies.
AI
Inactive Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: teleport help

Post by AI »

That's because [teleport] doesn't have that feature, it's on the "good idea" list though.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Re: teleport help

Post by turin »

What, so does [teleport] actually only work with villages even though the syntax suggests otherwise?
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: teleport help

Post by Ken_Oh »

Yeah, I wasn't able to make teleport work with anything other than vills.
User avatar
fuzz579
Posts: 33
Joined: November 29th, 2008, 2:17 am
Location: kitty!

Re: teleport help

Post by fuzz579 »

well thats lame ill have to do something else. thanks!
every time my cat meows, something dies.
User avatar
fuzz579
Posts: 33
Joined: November 29th, 2008, 2:17 am
Location: kitty!

Re: teleport help

Post by fuzz579 »

hi I realize that this is now an old thread but this is relevant: I was wondering weather or not this issue (no custom teleport) has been fixed/changed in 1.6? thanks for the reply.
every time my cat meows, something dies.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: teleport help

Post by Gambit »

Well the quickest way to find out would be to try it. But no I don't think it has.
User avatar
Horus2
Posts: 407
Joined: September 26th, 2010, 1:05 pm

Re: teleport help

Post by Horus2 »

Necromancy for a reason. Teleporting just keep causing problems...

My problem might be blatantly obvious, but i searched every teleport-related thread and i couldn't find the answer.
I tried to give the ABILITY_TELEPORT to a custom unit and expected to work like on Silver Mage. Instead, custom unit was capable of entering and exiting unoccupied and enemy villages as well. I found this very strange, because Silver Mage uses the same ABILITY_TELEPORT and there's no further filters in its unit file either. Instead, it's definitely in the abilities.cfg:

Code: Select all

...
            [source]
                terrain=*^V*
                owner_side=$teleport_unit.side
                [not]
                    [filter]
                        [not]
                            id=$teleport_unit.id
                        [/not]
                    [/filter]
                [/not]
            [/source]
...
How could that not working on other units? Many thanks.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: teleport help

Post by Anonymissimus »

Make sure to put that code into the [unit_type]. Or use delayed_...=yes if using an [object].
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
Horus2
Posts: 407
Joined: September 26th, 2010, 1:05 pm

Re: teleport help

Post by Horus2 »

Anonymissimus wrote:Make sure to put that code into the [unit_type]. Or use delayed_...=yes if using an [object].
Thank you, that was the key indeed.
User avatar
Limabean
Posts: 369
Joined: August 26th, 2008, 2:14 pm
Location: New Hampshire, USA

Re: teleport help

Post by Limabean »

Another thread necro, also for a decent reason I think.

I'm also having trouble with {ABILITY_TELEPORT}. I am aware that delayed_variable_substitution=yes is required when adding the ability with an object. However, it doesn't seem to be recognized when I use it inside a unit modifications tag as seen below.

Code: Select all

[unit]
type=Ghoul
side=$monster_side
x=$x1
y=$y1
role=guardian
[modifications]
        {TRAIT_LOYAL}

                        [object]
                          silent=yes
                          delayed_variable_substitution=yes
                          [effect]
                            apply_to=new_ability
                            [abilities]
                            {ABILITY_TELEPORT}
                            [/abilities]
                          [/effect]
                        [/object]
[/modifications]
[/unit]
The unit is able to teleport between all villages including enemy and unowned villages. The is especially frustrating because in the very same scenario I add teleport to a different unit using the exact same object code and it works fine. The only difference is that in that case it was applied using a right click menu rather than a unit modification.

Any suggestions?
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: teleport help

Post by trewe »

Limabean wrote:Any suggestions?
Instead (or additionally) of delayed_variable_substitution insert it literally

Code: Select all

[set_variables]
    name=new_ability
    [literal]
        {ABILITY_TELEPORT}
    [/literal]
[/set_variables]

[unit]
    #...
    [modifications]
        [object]
            # blah
            [effect]
                apply_to=new_ability
                [insert_tag]
                    name=abilities
                    variable=new_ability.abilities
                [/insert_tag]
            [/effect]
        [/object]
    [/modifications]
[/unit]
User avatar
Limabean
Posts: 369
Joined: August 26th, 2008, 2:14 pm
Location: New Hampshire, USA

Re: teleport help

Post by Limabean »

trewe wrote: Instead (or additionally) of delayed_variable_substitution insert it literally
Unfortunately no luck. The result is the same.
Post Reply