ForestDragon'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.
- ForestDragon
- Posts: 1785
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
please be specific about what exact variable it isRavana wrote:I noticed you call for variable name you do not assign.
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
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
this_leader
Re: ForestDragon's WML questions
You have a [store_unit] in your [set_menu_item].
- ForestDragon
- Posts: 1785
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
oh, thanks!
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
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
I guess I cant expect more from you.
formula= is part of standard unit filter not filter_wml.
formula= is part of standard unit filter not filter_wml.
- ForestDragon
- Posts: 1785
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
well, slightly better, but, the ability triggers no matter how much hp the unit has
Code: Select all
#define ABILITY_DESPERATE VALUE
# Canned definition of the Desperate ability to be included in an
# [abilities] clause.
[leadership]
id=desperate
value={VALUE}
cumulative=no
name= _ "desperate ({VALUE}%)"
female_name= _ "female^desperate ({VALUE}%)"
description= _ "This unit's attacks do {VALUE}% more damage when it's health is below 50%."
affect_self=yes
affect_allies=no
affect_enemies=no
[filter_self]
[filter]
formula="(($this_unit.max_hitpoints -1+1) / ($this_unit.hitpoints -1+1)) > 2"
[/filter]
[/filter_self]
[/leadership]
#enddef
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
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
You have stuff in your [filter_self] that shouldn't be there. When you have a problem with one single tag then you could first check whether you're using it right.
- ForestDragon
- Posts: 1785
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
can you please be more specific?zookeeper wrote:You have stuff in your [filter_self] that shouldn't be there. When you have a problem with one single tag then you could first check whether you're using it right.
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
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
The extra [filter] tag. When the wiki says that you can put a StandardUnitFilter somewhere, then it means you can put the stuff listed on the StandardUnitFilter page there. If you need to wrap said StandardUnitFilter stuff in a [filter] tag, then the wiki will say so.ForestDragon wrote:can you please be more specific?
- ForestDragon
- Posts: 1785
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
well, the thing is, when i put the additional [filter], the ability triggers no matter how much hp the unit has, but if i remove the filter, the ability doesn't trigger at allzookeeper wrote:The extra [filter] tag. When the wiki says that you can put a StandardUnitFilter somewhere, then it means you can put the stuff listed on the StandardUnitFilter page there. If you need to wrap said StandardUnitFilter stuff in a [filter] tag, then the wiki will say so.ForestDragon wrote:can you please be more specific?
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
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
- ForestDragon
- Posts: 1785
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
hello everyone! well, i got another filter issue: i want the [store_unit]'s filter not store units who have at least 2 enemies adjacent to them, but I have done something wrong with the filter, not quite sure what though
Code: Select all
[option]
message= {MENU_IMG_TXT "items/holy-water.png~BLIT(halo/elven/shaman-heal-halo-4.png)" "Deposit All"}
[command]
[store_unit]
[filter]
side=$side_number
[not]
[filter_adjacent]
[filter_side]
[enemy_of]
side=$side_number
[/enemy_of]
[/filter_side]
count=2-6
[/filter_adjacent]
[/not]
[/filter]
variable=exp_drained_unit
[/store_unit]
{FOREACH exp_drained_unit i}
[set_variable]
name=exp_stored_[$side_number]
add="$exp_drained_unit[$i].experience"
[/set_variable]
{VARIABLE exp_drained_unit[$i].experience 0}
[unstore_unit]
variable=exp_drained_unit[$i]
find_vacant=no
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE exp_drained_unit}
[/command]
[/option]
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
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: ForestDragon's WML questions
Looks correct to me.
- beetlenaut
- Developer
- Posts: 2832
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ForestDragon's WML questions
Since [filter] is not allowed here, everything inside it is ignored when you use it. When you take it out, the formula is evaluated, but it must not equal what you think it does. I have never used formula, but from the wiki, it looks like you should be using the variable "self" instead of "$this_unit".ForestDragon wrote:well, the thing is, when i put the additional [filter], the ability triggers no matter how much hp the unit has, but if i remove the filter, the ability doesn't trigger at all
Maybe the filter is not the problem. You should always try your code without CLEAR_VARIABLE the first time so you can use :inspect to see what your variables actually equal--in this case, what units did get stored, if any. You may have a problem because you are treating your variable as an array, but it might not be one.ForestDragon wrote:I have done something wrong with the filter, not quite sure what though
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: ForestDragon's WML questions
Oh, yeah, this is definitely a case where you're trying to treat a container as a variable:
Code: Select all
[set_variable]
name=exp_stored_[$side_number]
add="$exp_drained_unit[$i].experience"
[/set_variable]
- ForestDragon
- Posts: 1785
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
well, sorry for not understanding, but what exactly should i fix?zookeeper wrote:Oh, yeah, this is definitely a case where you're trying to treat a container as a variable:
Code: Select all
[set_variable] name=exp_stored_[$side_number] add="$exp_drained_unit[$i].experience" [/set_variable]
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
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic