Ephraim's WML questions
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.
Ephraim's WML questions
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.
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
Future Project: History of Vindalf
Re: Ephraim's WML questions
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.
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.
Re: Ephraim's WML questions
I have been working on that, and I've got this:
But it doesn't work. What can I do?
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]
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
Future Project: History of Vindalf
- James_The_Invisible
- Posts: 534
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: Ephraim's WML questions
[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
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: Ephraim's WML questions
I have changed the code for work in just one unit, but it still doesn't work: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 ...}).
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 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
Future Project: History of Vindalf
Re: Ephraim's WML questions
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.
[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.
- James_The_Invisible
- Posts: 534
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: Ephraim's WML questions
Have you actually seen the definition of macro TELEPORT_EFFECT_OBJECT? It is:
. 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.
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
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: Ephraim's WML questions
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)James_The_Invisible wrote:Have you actually seen the definition of macro TELEPORT_EFFECT_OBJECT? It is:. 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.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
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
Future Project: History of Vindalf
Re: Ephraim's WML questions
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.
Re: Ephraim's WML questions
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
Future Project: History of Vindalf
Re: Ephraim's WML questions
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
Future Project: History of Vindalf
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Ephraim's WML questions
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
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Ephraim's WML questions
Hello!
I wan't to do the following:
The unit enters in a shop. Then, there will be a menu that allows this unit to buy some upgrades, like more damage, more HP, etc. But, each unit can only buy X number of upgrades of each one, for avoid making units invincibles.
So, how can I code that? I'm worried because if I use some variable like "number_hp", this variable will stand there for all the units, but I want that every unit has his own variable, that lasts all the game.
Thanks!
I wan't to do the following:
The unit enters in a shop. Then, there will be a menu that allows this unit to buy some upgrades, like more damage, more HP, etc. But, each unit can only buy X number of upgrades of each one, for avoid making units invincibles.
So, how can I code that? I'm worried because if I use some variable like "number_hp", this variable will stand there for all the units, but I want that every unit has his own variable, that lasts all the game.
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
Future Project: History of Vindalf
Re: Ephraim's WML questions
Within each unit you can store variables to names such as unit.variables.something. And after changing it unstore unit.
Re: Ephraim's WML questions
So, the code shoyld be like:Ravana wrote:Within each unit you can store variables to names such as unit.variables.something. And after changing it unstore unit.
Code: Select all
[option]
label= +8hp
[command]
[modify_unit]
[filter]
x=$x1
y=$y1
[/filter]
max_hitpoints=+8
[/modify_unit]
[set_variable]
name=unit.variables.hp.upgrades
literal=+1
[/set_variable]
[/command]
[/option]
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
Future Project: History of Vindalf