wesnoth/data/campaigns/tutorial/lua/character_selection.lua
Severin Glöckner 0d5db80e5b Tutorial adjustments:
Do not show traits in the wiki for Li'sar and Konrad, since they can't get them.
Li'sars new sprite seems to use rather a sword than a saber.
Copied defense animation for Li'sar from HttT.
Changed lua due to deprecation warning.

[ci skip]
2017-03-11 00:00:53 +11:00

107 lines
2.2 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- #textdomain wesnoth-tutorial
-- Allows the player to choose whether they want to play Konrad or Lisar
-- for the tutorial
local helper = wesnoth.require "lua/helper.lua"
local T = helper.set_wml_tag_metatable {}
local wml_actions = wesnoth.wml_actions
local _ = wesnoth.textdomain "wesnoth-tutorial"
function wml_actions.select_character()
local character_selection_dialog = {
maximum_height = 250,
maximum_width = 400,
T.helptip { id="tooltip_large" }, -- mandatory field
T.tooltip { id="tooltip_large" }, -- mandatory field
T.grid {
T.row {
T.column {
grow_factor = 1,
border = "all",
border_size = 5,
horizontal_alignment = "left",
T.label {
definition = "title",
label = _"Select Character"
}
}
},
T.row {
T.column {
grow_factor = 1,
border = "all",
border_size = 5,
horizontal_alignment = "left",
T.label {
label = _"Who do you want to play?"
}
}
},
T.row {
T.column {
T.grid {
T.row {
T.column {
grow_factor = 1,
border = "all",
border_size = 5,
T.image {
label = "units/konrad-fighter.png"
}
},
T.column {
grow_factor = 1,
border = "all",
border_size = 5,
T.image {
label = "units/human-princess.png~TC(1,magenta)"
}
}
},
T.row {
T.column {
grow_factor = 1,
border = "all",
border_size = 5,
T.button {
label = _"Konrad",
return_value = 1
}
},
T.column {
grow_factor = 1,
border = "all",
border_size = 5,
T.button {
label = _"Lisar",
return_value = 2
}
}
}
}
}
}
}
}
local character = wesnoth.show_dialog(character_selection_dialog)
local unit = wesnoth.get_variable("student_store")
if character == 2 then
wesnoth.put_unit({
type = "Fighteress",
id = unit.id,
name = _"Lisar",
unrenamable = true,
profile = "portraits/lisar.png",
canrecruit = true,
facing = unit.facing,
}, unit.x, unit.y )
else
wesnoth.put_unit(unit)
end
wesnoth.redraw {}
end