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.
Re: ForestDragon's WML questions
Code: Select all
dependencies=Ageless_Era,XP_Modification,Plan_Your_Advancements_Mod,Switch_Leader,Color_Modification,Ally_Village_Modification
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
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
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
hi everyone again, and sorry for bothering you with somewhat stupid questions, but here it is:
i would like something to randomly select a unit in a radius around a unit. i need it for a boss fight, where the boss casts random spells on random units.
i would like something to randomly select a unit in a radius around a unit. i need it for a boss fight, where the boss casts random spells on random units.
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
Code: Select all
[store_unit]
[filter]
side=whatever
[filter_location]
x,y=whatever
radius=whatever
[/filter_location]
[/filter]
kill=no
variable=target_selection
[/store_unit]
{VARIABLE_OP target_idx rand "0..$($target_selection.length - 1)"}
target_selection[$target_idx]
.
Last edited by Astoria on July 19th, 2016, 7:20 pm, edited 1 time in total.
Reason: Fixed
Reason: Fixed
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
Re: ForestDragon's WML questions
Except target_idx can end up out-of-bounds by one. What you want is:bumbadadabum wrote:{VARIABLE_OP target_idx rand "0..$target_selection.length"}
{VARIABLE_OP target_idx rand "0..$($target_selection.length - 1)"}
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
so, if i understand you two correctly, the stored unit is the one whom the random selects around?
and, if i want, say, to so something to the selected unit, i should use this?:
well, thanks for the help
and, if i want, say, to so something to the selected unit, i should use this?:
Code: Select all
x,y=target_idx.x,target_idx.y
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
zookeeper wrote:Except target_idx can end up out-of-bounds by one. What you want is:bumbadadabum wrote:{VARIABLE_OP target_idx rand "0..$target_selection.length"}
{VARIABLE_OP target_idx rand "0..$($target_selection.length - 1)"}
No, you need to doForestDragon wrote:so, if i understand you two correctly, the stored unit is the one whom the random selects around?
and, if i want, say, to so something to the selected unit, i should use this?:Code: Select all
x,y=target_idx.x,target_idx.y
x,y=$target_selection[$target_idx].x,$target_selection[$target_idx].y
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
ok, 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
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
hi, once again, i apologise if the sheer amount of wml questions of mine is getting on your nerves, but oh well, here it is:
i am trying to have a filter for a movement type, but it isn't working, i think i messed up with the [filter_wml] part
i am trying to have a filter for a movement type, but it isn't working, i think i messed up with the [filter_wml] part
Code: Select all
[filter]
side=1,2
[and]
[filter_wml]
[unit_type]
movement_type=mounted
[/unit_type]
[/filter_wml]
[/and]
[and]
[not]
[filter_wml]
[status]
not_living="yes"
[/status]
[/filter_wml]
[/not]
[/and]
[/filter]
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 doubt you can access it, but try just without [unit_type].
Re: ForestDragon's WML questions
When you look at a unit via :inspect (or in a savefile), do you see a [unit_type] tag inside it and then a movement_type= key inside that? You don't, so your [filter_wml] cannot match.
So, you can't filter by movetype directly, but you can of course filter by individual movement/defense/resistance values and probably get effectively the same result that way.
So, you can't filter by movetype directly, but you can of course filter by individual movement/defense/resistance values and probably get effectively the same result that way.
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: ForestDragon's WML questions
ok, i did it like this, and it worked:zookeeper wrote:When you look at a unit via :inspect (or in a savefile), do you see a [unit_type] tag inside it and then a movement_type= key inside that? You don't, so your [filter_wml] cannot match.
So, you can't filter by movetype directly, but you can of course filter by individual movement/defense/resistance values and probably get effectively the same result that way.
Code: Select all
[filter_wml]
[unit]
undead_variation=mounted
[/unit]
[/filter_wml]
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
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ForestDragon's WML questions
That was a good idea, but just be careful of counting on it. If a zombie wolf gets created, for example, that could change.
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
That cannot work. There's no [unit] tag to filter for in a unit any more than there is a [unit_type] tag.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: ForestDragon's WML questions
Well, I mean using undead_variation is a good idea at least.
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