Ephraim's WML questions

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.

Ephraim's WML questions

Postby Ephraim » October 15th, 2017, 9:46 pm

Hello!

I was working on a map with some magic tiles that teleport you to a nother place (just a moveto with teleport unit and a lightning sound). But, I was thinking so hard and I realized that if I add an animation to this magic event, it will be better.

The idea is: when a unit enters in the hex, an animation of a lightbeam and an animation of the light star (the one that appears when you teleport a silver mage) will appear at the same time. When the animation finishes, there will sound a lightning and the unit will be teleported.

How can I code the animations?

Thanks.
The Great Library of WML is huge and extense. I must find the book who will lead me to create a perfect campaign.
Future Project: History of Vindalf
User avatar
Ephraim
 
Posts: 37
Joined: July 3rd, 2017, 2:03 pm
Location: The Great Library of WML, Studiying it

Re: Ephraim's WML questions

Postby Dugi » October 16th, 2017, 1:26 pm

The teleport animation uses a mask and does not need to depend on the unit's sprite, so it's quite doable.

You can use an object (possibly a temporary one) to add the teleport animation to the unit. Then you active the pre-teleport animation with animate_unit, use the teleport action tag to move it to the other location and then use the post-teleport animation to make it land there. You can add the lightbeam to the teleport animation as well.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4766
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Ephraim's WML questions

Postby Ephraim » October 21st, 2017, 2:10 pm

I have been working on that, and I've got this:

Code: Select all
[event]
name=start
[object]
    [filter]
       canrecruit=no
   [/filter]
   {TELEPORT_EFFECT_OBJECT}
[/object]
[/event]


[event]


name=moveto
first_time_only=no
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
[sound]
name=lightning.ogg
[/sound]
[animate_unit]
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
flag=pre_teleport
[animate]
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
{MISSILE_FRAME_LIGHT_BEAM}
[/animate]
[/animate_unit]
{TELEPORT_TILE 49 51 38 56}
[scroll_to]
x=38
y=56
[/scroll_to]
[animate_unit]
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
flag=post_teleport
[/animate_unit]
[/event]


But it doesn't work. What can I do?
The Great Library of WML is huge and extense. I must find the book who will lead me to create a perfect campaign.
Future Project: History of Vindalf
User avatar
Ephraim
 
Posts: 37
Joined: July 3rd, 2017, 2:03 pm
Location: The Great Library of WML, Studiying it

Re: Ephraim's WML questions

Postby James_The_Invisible » October 21st, 2017, 3:01 pm

[object] is applied only to first unit that matches the filter, no all those units. If you want to apply it to more units, you should store them to a variable and loop over it ({FOREACH ...} ... {NEXT ...}).
My content: For Power series
Ports: Danse Macabre Story of the Wose
Royal Guard/Silver Mage
User avatar
James_The_Invisible
 
Posts: 410
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

Re: Ephraim's WML questions

Postby Ephraim » October 21st, 2017, 4:14 pm

James_The_Invisible wrote:[object] is applied only to first unit that matches the filter, no all those units. If you want to apply it to more units, you should store them to a variable and loop over it ({FOREACH ...} ... {NEXT ...}).


I have changed the code for work in just one unit, but it still doesn't work:

Code: Select all
[event]
name=start
[object]
    [filter]
      [filter_location]
             x,y=4, 2
      [/filter_location]
   [/filter]
   {TELEPORT_EFFECT_OBJECT}
[/object]
[/event]


[event]


name=moveto
first_time_only=no
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
[sound]
name=lightning.ogg
[/sound]
[animate_unit]
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
flag=pre_teleport
[animate]
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
{MISSILE_FRAME_LIGHT_BEAM}
[/animate]
[/animate_unit]
{TELEPORT_TILE 49 51 38 56}
[scroll_to]
x=38
y=56
[/scroll_to]
[animate_unit]
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
flag=post_teleport
[/animate_unit]
[/event]


The location is the starting location of the unit, because it is the leader of the side but he can't recruit.
The Great Library of WML is huge and extense. I must find the book who will lead me to create a perfect campaign.
Future Project: History of Vindalf
User avatar
Ephraim
 
Posts: 37
Joined: July 3rd, 2017, 2:03 pm
Location: The Great Library of WML, Studiying it

Re: Ephraim's WML questions

Postby enclave » October 21st, 2017, 4:23 pm

try
[filter]
x,y=4,2
[/filter]
without location.. and dont make spaces before numbers.. not sure if it matters, but it may..
I'm not expert about objects :) so no idea if it can help.
enclave
 
Posts: 533
Joined: December 15th, 2007, 8:52 am

Re: Ephraim's WML questions

Postby James_The_Invisible » October 21st, 2017, 4:26 pm

Have you actually seen the definition of macro TELEPORT_EFFECT_OBJECT? It is:
Code: Select all
#define TELEPORT_EFFECT_OBJECT
    # Creates and assigns a temporary object which applies the generalized silver mage
    # teleport animations to the primary unit
    #
    # For example, to apply teleport animations to the unit that triggered a 'move_to' event:
    #!{TELEPORT_EFFECT_OBJECT}

    [object]
        silent=yes
        duration=turn

        [effect]
            apply_to=new_animation

            [animation]
                apply_to=pre_teleport
                {TELEPORT_OUT_ANIMATION}
            [/animation]

            [animation]
                apply_to=post_teleport
                {TELEPORT_IN_ANIMATION}
            [/animation]
        [/effect]
    [/object]
#enddef

. That inserts [object] which is added to primary unit in an event. So it might be a good idea to remove the additional [object] tag and use the macro in your moveto event.
My content: For Power series
Ports: Danse Macabre Story of the Wose
Royal Guard/Silver Mage
User avatar
James_The_Invisible
 
Posts: 410
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces

Re: Ephraim's WML questions

Postby Ephraim » October 21st, 2017, 4:48 pm

James_The_Invisible wrote:Have you actually seen the definition of macro TELEPORT_EFFECT_OBJECT? It is:
Code: Select all
#define TELEPORT_EFFECT_OBJECT
    # Creates and assigns a temporary object which applies the generalized silver mage
    # teleport animations to the primary unit
    #
    # For example, to apply teleport animations to the unit that triggered a 'move_to' event:
    #!{TELEPORT_EFFECT_OBJECT}

    [object]
        silent=yes
        duration=turn

        [effect]
            apply_to=new_animation

            [animation]
                apply_to=pre_teleport
                {TELEPORT_OUT_ANIMATION}
            [/animation]

            [animation]
                apply_to=post_teleport
                {TELEPORT_IN_ANIMATION}
            [/animation]
        [/effect]
    [/object]
#enddef

. That inserts [object] which is added to primary unit in an event. So it might be a good idea to remove the additional [object] tag and use the macro in your moveto event.


Ok, it worked! Thank you! And how can I add a lightbeam that falls over the tile that triggers the moveto (at the same time that the pre_teleport frame)? (49,51)

Code: Select all
[event]


name=moveto
first_time_only=no
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
[sound]
name=lightning.ogg
[/sound]
{TELEPORT_EFFECT_OBJECT}
[animate_unit]
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
flag=pre_teleport
[/animate_unit]
{TELEPORT_TILE 49 51 38 56}
[scroll_to]
x=38
y=56
[/scroll_to]
[animate_unit]
[filter]
[filter_location]
x,y=49,51
[/filter_location]
[/filter]
flag=post_teleport
[/animate_unit]
[/event]
The Great Library of WML is huge and extense. I must find the book who will lead me to create a perfect campaign.
Future Project: History of Vindalf
User avatar
Ephraim
 
Posts: 37
Joined: July 3rd, 2017, 2:03 pm
Location: The Great Library of WML, Studiying it

Re: Ephraim's WML questions

Postby Dugi » October 21st, 2017, 7:19 pm

Add the lightbeam frame sequence to the animation in the object. See how it's done in core/macros, in one of the files about animations.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4766
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Ephraim's WML questions

Postby Ephraim » October 21st, 2017, 9:53 pm

Yes, now it works! Thank you!
The Great Library of WML is huge and extense. I must find the book who will lead me to create a perfect campaign.
Future Project: History of Vindalf
User avatar
Ephraim
 
Posts: 37
Joined: July 3rd, 2017, 2:03 pm
Location: The Great Library of WML, Studiying it

Re: Ephraim's WML questions

Postby Ephraim » October 22nd, 2017, 1:17 pm

Hello again! I'm going on with the lightbeam and I want to change its color: from white to green, red, blue and brown. How can I code that without using an image editor program?
The Great Library of WML is huge and extense. I must find the book who will lead me to create a perfect campaign.
Future Project: History of Vindalf
User avatar
Ephraim
 
Posts: 37
Joined: July 3rd, 2017, 2:03 pm
Location: The Great Library of WML, Studiying it

Re: Ephraim's WML questions

Postby Pentarctagon » October 22nd, 2017, 3:58 pm

ImagePathFunctionWML - I would guess BLEND().
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Pentarctagon
Forum Administrator
 
Posts: 2945
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)


Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 1 guest