lua_function in Location Filter
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.
lua_function in Location Filter
in StandartUnitFilters i can use the lua_function attribute, is there a way to do the same in a LocationFilter?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: lua_function in Location Filter
Try [filter_location][filter]lua_function=; I think it requires a unit to be at the location though. But other than that, you could put whatever conditions into that function.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: lua_function in Location Filter
but there is normaly no unit on that hex.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: lua_function in Location Filter
Well, then: no.
And btw, good job with that boost bug workaround.
And btw, good job with that boost bug workaround.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: lua_function in Location Filter
Maybe you can e.g. temporarily place a fog clearer there and remove after?
Re: lua_function in Location Filter
@Anonymissimus
have you tested it? the last version should not create bugged gz files at all.
@iceiceice:
no that was supposed to be a filter for a right click menu items, so i dont knever know when it will happen.
maybe i can create somthing like a terrain overlay terrain wich defines wether there can can be klicked or not. Or i make pull request it shouldnt be too hard to add, or i do other things first and then think about it again, if i still think i need this.
have you tested it? the last version should not create bugged gz files at all.
@iceiceice:
no that was supposed to be a filter for a right click menu items, so i dont knever know when it will happen.
maybe i can create somthing like a terrain overlay terrain wich defines wether there can can be klicked or not. Or i make pull request it shouldnt be too hard to add, or i do other things first and then think about it again, if i still think i need this.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: lua_function in Location Filter
Not only are the crashes gone. Since MSVC debugger can use the wml cache now, relaunching into the test scenario takes roughly a whole minute less than before now. So, very useful at a very low cost code-wise. Excellent. (Kind of a typical wesnoth bug, some bug which is also a bug on Linux but just not as noticable and unfixed due to lack of windows devs.)gfgtdf wrote:have you tested it? the last version should not create bugged gz files at all.
How could one place a unit from within a location/unit/whatever filter ? lua_function= could do it yes but .iceiceice wrote:Maybe you can e.g. temporarily place a fog clearer there and remove after?
So, one would need two loops, one before and one after the filter call, to place a unit on all hexes and remove them afterwards. I don't suppose that's a good idea on anything but small maps.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
- Elvish_Hunter
- Posts: 1575
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: lua_function in Location Filter
iceiceice wrote:Maybe you can e.g. temporarily place a fog clearer there and remove after?
Why don't you try describing us what kind of filter do you need? It may even turn out that you won't need lua_function at all.iceiceice wrote:@iceiceice:
no that was supposed to be a filter for a right click menu items, so i dont knever know when it will happen.
In fact, lua_function= 's purpose is to take a unit and pass it as an argument to a function. Here there is an old example that I made:Anonymissimus wrote:How could one place a unit from within a location/unit/whatever filter ? lua_function= could do it yes but .
Code: Select all
function is_enemy( unit )
if wesnoth.is_enemy( 1, unit.side ) then
return true
end
end
Code: Select all
[if]
[have_unit]
lua_function=is_enemy
[filter_vision]
visible=yes
viewing_side=1
[/filter_vision]
[/have_unit]
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)