In the scenario i am working on i have implemented a prevent_attack function. This uses just the field_action window and checks if the attack button is there. Whenever a player clicks on an attackable building a warning is shown:
function prevent_attack()
local warn_level = 1
while true do
local w = wl.ui.MapView().windows.field_action
if w and w.buttons.attack then print("Attacking not allowed!")
if warn_level < 2 then campaign_message_box(no_attack_01) warn_level = warn_level + 1
elseif warn_level < 3 then campaign_message_box(no_attack_02) warn_level = warn_level + 1
elseif warn_level < 5 then campaign_message_box(no_attack_03) warn_level = 1
end w:close()
end
sleep(100)
end
end
This works just nicely and shows a dialog to the player which covers the field_action window. I use three warning levels here: On first show warning1 on second click warning2 and so on. I think such thing could also be adapted to show the warning when clicking on an attackable building of a specific player.
In the scenario i am working on i have implemented a prevent_attack function. This uses just the field_action window and checks if the attack button is there. Whenever a player clicks on an attackable building a warning is shown:
function prevent_attack() ).windows. field_action
print( "Attacking not allowed!")
campaign_ message_ box(no_ attack_ 01)
warn_ level = warn_level + 1
campaign_ message_ box(no_ attack_ 02)
warn_ level = warn_level + 1
campaign_ message_ box(no_ attack_ 03)
warn_ level = 1
w: close()
local warn_level = 1
while true do
local w = wl.ui.MapView(
if w and w.buttons.attack then
if warn_level < 2 then
elseif warn_level < 3 then
elseif warn_level < 5 then
end
end
sleep(100)
end
end
This works just nicely and shows a dialog to the player which covers the field_action window. I use three warning levels here: On first show warning1 on second click warning2 and so on. I think such thing could also be adapted to show the warning when clicking on an attackable building of a specific player.