Hi,
I've working on a mod that's allows it's players to place down different marks on the battleground's tiles.
The KEY FEATURE would be to any player at any time could place any marker at any tile trough the
Since the mod doesn't effect any important in game values the OOS aspect is irrelevant.
This is what I've been tried so far (unfortunately not working, player can't use It outside of It's turn):Thanks in advance for any suggestion.
I've working on a mod that's allows it's players to place down different marks on the battleground's tiles.
The KEY FEATURE would be to any player at any time could place any marker at any tile trough the
context menu
. I'm trying to achieve similar behaviour to the built in Set Label
or Clear Labels
, just with icons instead of text. Is it possible to implement such feature with lua
?Since the mod doesn't effect any important in game values the OOS aspect is irrelevant.
This is what I've been tried so far (unfortunately not working, player can't use It outside of It's turn):
Code:
--- ping.cfg ---[event] name=prestart [set_menu_item] id=ping_place_marker description="Place a Mark" synced = no [command] [lua] [args] x=$x1 y=$y1 [/args] code= << local marker = wml.variables["ping_selected_marker"] local team = wml.variables["ping_team"] local args = ...; local ping = wesnoth.require("~add-ons/Ping/lua/ping.lua") ping.place_marker_at(args.x, args.y,team, marker) >> [/lua] [/command] [/set_menu_item][/event]--- ping.lua ---res = {}function res.place_marker_at(x,y, team, marker) wesnoth.sync.invoke_command("synced_place_marker_at", { x = x, y = y, team = team, marker = marker })endfunction get_marker(id) local img if id == 0 then img ="/mark-danger.png" elseif id == 1 then img = "/mark-here.png" elseif id == 2 then img = "/mark-protect.png" elseif id == 3 then img = "/mark-target.png" else img = "/icons/none.png" end return "marks" .. imgendwesnoth.custom_synced_commands.synced_place_marker_at = function(cfg) local visible = wml.variables["ping_is_visible"] or false if visible then wml.fire.item({ x = cfg.x, y = cfg.y, team_name = cfg.team, visible_in_fog = true, image = get_marker(cfg.marker), name = "ping_mark" }) end local length = wml.variables["ping_marks.length"] or 0 wml.variables["ping_marks[".. length .."].x"] = cfg.x wml.variables["ping_marks[".. length .."].y"] = cfg.y wml.variables["ping_marks[".. length .."].team"] = cfg.team wml.variables["ping_marks[".. length .."].marker"] = cfg.markerendreturn res
Statistics: Posted by Tonk — Today, 10:19 am