Code: Select all
if italy.alliance.id == 2 then
ChangeFactionAlignment(game:GetFactionById(15), spain.alliance, - math.random(35,45)
endModerators: Slitherine Core, The Lordz
Code: Select all
if italy.alliance.id == 2 then
ChangeFactionAlignment(game:GetFactionById(15), spain.alliance, - math.random(35,45)
endCode: Select all
local italy = game:GetFactionById(8)
local spain = game:GetFactionById(15)
if italy.alliance.id == 2 then
ChangeFactionAlignment(game:GetFactionById(15), spain.alliance, math.random(35,45)
end


Oh! If I want this script triggers only once, ¿is it possible?Robotron wrote: Mon May 06, 2019 2:21 pm Note that the alignment change by the script will take place at the beginning of each turn.
Because the modifier value is set to a range of between 35 to 45 Spain would join Entente 2 turns after Italy has joined CP.
Code: Select all
local italy = game:GetFactionById(8)
local spain = game:GetFactionById(15)
if GetEvent("SpainJoinsCP") == 0
and italy.alliance.id == 2 then
ChangeFactionAlignment(game:GetFactionById(15), spain.alliance, math.random(35,45))
SetEvent("SpainJoinsCP", -1)
end
Code: Select all
if GetEvent("SpainJoinsCP") == 0
and italy.alliance.id == 2 then
local luck = math.random(1,6)
if luck <= 4 then
ChangeFactionAlignment(game:GetFactionById(15), spain.alliance, math.random(35,45))
SetEvent("SpainJoinsCP", -1)
else
ChangeFactionAlignment(game:GetFactionById(15), spain.alliance, - math.random(35,45))
SetEvent("SpainJoinsCP", -1)
end
end

Code: Select all
function BlahBlahBlah()
local italy = game:GetFactionById(8)
local spain = game:GetFactionById(15)
if GetEvent("BlahBlahBlah") == 0
and italy.alliance.id == 2 then
ChangeFactionAlignment(game:GetFactionById(15), spain.alliance, math.random(35,45))
SetEvent("BlahBlahBlah", game.turn)
end
end
