animated teleport in/out of recall list

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: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

animated teleport in/out of recall list

Post by Helmet »

Hi. I created a Silver Mage on the recall list.

I'd like him to appear in a village (32,4) and display the fancy teleport animation when he arrives. And when he's done delivering his message, I'd like him to teleport away with the fancy teleport animation.

Evidently I'm not using the teleport macros correctly. How do you do this thing? Thanks.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Celtic_Minstrel
Developer
Posts: 2371
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: animated teleport in/out of recall list

Post by Celtic_Minstrel »

It's not too hard to do this with [animate_unit]. Teleporting in would be flag=post_teleport, and teleporting out would be flag=pre_teleport.

As I recall, the teleport macros are built for teleporting from one location to another, so they don't really apply in this case.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: animated teleport in/out of recall list

Post by Helmet »

Celtic_Minstrel wrote: December 30th, 2022, 5:03 am It's not too hard to do this with [animate_unit]. Teleporting in would be flag=post_teleport, and teleporting out would be flag=pre_teleport.

As I recall, the teleport macros are built for teleporting from one location to another, so they don't really apply in this case.
Thanks. I got it halfway working.

Teleporting away works great:

Code: Select all

    [animate_unit]
        [filter]
            x,y=32,4
        [/filter]
        flag=pre_teleport
    [/animate_unit]
    [put_to_recall_list]
        id=Byrin
    [/put_to_recall_list]
Arriving with the cool teleportation animation doesn't work correctly. The unit arrives in the village via recall, then disappears for a split second and arrives with the teleportation animation. So he's arriving twice. I need to get rid of the first arrival somehow.

Code: Select all

    [recall]
        id=Byrin
        x,y=32,4
    [/recall]
    [animate_unit]
        [filter]
            x,y=32,4
        [/filter]
        flag=post_teleport
    [/animate_unit]
I suppose I could place the unit elsewhere on the map, and then have him teleport to the village normally, except he can't already be on the map, for story purposes.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: animated teleport in/out of recall list

Post by Helmet »

I found a work-around to make the Silver Mage appear in a village with his teleport animation.

Instead of creating the Silver Mage into a recall list, I put him in a distant corner of the map, and therefore not visible. With the map focused on the side 1 Leader, I used [lock_view] to prevent scrolling, then I had the Silver Mage teleport into the village near the side 1 Leader. After his arrival, I used [unlock_view] to allow scrolling.

The only downside is that I can see his tiny color square in the mini-map. But it works; his cool teleport animation displays.

If there is a more direct way to accomplish the same thing, please let me know.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Celtic_Minstrel
Developer
Posts: 2371
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: animated teleport in/out of recall list

Post by Celtic_Minstrel »

Helmet wrote: December 30th, 2022, 5:38 am Arriving with the cool teleportation animation doesn't work correctly. The unit arrives in the village via recall, then disappears for a split second and arrives with the teleportation animation. So he's arriving twice. I need to get rid of the first arrival somehow.

Code: Select all

    [recall]
        id=Byrin
        x,y=32,4
    [/recall]
    [animate_unit]
        [filter]
            x,y=32,4
        [/filter]
        flag=post_teleport
    [/animate_unit]
Hmm. This is pretty much identical to what I do in Black Cross of Aleron, except that the unit is placed with [unit] rather than [recall]. Does it maybe work if you change the tag? If it does, then that suggests a bug in [recall]; if it still doesn't work it suggests a more general bug.

(Note: I believe the [unit] tag does actually recall a unit if there's a matching ID in the recall list. It differs from [recall] in what happens when there isn't a matching unit.)
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: animated teleport in/out of recall list

Post by Helmet »

Celtic_Minstrel wrote: December 30th, 2022, 3:25 pmDoes it maybe work if you change the tag? If it does, then that suggests a bug in [recall]; if it still doesn't work it suggests a more general bug.
I changed the tag like you said, so the Silver Mage is created directly at the village via the [unit] tag.

The Silver Mage appears for maybe 1/100th of a second and disappears, then appears properly via teleportation.

Ideally, he shouldn't blink in and out.

Here's the code. It appears in a [start] event (v1.17).

Code: Select all

    [unit]
        side=1
        type=Silver Mage
        x,y=32,4 #                                  village
        id=Byrin
        name="Byrin"
        gender=male
        facing=se
        random_traits=no
        upkeep=0
        [movement_costs]
            shallow_water=9	
        [/movement_costs]
    [/unit]
    [animate_unit]
        [filter]
            x,y=32,4
        [/filter]
        flag=post_teleport
    [/animate_unit]
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Straff
Posts: 124
Joined: September 27th, 2020, 2:53 pm

Re: animated teleport in/out of recall list

Post by Straff »

What will happen if you add hidden=yes and than [unhide_unit] ?

As a workaround.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: animated teleport in/out of recall list

Post by Helmet »

Straff wrote: December 30th, 2022, 6:08 pm What will happen if you add hidden=yes and than [unhide_unit] ?

As a workaround.
Thanks. I tried [hide_unit] yesterday. The unit would unhide for a fraction of a second, then vanish, then reappear via the teleport animation.

I wonder how many people would notice that the unit blinked in-and-out?

It's not really a big deal. But I always see it and it bugs me. It ruins the awesome teleport animation, imo.

I don't think you are supposed to use hidden=yes. It's just for the game engine?
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: animated teleport in/out of recall list

Post by Toranks »

Probably if you use [hide_unit] that millisecond is the one it takes to hide with the command. But if you start with hidden=yes directly (as a property of the unit, put it on [unit] tag), the unit should already appear invisible, without that blink.
User avatar
Celtic_Minstrel
Developer
Posts: 2371
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: animated teleport in/out of recall list

Post by Celtic_Minstrel »

Helmet wrote: December 30th, 2022, 6:47 pm I don't think you are supposed to use hidden=yes. It's just for the game engine?
You're not supposed to, but it seems like a reasonable thing to try as a workaround for what appears to be a bug.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: animated teleport in/out of recall list

Post by Helmet »

Celtic_Minstrel wrote: December 31st, 2022, 6:44 am You're not supposed to, but it seems like a reasonable thing to try as a workaround for what appears to be a bug.
Okay, I tried it. Same result: the unit appears for 1/100th of a second, disappears, and then arrives in the cool teleport animation.

In my opinion, the code is doing what it's supposed to do. The mage is placed onto the map while hidden. The mage is revealed via [unhide]. Then, after all that, the teleport stuff happens. Those 3 things are happening in the order they appear in the code, one at a time.

Unless flag=post_teleport is supposed to have the power to somehow delay [unhide] until the animation starts?

Code: Select all

    [unit]
        side=1
        type=Silver Mage
        x,y=32,4 #                                  village
        id=Byrin
        name="Byrin"
        gender=male
        facing=se
        random_traits=no
        upkeep=0
        [movement_costs]
            shallow_water=9	
        [/movement_costs]
        hidden=yes
    [/unit]
    [unhide_unit]
        id=Byrin
    [/unhide_unit]
    [animate_unit]
        [filter]
            x,y=32,4
        [/filter]
        flag=post_teleport
    [/animate_unit]
Know what would be nifty? Adding a new [unit] key called arrive.

arrive=immediate
arrive=fade-in
arrive=teleport
arrive=recruitment_animation
arrive=turn 5
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Celtic_Minstrel
Developer
Posts: 2371
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: animated teleport in/out of recall list

Post by Celtic_Minstrel »

I suppose unhiding after animating just makes it not animate at all?

EDIT: Also, is this issue new in 1.17 or does it happen in 1.16?
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: animated teleport in/out of recall list

Post by Helmet »

Celtic_Minstrel wrote: January 1st, 2023, 1:59 am I suppose unhiding after animating just makes it not animate at all?
Correct. I just tested. The unit appeared. No teleport animation.
Celtic_Minstrel wrote: January 1st, 2023, 1:59 am EDIT: Also, is this issue new in 1.17 or does it happen in 1.16?
Same thing happens in 1.16.

I tested it around 20+ times, and it seemed to work 4-ish times in 1.16...but I may've simply failed to see the unit blinking in and out. Blinking happens quickly. But it definitely did not work all the other times.

Code: Select all

    [unit]
        side=1
        type=Silver Mage
        x,y=6,4
        id=Byrin
        name="Byrin"
        gender=male
        facing=se
        random_traits=no
        upkeep=0
        [movement_costs]
            shallow_water=9	
        [/movement_costs]
    [/unit]
    [animate_unit]
        [filter]
            x,y=6,4
        [/filter]
        flag=post_teleport
    [/animate_unit]
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Spannerbag
Posts: 759
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: animated teleport in/out of recall list

Post by Spannerbag »

Hi Helmet,

EDIT: Just tried this, seems to display the same behaviour, the unit appears *then* does the anim. :(

EDIT 2: Tried again with the CORRECT animation and it seems to work OK, the unittype below works for me with the following code:

Code: Select all

# Turn 1
# Create + put to recall
  [event]
    name=turn 1
    {DEBUG_MSG (_"Creating Silver Mage_rt")}
    {GENERIC_UNIT 1 (Silver Mage_rt) 4 4}
    {DEBUG_MSG (_"put to recall")}
    [put_to_recall_list]
      x,y=4,4
    [/put_to_recall_list]
  [/event]

# Turn 2
# Test recall
  [event]
    name=turn 2
    {DEBUG_MSG (_"recalling Silver Mage_rt")}
    [recall]
      type=Silver Mage_rt
      x,y=4,4
    [/recall]
  [/event]

x,y=4,4 is a village btw.

this is an 'orrible hack and I haven't tried it, but it might work (the wiki says recruit_anim works for recall so fingers crossed...)

Basically create a Silver Mage unittype with recruit_anim = teleport in anim

As I say I haven't tried this but here's a starting point:

Code: Select all

[unit_type]
    id=Silver Mage_rt
    [base_unit]
        id=Silver Mage
    [/base_unit]
    [recruit_anim]
    start_time=-1200

    teleport_sparkle_1_start_time=-1200
    teleport_sparkle_2_start_time=-1000
    teleport_sparkle_3_start_time=-800

    [teleport_sparkle_1_frame]
        duration=800
        halo=halo/teleport-[9,8,1~9].png
        halo_x=10
        halo_y=-30~30
    [/teleport_sparkle_1_frame]
    [teleport_sparkle_2_frame]
        duration=800
        halo=halo/teleport-[9,8,1~9].png
        halo_x=0
        halo_y=-40~40
    [/teleport_sparkle_2_frame]
    [teleport_sparkle_3_frame]
        duration=800
        halo=halo/teleport-[9,8,1~9].png
        halo_x=-10
        halo_y=-30~30
    [/teleport_sparkle_3_frame]
    [frame]
        duration=200
        image="misc/blank-hex.png"
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-9.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-8.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-7.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-6.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-5.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-4.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-3.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-2.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-1.png)
    [/frame]
    [frame]
        duration=100
        image_mod=~MASK(masks/teleport-mask-0.png)
    [/frame]
    [/recruit_anim]
[/unit_type]
You'd then need to create your Silver Mage with type=Silver Mage_rt (or whatever you want to call it).
Hopefully I cut and pasted the correct chunk of WML into recruit_anim.
The whenever the unit is recalled it should animate as you need it to... maybe, this is spannebag code so all bets are off!
:doh:

Hope it helps.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Celtic_Minstrel
Developer
Posts: 2371
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: animated teleport in/out of recall list

Post by Celtic_Minstrel »

That really is an ugly workaround…
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply