ForestDragon'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.
Post Reply
User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 1st, 2016, 5:00 pm

zookeeper wrote:That cannot work. There's no [unit] tag to filter for in a unit any more than there is a [unit_type] tag.
i tested, it worked
EDIT: oh, well, it didn't. i guess i could do like this: $storedunit.undead_variation maybe?
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
skeptical_troll
Posts: 413
Joined: August 31st, 2015, 11:06 pm

Re: ForestDragon's WML questions

Post by skeptical_troll » August 1st, 2016, 5:24 pm

I think what you need is simply

Code: Select all

[filter]
[filter_wml]
 undead_variation="mounted"
[/filter_wml]
[/filter]
i.e. inside the 'filter wml' tag you should put exactly what you expect to find inside the unit description with inspect

User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 1st, 2016, 5:28 pm

skeptical_troll wrote:I think what you need is simply

Code: Select all

[filter]
[filter_wml]
 undead_variation="mounted"
[/filter_wml]
[/filter]
i.e. inside the 'filter wml' tag you should put exactly what you expect to find inside the unit description with inspect
oh, ok, thanks, i'll try it that way
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 3rd, 2016, 2:45 pm

hi, i am having problems with making an ability like illuminates, that affects only enemies, i tried so far, but i doesn't work:

Code: Select all

    [illuminates]
        id=illumination_enemy
        value=25
        max_value=25
        cumulative=no
        name= _ "illuminates (enemies only)"
        female_name= _ "female^illuminates (enemies only)"
        description= _ "This unit illuminates the surrounding area, making enemy chaotic units fight worse.

Any units adjacent to this enemies will fight as if it were dusk when it is night, and as if it were day when it is dusk."
        affect_self=yes
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
        [/affect_adjacent]
    [/illuminates]
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
Ravana
Moderator
Posts: 1874
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana » August 3rd, 2016, 2:49 pm

affect_self=yes
How would self be enemy?

User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 3rd, 2016, 2:53 pm

Ravana wrote:
affect_self=yes
How would self be enemy?
ooops, thanks for helping me notice
i guess this will do?:

Code: Select all

    [illuminates]
        id=illumination_enemy
        value=25
        max_value=25
        cumulative=no
        name= _ "illuminates (enemies only)"
        female_name= _ "female^illuminates (enemies only)"
        description= _ "This unit illuminates the surrounding area, making enemy chaotic units fight worse.

Any units adjacent to this enemies will fight as if it were dusk when it is night, and as if it were day when it is dusk."
        affect_self=no
        affect_allies=no
        affect_enemies=yes
        [affect_adjacent]
            adjacent=n,ne,se,s,sw,nw
        [/affect_adjacent]
    [/illuminates]
Last edited by ForestDragon on August 3rd, 2016, 2:54 pm, edited 1 time in total.
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
beetlenaut
Developer
Posts: 2239
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: ForestDragon's WML questions

Post by beetlenaut » August 3rd, 2016, 2:54 pm

You also don't filter for the enemy anywhere.

Edit: Okay, now you do. That should work.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 3rd, 2016, 2:58 pm

works now, thanks! ^_^ you guys are very helpful unlike some communities where the only thing moderators/admins really do is banning :whistle:
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 6th, 2016, 12:02 pm

hi, so, i am having trouble with having an ability use a [set_menu_item] tag in an event, her is how i done it:

Code: Select all

#define ABILITY_AVIAN_FLIGHT
[dummy]
	id=Avian_Flight
	name= _"flight"
	description = _"This unit can fly. Open the right-click menu to activate flight."
[/dummy]
[/abilities]
#fly menu item
[event]
	name=start
    first_time_only=no
	[set_menu_item]
		id=Avian_Flight
		description = _"Take off"
		[filter_location]
			[filter]
				ability=Avian_Flight
				[filter_wml]
					[not]
						moves=0
					[/not]
				[/filter_wml]
				side=$side_number
			[/filter]
		[/filter_location]
		#[default_hotkey] ###soon
			#key = v
		#[/default_hotkey]
		[command]
			[animate_unit]
				flag=flying
			[/animate_unit]
			[store_unit]
				[filter]
					x,y=$x1,$y1
				[/filter]
				variable=unit_to_fly
			[/store_unit]
			[modify_unit]
				[filter]
					x,y=$x1,$y1
				[/filter]
				variation=flying
			[/modify_unit]
			[modify_unit]
				[filter]
					x,y=$x1,$y1
				[/filter]
				moves=$($this_unit.moves - 1)
			[/modify_unit]
		[/command]
	[/set_menu_item]
[/event]
[+abilities]
#enddef

#define ABILITY_AVIAN_LAND
[dummy]
	id=Avian_Land
	name= _"land"
	description = _"This unit can land. Open the right-click menu to land."
[/dummy]
[/abilities]
#land menu item
[event]
	name=start
    first_time_only=no
	[set_menu_item]
		id=Avian_Land
		description = _"Land"
		[filter_location]
			[filter]
				ability=Avian_Land
				side=$side_number
			[/filter]
		[/filter_location]
		[command]
			[animate_unit]
				flag=landing
			[/animate_unit]
			[store_unit]
				[filter]
					x,y=$x1,$y1
				[/filter]
				variable=unit_to_land
			[/store_unit]
			[modify_unit]
				[filter]
					x,y=$x1,$y1
				[/filter]
				variation=none
			[/modify_unit]
		[/command]
	[/set_menu_item]
[/event]
[+abilities]
#enddef
the [dummy] ability tag is working, but not the event/set_menu_item tag
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
skeptical_troll
Posts: 413
Joined: August 31st, 2015, 11:06 pm

Re: ForestDragon's WML questions

Post by skeptical_troll » August 6th, 2016, 12:18 pm

Not sure if this is your case, but if this [event] tag is inside a [unit] description, then it is mandatory to specify the event 'id' keyword

User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 6th, 2016, 12:30 pm

skeptical_troll wrote:Not sure if this is your case, but if this [event] tag is inside a [unit] description, then it is mandatory to specify the event 'id' keyword
hmmm... never tried that, might try, thanks

EDIT:still not working :annoyed:
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
skeptical_troll
Posts: 413
Joined: August 31st, 2015, 11:06 pm

Re: ForestDragon's WML questions

Post by skeptical_troll » August 6th, 2016, 12:52 pm

hmm, could it be due to the fact that it is triggered by'start' and maybe at the start you don't have units with that ability? Try triggering it at 'recall' /'recruit', or whenever you expect such units to appear?

User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 6th, 2016, 1:05 pm

skeptical_troll wrote:hmm, could it be due to the fact that it is triggered by'start' and maybe at the start you don't have units with that ability? Try triggering it at 'recall' /'recruit', or whenever you expect such units to appear?
hmmm... that's an interesting idea
EDIT: works now, i used a 'moveto' event name
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
ForestDragon
Forum Regular
Posts: 1494
Joined: March 6th, 2014, 1:32 pm

Re: ForestDragon's WML questions

Post by ForestDragon » August 25th, 2016, 11:55 am

hi, i am making an improved ai, since all of it's unit are chaotic, i wanted to make it work differently during day, so far everything looks fine, but i want to make a filter to make it NOT avoid unit with less than half of their hp, here is the current state of the [avoid] tag inside the ai (the 'hitpoints=' is empty due to the fact that i don't know how to do it):

Code: Select all

    [avoid]
        [filter]
            side=1,2
          [not]
            level=0
            [or]
              [filter_wml]
                  hitpoints=
              [/filter_wml]
            [/or]
          [/not]
        [/filter]
        radius=2
    [/avoid]
Co-creator of Era of Magic
Creator of Tale of Alan (1.12 abandoned),The Golden Age (1.12/1.13, abandoned),XP Bank (1.14),Alliances Mod(1.14), with a large add-on in development
"Real life is like a hyper-realistic VR game, but with permadeath and boring gameplay"

User avatar
Ravana
Moderator
Posts: 1874
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana » August 25th, 2016, 1:33 pm

I would use something like

Code: Select all

formula="(($this_unit.max_hitpoints -1+1) / ($this_unit.hitpoints -1+1)) > 2"

Post Reply