ForestDragon's WML questions

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
User avatar
ForestDragon
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

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?
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
skeptical_troll
Posts: 500
Joined: August 31st, 2015, 11:06 pm

Re: ForestDragon's WML questions

Post by skeptical_troll »

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
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

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
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
ForestDragon
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

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]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana »

affect_self=yes
How would self be enemy?
User avatar
ForestDragon
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

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.
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: ForestDragon's WML questions

Post by beetlenaut »

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
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

works now, thanks! ^_^ you guys are very helpful unlike some communities where the only thing moderators/admins really do is banning :whistle:
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
ForestDragon
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

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
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
skeptical_troll
Posts: 500
Joined: August 31st, 2015, 11:06 pm

Re: ForestDragon's WML questions

Post by skeptical_troll »

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
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

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:
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
skeptical_troll
Posts: 500
Joined: August 31st, 2015, 11:06 pm

Re: ForestDragon's WML questions

Post by skeptical_troll »

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
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

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
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
ForestDragon
Posts: 1771
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: ForestDragon's WML questions

Post by ForestDragon »

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]
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ForestDragon's WML questions

Post by Ravana »

I would use something like

Code: Select all

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