problem with lua script - need help
Posted: Mon Mar 22, 2021 10:33 pm
hi guys,
i implemented a game for two human players (payer 1 vs player 2) .... on turn 2 a message must appear and a unit must appear: below i copied my lua script
when i test the game: on turn 2 the ESMilitia appears correctly, but no message is shown (!?) and on the next player turn the "end turn" button is disabled (!?) ... the only way to end turn is to hit alt+e ... what do you think? ...
function turnodue()
return world.round == 2
end
string_1 = NSLOCTEXT("spagna_last", "string_1", "ATTENZIONE: sono arrivati rinforzi italiani a Cadiz")
function italiani1()
TutorialMessage(string_1)
local giocatore = world:GetPlayer(0) -- primo giocatore
local esagono = {15,52} -- esagono di piazzamento
local unita = "ESMilitia" -- quale unità
local create_action = world:MakePurchaseAction(giocatore, unita, "", -5)
create_action.auxiliary = false
create_action.cost = 0 -- costo zero
world:Exec(create_action)
local unit = world:GetUnit(create_action.id)
local hex = world:GetHex(esagono)
if (hex:GetUnit(0) == nil) then -- se l'esagono è vuoto
deploy_action = world:MakeDeployAction(unit,esagono)
world:Exec(deploy_action)
end
end
second question: suppose i would like to make the same on player 2 round ... how should i correct this?
i implemented a game for two human players (payer 1 vs player 2) .... on turn 2 a message must appear and a unit must appear: below i copied my lua script
when i test the game: on turn 2 the ESMilitia appears correctly, but no message is shown (!?) and on the next player turn the "end turn" button is disabled (!?) ... the only way to end turn is to hit alt+e ... what do you think? ...
function turnodue()
return world.round == 2
end
string_1 = NSLOCTEXT("spagna_last", "string_1", "ATTENZIONE: sono arrivati rinforzi italiani a Cadiz")
function italiani1()
TutorialMessage(string_1)
local giocatore = world:GetPlayer(0) -- primo giocatore
local esagono = {15,52} -- esagono di piazzamento
local unita = "ESMilitia" -- quale unità
local create_action = world:MakePurchaseAction(giocatore, unita, "", -5)
create_action.auxiliary = false
create_action.cost = 0 -- costo zero
world:Exec(create_action)
local unit = world:GetUnit(create_action.id)
local hex = world:GetHex(esagono)
if (hex:GetUnit(0) == nil) then -- se l'esagono è vuoto
deploy_action = world:MakeDeployAction(unit,esagono)
world:Exec(deploy_action)
end
end
second question: suppose i would like to make the same on player 2 round ... how should i correct this?