Help with Commendation points trigger
Posted: Thu Jan 21, 2021 6:03 pm
hello, i need help with commendation points trigger for my custom campaign, i've created the scripts following the AO lua files, but when i start my campaign i get the following error message 90: bad argument #2 to 'format' (number expected,got nil)
here are the scripts
here are the scripts
- current_cp_format = NSLOCTEXT("scenario_Poznan", "current_cp_format", "In this campaign, you can earn Commendation Points by completing bonus objectives. Opportunities to exchange Commendation Points for various rewards will be offered as the campaign progresses.\n\nYou begin this campaign with %d Commendation Points.")
earned_cp_format2 = NSLOCTEXT("scenario_Poznan", "earned_cp_format2", "Secondary Objective to Destroy all Polish Aircraft completed.\nEarned Commendation Points: %d.\nTotal Commendation Points: %d.")
earned_cp_format = NSLOCTEXT("scenario_Poznan", "earned_cp_format", "Secondary Objective to capture all Polish Aifields completed.\nEarned Commendation Points: %d.\nTotal Commendation Points: %d.")
function AlwaysTrue()
return true
end
function OnStartGame()
local str = string.format(tostring(current_cp_format), campaign.comm_points) --here is where the error triggers
MessageBox(str)
end
function OnObjective2(action)
local comm = 0
comm = 1
campaign.comm_points = campaign.comm_points + comm
local str2 = string.format(tostring(earned_cp_format2), comm, campaign.comm_points)
MessageBox(str2)
-- end
end
function Objective2Condition(action)
return action.side == 0 and action.objective == 2 and action.status == ObjectiveStatus.Success
end
function OnObjective1(action)
local comm = 0
comm = 1
campaign.comm_points = campaign.comm_points + comm
local str1 = string.format(tostring(earned_cp_format), comm, campaign.comm_points)
MessageBox(str1)
-- end
end
function Objective1Condition(action)
return action.side == 0 and action.objective == 1 and action.status == ObjectiveStatus.Success
end