diff -r de9ad743666e -r 05d4b420182a Campaigns.wiki --- a/Campaigns.wiki Wed Oct 30 02:59:24 2019 +0000 +++ b/Campaigns.wiki Wed Oct 30 03:00:39 2019 +0000 @@ -78,7 +78,20 @@ A_Classic_Fairytale-first_blood.desc="Help Leaks a Lot to complete his training and become a proper hedgehog warrior. You will be trained in the art of rope, parachute, shoryuken and desert eagle." }}} -== Campaign progress == -Initially, only mission 1 is unlocked. To unlock more missions and to mark missions and the campaign as completed, you must set campaign variables. +== Campaign variables / campaign progress == +Campaigns support campaign variables which allow to store arbitrary values about the campaign in the team file. Most importantly, the campaign progress is stored here. This uses the functions `SaveCampaignVar` and `GetCampaignVar`. Note that `SaveMissionVar` and `GetMissionVar` do *not* work in campaign missions. + +Initially, only mission 1 is unlocked. To unlock more missions and to mark missions and the campaign as completed, you must set campaign variables. For linear campaigns, you can use this idiom: -Read [ConfigurationFiles] to learn how campaign variables work. +{{{ +-- To be called when mission 5 was won: +local missionNumber = 5 +local progress = tonumber(GetCampaignVar("Progress")) +if progress == nil or progress < 5 then + SaveCampaignVar("Progress", "5") +end +}}} + +For non-linear campaigns, a more sophisticated unlocking is available. + +Read [ConfigurationFiles] to learn how campaign variables work in detail. \ No newline at end of file