Skip to content

Commit

Permalink
*Improved Scout Camp Consequences + InVain's fixes to SceneProps
Browse files Browse the repository at this point in the history
- Moved Scout Camp consequences to a script instead for better error handling (2 strings will need to be retranslated).
- Fix some dialogue bugs
- Applied InVain's fix to scene props.
  • Loading branch information
khamukkamu committed May 23, 2017
1 parent 310576b commit 79168e3
Show file tree
Hide file tree
Showing 29 changed files with 1,188 additions and 1,213 deletions.
1 change: 1 addition & 0 deletions ModuleSystem/ID/ID_scripts_mb.py
Expand Up @@ -524,5 +524,6 @@
script_delete_volunteers_party = 523
script_create_volunteers_party = 524
script_migrate_volunteer_system = 525
script_destroy_scout_camp_consequences = 526


37 changes: 19 additions & 18 deletions ModuleSystem/ID/ID_scripts_wb.py
Expand Up @@ -527,23 +527,24 @@
script_delete_volunteers_party = 526
script_create_volunteers_party = 527
script_migrate_volunteer_system = 528
script_game_get_upgrade_cost = 529
script_game_get_morale_of_troops_from_faction = 530
script_troop_tree_recursive_backtracking = 531
script_troop_tree_recursive_detect_max_tier = 532
script_prsnt_line = 533
script_get_page_no_of_troop_tree_for_troop_on = 534
script_init_camera = 535
script_dmod_cycle_forwards = 536
script_dmod_cycle_backwards = 537
script_agent_fix_division = 538
script_weapon_use_backup_weapon = 539
script_weapon_use_classify_agent = 540
script_cf_order_skirmish_check = 541
script_order_skirmish_begin_end = 542
script_order_skirmish_skirmish = 543
script_ce_get_troop_encumbrance = 544
script_get_closest_melee_enemy = 545
script_party_has_hero = 546
script_destroy_scout_camp_consequences = 529
script_game_get_upgrade_cost = 530
script_game_get_morale_of_troops_from_faction = 531
script_troop_tree_recursive_backtracking = 532
script_troop_tree_recursive_detect_max_tier = 533
script_prsnt_line = 534
script_get_page_no_of_troop_tree_for_troop_on = 535
script_init_camera = 536
script_dmod_cycle_forwards = 537
script_dmod_cycle_backwards = 538
script_agent_fix_division = 539
script_weapon_use_backup_weapon = 540
script_weapon_use_classify_agent = 541
script_cf_order_skirmish_check = 542
script_order_skirmish_begin_end = 543
script_order_skirmish_skirmish = 544
script_ce_get_troop_encumbrance = 545
script_get_closest_melee_enemy = 546
script_party_has_hero = 547


103 changes: 11 additions & 92 deletions ModuleSystem/module_dialogs.py
Expand Up @@ -2459,47 +2459,8 @@
(quest_get_slot, ":quest_target_center", "qst_destroy_scout_camp", slot_quest_target_center),
(str_store_party_name,12,":quest_target_center")],
"Our scouts near {s12} have told us about your success. This will teach them from spying on us.^^The destruction of this camp will surely halt our enemies' advance.", "lord_generic_mission_completed",[

#Faction Strength Changes - Balance Document can be found on Google Drive: https://goo.gl/CErgSN
(str_clear, s10),
(str_clear, s14),
(str_clear, s11),
(str_clear, s13),
(str_store_string, s10, "@loses Faction Strength due to the destruction of their camp."),
(str_store_string, s14, "@gain Faction Strength as news of your victory spreads."),
(quest_get_slot, ":scout_camp_faction", "qst_destroy_scout_camp", slot_quest_target_faction),
(faction_get_slot,":enemy",":scout_camp_faction",slot_faction_strength_tmp),
(str_store_faction_name, s11, ":scout_camp_faction"),
(store_character_level, ":level", "trp_player"),

## Faction Strength Change depend on player level
(try_begin),
(is_between, ":level", 11,17), #Small Scout Camp - Enemy Loss Min: 93; Max: 108 - Hero Win Min: 148; Max: 163
(val_mul, ":level",3),
(val_add, ":level", 60),
(val_sub, ":enemy", ":level"),
(display_message,"@{s11} {s10}",color_good_news),
(store_troop_faction, ":quest_giver_faction", "$g_talk_troop"),
(faction_get_slot,":win",":quest_giver_faction",slot_faction_strength_tmp),
(str_store_faction_name, s13, ":quest_giver_faction"),
(val_add, ":level", 55),
(val_add, ":win", ":level"),
(display_message,"@{s13} {s14}",color_good_news),
(else_try),
(is_between, ":level", 17,23), #Fortified Scout Camp - Enemy Loss Min: 145; Max: 170 - Hero Win Min: 200; Max: 225
(val_mul, ":level",5),
(val_add, ":level", 60),
(val_sub, ":enemy", ":level"),
(display_message,"@{s11} {s10}",color_good_news),
(store_troop_faction, ":quest_giver_faction", "$g_talk_troop"),
(faction_get_slot,":win",":quest_giver_faction",slot_faction_strength_tmp),
(str_store_faction_name, s13, ":quest_giver_faction"),
(val_add, ":level", 55),
(val_add, ":win", ":level"),
(display_message,"@{s13} {s14}",color_good_news),
(try_end),
(faction_set_slot,":quest_giver_faction",slot_faction_strength_tmp,":win"),
(faction_set_slot,":scout_camp_faction",slot_faction_strength_tmp,":enemy"),

(call_script,"script_destroy_scout_camp_consequences",1),
(call_script, "script_finish_quest", "qst_destroy_scout_camp", 100),
]],

Expand All @@ -2508,49 +2469,12 @@
(check_quest_failed, "qst_destroy_scout_camp"),
(quest_get_slot, ":giver_troop", "qst_destroy_scout_camp", slot_quest_giver_troop),
(eq, "$g_talk_troop", ":giver_troop"),
(quest_get_slot, ":quest_target_center", "qst_destroy_scout_camp", slot_quest_object_center),
(str_store_party_name,12,":quest_target_center")],
"Our scouts near {s12} saw you and your men retreat. This is disappointing, {playername}. ^^Your failure resulted in the attack of vital supply lines. It will take some time to recover.", "destroy_scout_camp_failed",[
(quest_get_slot, ":quest_target_center", "qst_destroy_scout_camp", slot_quest_target_center),
(str_store_faction_name,s12,":quest_target_center")],
"Our scouts near {s12}'s camp saw you and your men retreat. This is disappointing, {playername}. ^^Your failure resulted in the attack of vital supply lines. It will take some time to recover.", "destroy_scout_camp_failed",[
(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", -2),

#Faction Strength Changes
(str_clear, s10),
(str_clear, s14),
(str_clear, s11),
(str_clear, s13),
(str_store_string, s10, "@have taken measure of your faction's current strength and has grown bolder."),
(str_store_string, s14, "@loses Faction Strength as supply lines were disrupted."),
(quest_get_slot, ":scout_camp_faction", "qst_destroy_scout_camp", slot_quest_target_faction),
(faction_get_slot,":enemy",":scout_camp_faction",slot_faction_strength_tmp),
(str_store_faction_name, s11, ":scout_camp_faction"),
(store_character_level, ":level", "trp_player"),
(try_begin),
(is_between, ":level", 11,17), #Small Scout Camp - Enemy Win Min: 125; Max: 150 - Hero Loss Min: 275; Max: 300
(val_mul, ":level",5),
(val_add, ":level", 70),
(val_add, ":enemy", ":level"),
(display_message,"@{s11} {s10}",color_bad_news),
(store_troop_faction, ":quest_giver_faction", "$g_talk_troop"),
(faction_get_slot,":loss",":quest_giver_faction",slot_faction_strength_tmp),
(str_store_faction_name, s13, ":quest_giver_faction"),
(val_add, ":level", 150),
(val_sub, ":loss", ":level"),
(display_message,"@{s13} {s14}",color_bad_news),
(else_try),
(is_between, ":level", 17,23), #Fortified Scout Camp - Enemy Win Min: 270; Max: 320 - Hero Loss Min: 420; Max: 470
(val_mul, ":level",10),
(val_add, ":level", 100),
(val_add, ":enemy", ":level"),
(display_message,"@{s11} {s10}",color_bad_news),
(store_troop_faction, ":quest_giver_faction", "$g_talk_troop"),
(faction_get_slot,":loss",":quest_giver_faction",slot_faction_strength_tmp),
(str_store_faction_name, s13, ":quest_giver_faction"),
(val_add, ":level", 150),
(val_sub, ":loss", ":level"),
(display_message,"@{s13} {s14}",color_bad_news),
(try_end),
(faction_set_slot,":quest_giver_faction",slot_faction_strength_tmp,":loss"),
(faction_set_slot,":scout_camp_faction",slot_faction_strength_tmp,":enemy"),
(call_script,"script_destroy_scout_camp_consequences",0),
(cancel_quest, "qst_destroy_scout_camp"),
]],

Expand Down Expand Up @@ -5231,7 +5155,8 @@
[anyone,"lord_tell_mission", [
(eq,"$random_quest_no","qst_destroy_scout_camp"),
(quest_get_slot, ":target_center", "qst_destroy_scout_camp", slot_quest_target_center),
(str_store_party_name,s3,":target_center")],
(store_faction_of_party, ":fac",":target_center"),
(str_store_faction_name, s3, ":fac")],
"{playername}, we have received word that {s3} has a scout camp nearby, Make sure you are not seen and destroy it before they learn about our plans.", "lord_mission_destroy_scout_camp_a",
[]],

Expand All @@ -5250,28 +5175,22 @@
(quest_get_slot, ":quest_target_party_template", "$random_quest_no", slot_quest_target_party_template),
#(quest_get_slot, ":quest_object_center", "$random_quest_no", slot_quest_object_center),
(assign, ":terrain_check", 0), # Check if spawned camp is not in weird terrain
(try_for_range, ":unused", 0, 10),
(try_for_range_backwards, ":tries_left", 0, 10),
(eq, ":terrain_check",0),
(set_spawn_radius, 15),
(spawn_around_party,"$g_encountered_party",":quest_target_party_template"),
(try_begin),
(party_get_current_terrain, ":terrain_type", reg0),
(assign, "$qst_destroy_scout_camp_party", reg0),
(neq, ":terrain_type", rt_water),
(neq, ":terrain_type", rt_mountain),
(neq, ":terrain_type", rt_river),
(assign, "$qst_destroy_scout_camp_party", reg0),
(assign, ":terrain_check", 1),
(else_try),
(gt,":tries_left",0), #last ditch effort, if 10 iterations of the above doesnt work, just spawn it, and hope for the best
(call_script, "script_safe_remove_party", reg0),
(try_end),
(try_end),
(try_begin), #last ditch effort, if 10 iterations of the above doesnt work, just spawn it, and hope for the best
(party_is_active, "$qst_destroy_scout_camp_party"),
(else_try),
(set_spawn_radius, 15),
(spawn_around_party,"$g_encountered_party",":quest_target_party_template"),
(assign, "$qst_destroy_scout_camp_party", reg0),
(try_end),
(call_script, "script_get_region_of_party", "$qst_destroy_scout_camp_party"),
(store_add, reg2, str_shortname_region_begin , reg1),
(str_store_string,s1,reg2),
Expand Down
2 changes: 1 addition & 1 deletion ModuleSystem/module_items.py
Expand Up @@ -270,7 +270,7 @@
["short_bow","Short_Bow",[("small_bow",0),("small_bow_carry",ixmesh_carry)],itp_type_bow|itp_primary|itp_two_handed|itp_shop,itcf_shoot_bow|itcf_carry_bow_back,50,weight(1)|difficulty(0)|shoot_speed(48)|spd_rtng(99)|thrust_damage(25,cut),imodbits_bow,[]],
["regular_bow","Bow",[("regular_bow",0),("regular_bow_carry",ixmesh_carry)],itp_type_bow|itp_primary|itp_two_handed|itp_shop,itcf_shoot_bow|itcf_carry_bow_back,100,weight(1)|difficulty(0)|shoot_speed(52)|spd_rtng(98)|thrust_damage(28,cut),imodbits_bow,[]],
["nomad_bow","Nomad_Bow",[("nomad_bow",0),("nomad_bow_case",ixmesh_carry)],itp_type_bow|itp_primary|itp_two_handed|itp_shop,itcf_shoot_bow|itcf_carry_bowcase_left|itcf_show_holster_when_drawn,200,weight(1.3)|difficulty(0)|shoot_speed(53)|spd_rtng(96)|thrust_damage(30,cut),imodbits_bow,[]],
["gondor_bow","Gondor_Bow",[("gondor_bow",0),("gondor_bow_carry",ixmesh_carry)],itp_type_bow|itp_primary|itp_two_handed|itp_shop,itcf_shoot_bow|itcf_carry_bow_back|itp_cant_use_on_horseback,400,weight(1.8)|difficulty(0)|shoot_speed(54)|spd_rtng(82)|thrust_damage(42,cut),imodbits_bow,[]],
["gondor_bow","Gondor_Bow",[("gondor_bow",0),("gondor_bow_carry",ixmesh_carry)],itp_type_bow|itp_primary|itp_two_handed|itp_shop|itp_cant_use_on_horseback,itcf_shoot_bow|itcf_carry_bow_back,400,weight(1.8)|difficulty(0)|shoot_speed(54)|spd_rtng(82)|thrust_damage(42,cut),imodbits_bow,[]],
["strong_bow","Strong_Bow",[("strong_bow",0),("strong_bow_case",ixmesh_carry)],itp_type_bow|itp_primary|itp_two_handed|itp_shop,itcf_shoot_bow|itcf_carry_bowcase_left|itcf_show_holster_when_drawn,400,weight(1.3)|difficulty(0)|shoot_speed(57)|spd_rtng(94)|thrust_damage(35,cut),imodbits_bow,[]],
["elven_bow","Elven_Bow",[("elven_bow",0),("elven_bow_carry",ixmesh_carry)],itp_type_bow|itp_primary|itp_two_handed|itp_shop|itp_cant_use_on_horseback,itcf_shoot_bow|itcf_carry_bow_back,1000,weight(1.5)|difficulty(3)|shoot_speed(65)|spd_rtng(93)|thrust_damage(25,pierce),imodbits_good_bow,[]],
["corsair_bow","Corsair_Bow",[("corsair_bow",0),("corsair_bow_carry",ixmesh_carry)],itp_type_bow|itp_primary|itp_two_handed|itp_shop|itp_cant_use_on_horseback,itcf_shoot_bow|itcf_carry_bow_back,500,weight(1.5)|difficulty(0)|shoot_speed(58)|spd_rtng(93)|thrust_damage(35,cut),imodbits_bow,[]],
Expand Down
4 changes: 2 additions & 2 deletions ModuleSystem/module_scene_props.py
Expand Up @@ -2458,8 +2458,8 @@

] or []) + [

("distant_mountain_snow_1",0,"distant_mountain_snow_1","0", []), #InVain: These two were WB only before. Moved them out of the script to make them available in MB.
("distant_mountain_snow_2",0,"distant_mountain_snow_2","0", []),
("distant_mountain_snow_1",sokf_place_at_origin|sokf_moveable,"distant_mountain_snow_1","0", []), #InVain: These two were WB only before. Moved them out of the script to make them available in MB.
("distant_mountain_snow_2",sokf_place_at_origin|sokf_moveable,"distant_mountain_snow_2","0", []),

("osgiliath_far_f",0,"osgiliath_far","0", []),
("hill",0,"hill","bo_hill", []),
Expand Down
79 changes: 79 additions & 0 deletions ModuleSystem/module_scripts.py
Expand Up @@ -22000,7 +22000,86 @@ def set_item_score():
(try_end),
]),

#script_destroy_scout_camp_consequences
#Executes the faction strength changes of the destroy scout camp quest and shows the corresponding messages
#arg1: 0: Mission failed Not 0: Mission succeeded
#Dirties s10,s14,s11,s13
("destroy_scout_camp_consequences", [
(store_script_param_1, ":success"),

#Faction Strength Changes - Balance Document can be found on Google Drive: https://goo.gl/CErgSN
(str_clear, s10),
(str_clear, s14),
(str_clear, s11),
(str_clear, s13),
(try_begin),
(eq,":success",0),
(str_store_string, s10, "@have taken measure of your faction's current strength and has grown bolder."),
(str_store_string, s14, "@loses Faction Strength as supply lines were disrupted."),
(assign,":news_color",color_bad_news),
(else_try),
(str_store_string, s10, "@loses Faction Strength due to the destruction of their camp."),
(str_store_string, s14, "@gain Faction Strength as news of your victory spreads."),
(assign,":news_color",color_good_news),
(try_end),

(quest_get_slot, ":scout_camp_faction", "qst_destroy_scout_camp", slot_quest_target_faction),
(quest_get_slot, ":quest_giver_troop", "qst_destroy_scout_camp", slot_quest_giver_troop),
(store_troop_faction, ":quest_giver_faction", ":quest_giver_troop"),

(str_store_faction_name, s11, ":scout_camp_faction"),
(str_store_faction_name, s13, ":quest_giver_faction"),
(display_message,"@{s11} {s10}",":news_color"),
(display_message,"@{s13} {s14}",":news_color"),

(faction_get_slot,":enemy_strength",":scout_camp_faction",slot_faction_strength_tmp),
(faction_get_slot,":giver_strength",":quest_giver_faction",slot_faction_strength_tmp),

(store_character_level, ":level", "trp_player"),
(val_max,":level",11), # Keep ":level" between 11 and 23
(val_min,":level",23),
(quest_get_slot,":camp_template","qst_destroy_scout_camp",slot_quest_target_party_template),
(try_begin),
(eq,":camp_template","pt_scout_camp_small"), #Small Scout Camp
(try_begin), # Failure: Enemy Win Min: 125; Max: 150 - Hero Loss Min: 275; Max: 300
(eq,":success",0),
(val_mul, ":level",5),
(val_add, ":level", 70),
(val_add, ":enemy_strength", ":level"),

(val_add, ":level", 150),
(val_sub, ":giver_strength", ":level"),
(else_try), #Success: Enemy Loss Min: 93; Max: 108 - Hero Win Min: 148; Max: 163
(val_mul, ":level",3),
(val_add, ":level", 60),
(val_sub, ":enemy_strength", ":level"),

(val_add, ":level", 55),
(val_add, ":giver_strength", ":level"),
(try_end),
(else_try),
(eq,":camp_template","pt_scout_camp_large"), #Fortified Scout Camp
(try_begin), # Failure: Enemy Win Min: 270; Max: 320 - Hero Loss Min: 420; Max: 470
(eq,":success",0),
(val_mul, ":level",10),
(val_add, ":level", 100),
(val_add, ":enemy_strength", ":level"),

(val_add, ":level", 150),
(val_sub, ":giver_strength", ":level"),
(else_try), # Success: Enemy Loss Min: 145; Max: 170 - Hero Win Min: 200; Max: 225
(val_mul, ":level",5),
(val_add, ":level", 60),
(val_sub, ":enemy_strength", ":level"),

(val_add, ":level", 55),
(val_add, ":giver_strength", ":level"),
(try_end),
(try_end),

(faction_set_slot,":quest_giver_faction",slot_faction_strength_tmp,":giver_strength"),
(faction_set_slot,":scout_camp_faction",slot_faction_strength_tmp,":enemy_strength"),
]),
]

scripts = scripts + ai_scripts + formAI_scripts + morale_scripts + command_cursor_scripts
Expand Down
1 change: 1 addition & 0 deletions ModuleSystem/module_scripts_ai.py
Expand Up @@ -2686,6 +2686,7 @@
(party_is_active, ":reserve_party"),
(party_detach, ":reserve_party"),
(call_script, "script_safe_remove_party", ":reserve_party"),
(troop_set_slot, 0, "trp_player", slot_troop_player_reserve_party),
(try_end),

# If this is Edoras and Hornburg is still Rohan's, move capital
Expand Down

0 comments on commit 79168e3

Please sign in to comment.