Difficulty Script
AI/Player ScriptCode:declare_counter difficulty declare_counter difficulty_easy declare_counter difficulty_medium declare_counter difficulty_hard declare_counter difficulty_very_hard declare_counter difficulty_set monitor_event FactionTurnStart FactionIsLocal and I_CompareCounter difficulty_set = 0 and CampaignDifficulty = easy set_event_counter difficulty_easy 1 set_event_counter difficulty_medium 0 set_event_counter difficulty_hard 0 set_event_counter difficulty_very_hard 0 set_counter difficulty 1 set_counter difficulty_set 1 log always Campaign Difficulty: easy terminate_monitor end_monitor monitor_event FactionTurnStart FactionIsLocal and I_CompareCounter difficulty_set = 0 and CampaignDifficulty = medium set_event_counter difficulty_easy 0 set_event_counter difficulty_medium 1 set_event_counter difficulty_hard 0 set_event_counter difficulty_very_hard 0 set_counter difficulty 2 set_counter difficulty_set 1 log always Campaign Difficulty: medium terminate_monitor end_monitor monitor_event FactionTurnStart FactionIsLocal and I_CompareCounter difficulty_set = 0 and CampaignDifficulty = hard set_event_counter difficulty_easy 0 set_event_counter difficulty_medium 0 set_event_counter difficulty_hard 1 set_event_counter difficulty_very_hard 0 set_counter difficulty 3 set_counter difficulty_set 1 log always Campaign Difficulty: hard terminate_monitor end_monitor monitor_event FactionTurnStart FactionIsLocal and I_CompareCounter difficulty_set = 0 and CampaignDifficulty = very_hard set_event_counter difficulty_easy 0 set_event_counter difficulty_medium 0 set_event_counter difficulty_hard 0 set_event_counter difficulty_very_hard 1 set_counter difficulty 4 set_counter difficulty_set 1 log always Campaign Difficulty: very_hard terminate_monitor end_monitor
You can also add building capabilities specific to a campaign difficulty level and depending on if it's for the AI or player.Code:declare_counter local_england declare_counter ai_england monitor_event FactionTurnStart FactionIsLocal and FactionType england set_event_counter local_england 1 set_event_counter ai_england 0 if not I_HotseatEnabled terminate_monitor end_if end_monitor monitor_event FactionTurnStart not FactionIsLocal and FactionType england set_event_counter local_england 0 set_event_counter ai_england 1 if not I_HotseatEnabled terminate_monitor end_if end_monitor
You can now use the difficulty counter for events that occur during the Local Faction and AI Factions. The CampaignDifficulty condition only works correctly for the Local Faction. It returns medium for AI faction events.Code:income_bonus bonus 200 requires factions { england, } and event_counter local_england 1 and event_counter difficulty_easy 1 income_bonus bonus 400 requires factions { england, } and event_counter ai_england 1 and event_counter difficulty_easy 1
Code:I_CompareCounter difficulty >= 3






Reply With Quote







