Lua [allow_extra_recruit] equivalent?
Moderator: Forum Moderators
Lua [allow_extra_recruit] equivalent?
Looking for this.
Re: Lua [allow_extra_recruit] equivalent?
You can call any wml tag from Lua should you need to.
Re: Lua [allow_extra_recruit] equivalent?
You mean using wesnoth.wml_actions.allow_extra_recruit(cfg)? But I don't know how to make cfg object correctly.
Don't work.
Code: Select all
loacl cfg.extra_recruit = "Elvish Fighter"
Re: Lua [allow_extra_recruit] equivalent?
Code: Select all
wesnoth.fire("modify_side", { side=i, flag="flags/flag-[1~4].png:250~RC(magenta>Rav_yellow)"})
Last edited by Ravana on November 14th, 2016, 8:14 pm, edited 1 time in total.
Reason: .
Reason: .
Re: Lua [allow_extra_recruit] equivalent?
i dont see how your code is related to his problem but you don't need wesnoth.fire here, you can call modify_side directly:
generally you only need
NOTE: im assuming here that
Code: Select all
wesnoth.wml_actions.modify_side {
side=i,
flag="flags/flag-[1~4].png:250~RC(magenta>Rav_yellow)",
}
wesnoth.fire
if the wml content might need variable substitution.NOTE: im assuming here that
i
is an integer calculated by lua, if i
is a taken from a wml variable/container its uit possible that it doe need variable substitution.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.
Re: Lua [allow_extra_recruit] equivalent?
Thanks gfgtdf. Now I know how to use it correctly. Problem fixed.
Code: Select all
local side = wesnoth.get_variable("side_number")
wesnoth.wml_actions.allow_extra_recruit {
side = side,
extra_recruit = "Elvish Fighter"
}
Re: Lua [allow_extra_recruit] equivalent?
i'd replace
wesnoth.get_variable("side_number")
with wesnoth.current.side
. I doubt that there is wml code that actually overwrites the side_number variable but it's possible.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.