Two questions regarding animate_unit

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
Marcgal

Two questions regarding animate_unit

Post by Marcgal »

1. How to display the animation used when the unit is recruiting other units as a leader? Liches have such animations, yet https://wiki.wesnoth.org/InterfaceActio ... te_unit.5D doesn’t list an appropriate value of flag for such an animation. I tried flag=recruiting, but this won’t work :(

2. Is there any way to avoid the camera being automatically centered on the animated unit?
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: Two questions regarding animate_unit

Post by The_Gnat »

In answer to your first question, this is the code the ancient lich uses, (in general the best way, rather than using the wiki, is to go into the base games install directory and find an example of the code being used in the mainline game):

Code: Select all

    [recruiting_anim]
        [filter_second]
            race=undead
        [/filter_second]
        start_time=-300
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-[1,2].png:75"
        [/frame]
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-3.png"
            halo=halo/undead/black-magic-[1~5].png:[75*4,50]
        [/frame]
        sound_start_time=-75
        [sound_frame]
            sound=magic-dark-big.ogg
        [/sound_frame]
        [frame]
            image="units/undead-necromancers/ancient-lich-magic-[2,1].png:50"
        [/frame]
        [frame]
            image="units/undead-necromancers/ancient-lich.png:1"
        [/frame]
    [/recruiting_anim]
As for that second question i unfortunately do not know
User avatar
Samonella
Posts: 382
Joined: January 8th, 2016, 5:41 pm
Location: USA

Re: Two questions regarding animate_unit

Post by Samonella »

Marcgal wrote:1. How to display the animation used when the unit is recruiting other units as a leader? Liches have such animations, yet https://wiki.wesnoth.org/InterfaceActio ... te_unit.5D doesn’t list an appropriate value of flag for such an animation. I tried flag=recruiting, but this won’t work :(
I tried the same thing a little while ago, and couldn't figure it out. For liches, their ranged attack animation isn't too different, so maybe you could use it instead?

Also... does [recall] animate the leader? I don't think so, but maybe. If so, maybe you can use it to work around the problem?

EDIT: Or, if you're really desperate, you could use [modify_unit] with an [object] to make a new animation that looks the same as the recruiting one, but which you can use in [animate_unit].
Marcgal wrote:2. Is there any way to avoid the camera being automatically centered on the animated unit?
I assume you want the camera to stay wherever it happened to be before the animation? I don't know any way, but if there was a specific different unit you wanted the camera to center on, here's an untested idea that might work. Since [animate_unit] allows you to use [animate] to do multiple units at once, I assume the camera stays focused on the unit animated by [animate_unit] (the outermost tag). So you could "animate" the unit that the camera should focus on with a standing animation or something that won't actually do anything, and use an [animate] tag to make the animation that you originally wanted.

:lol: As you can see, I don't really know the answers, I'm just brainstorming some hacky work-arounds, like I always do when I get stuck.
The last few months have been nothing but one big, painful reminder that TIMTLTW.

Creator of Armory Mod, The Rising Underworld, and Voyage of a Drake: an RPG
Post Reply