Where do I find a code...

正在查看此主题的用户

Dragon_Lance

Regular
Where do I find the code that engages how many troops are needed to lay siege on a castle/town? I know you have to have better than ten troops or more.. I'm sure I need to declare war if the faction doesn't detest me as of yet by confronting a lord. Yes, I have this uber ambition ( considering that I am messing with the module system ) to randomly take over a castle under my own solo strength ( and yes, I will do it ). It's just for kicks  :mrgreen: , but it would be fun. Any help is appreciated.
 
Ok, I searched for you (because I was interested too  :lol: ).
(in module_game_menus)

  (
    "castle_outside",0,
    "You are outside {s2}.{s11} {s3} {s4}",
    "none",
    [
        (assign, "$g_enemy_party", "$g_encountered_party"),
        (assign, "$g_ally_party", -1),
        (str_store_party_name, s2,"$g_encountered_party"),
        (call_script, "script_encounter_calculate_fit"),
        (assign,"$all_doors_locked",1),
        (assign, "$current_town","$g_encountered_party"),
        (try_begin),
          (eq, "$new_encounter", 1),
          (assign, "$new_encounter", 0),
          (call_script, "script_let_nearby_parties_join_current_battle", 1, 0),
          (call_script, "script_encounter_init_variables"),
          (assign, "$entry_to_town_forbidden",0),
          (assign, "$sneaked_into_town",0),
          (assign, "$town_entered", 0),
#          (assign, "$waiting_for_arena_fight_result", 0),
          (assign, "$encountered_party_hostile", 0),
          (assign, "$encountered_party_friendly", 0),
          (try_begin),
            (gt, "$g_player_besiege_town", 0),
            (neq,"$g_player_besiege_town","$g_encountered_party"),
            (party_slot_eq, "$g_player_besiege_town", slot_center_is_besieged_by, "p_main_party"),
            (call_script, "script_lift_siege", "$g_player_besiege_town", 0),
            (assign,"$g_player_besiege_town",-1),
          (try_end),
          (try_begin),
            (lt, "$g_encountered_party_relation", 0),
            (assign, "$encountered_party_hostile", 1),
            (assign,"$entry_to_town_forbidden",1),
          (try_end),

          (assign,"$cant_sneak_into_town",0),
          (try_begin),
            (eq,"$current_town","$last_sneak_attempt_town"),
            (store_current_hours,reg(2)),
            (val_sub,reg(2),"$last_sneak_attempt_time"),
            (lt,reg(2),12),
            (assign,"$cant_sneak_into_town",1),
          (try_end),
        (else_try), #second or more turn
          (eq, "$g_leave_encounter",1),
          (change_screen_return),
        (try_end),

        (str_clear,s4),
        (try_begin),
          (eq,"$entry_to_town_forbidden",1),
          (try_begin),
            (eq,"$cant_sneak_into_town",1),
            (str_store_string,s4,"str_sneaking_to_town_impossible"),
          (else_try),
            (str_store_string,s4,"str_entrance_to_town_forbidden"),
          (try_end),
        (try_end),

        (party_get_slot, ":center_lord", "$current_town", slot_town_lord),
        (store_faction_of_party, ":center_faction", "$current_town"),
        (str_store_faction_name,s9,":center_faction"),
        (try_begin),
          (ge, ":center_lord", 0),
          (str_store_troop_name,s8,":center_lord"),
          (str_store_string,s7,"@{s8} of {s9}"),
        (try_end),

        (try_begin), # same mnu_town
          (party_slot_eq,"$current_town",slot_party_type, spt_castle),
          (try_begin),
            (eq, ":center_lord", "trp_player"),
            (str_store_string,s11,"@ Your own banner flies over the castle gate."),
          (else_try),
            (ge, ":center_lord", 0),
            (str_store_string,s11,"@ You see the banner of {s7} over the castle gate."),
          (else_try),
            (str_store_string,s11,"@ This castle seems to belong to no one."),
          (try_end),
        (else_try),
          (try_begin),
            (eq, ":center_lord", "trp_player"),
            (str_store_string,s11,"@ Your own banner flies over the town gates."),
          (else_try),
            (ge, ":center_lord", 0),
            (str_store_string,s11,"@ You see the banner of {s7} over the town gates."),
          (else_try),
            (str_store_string,s11,"@ The townsfolk here have declared their independence."),
          (try_end),
        (try_end),

        (party_get_num_companions, reg(7),"p_collective_enemy"),
        (assign,"$castle_undefended",0),
        (str_clear, s3),
        (try_begin),
          (eq,reg(7),0),
          (assign,"$castle_undefended",1),
#          (party_set_faction,"$g_encountered_party","fac_neutral"),
#          (party_set_slot, "$g_encountered_party", slot_town_lord, stl_unassigned),
          (str_store_string, s3, "str_castle_is_abondened"),
        (else_try),
          (eq,"$g_encountered_party_faction","fac_player_supporters_faction"),
          (str_store_string, s3, "str_place_is_occupied_by_player"),
        (else_try),
          (lt, "$g_encountered_party_relation", 0),
          (str_store_string, s3, "str_place_is_occupied_by_enemy"),
        (else_try),
#          (str_store_string, s3, "str_place_is_occupied_by_friendly"),
        (try_end),

        (try_begin),
          (eq, "$g_leave_town_outside",1),
          (assign, "$g_leave_town_outside",0),
          (assign, "$g_permitted_to_center", 0),
          (change_screen_return),
        (else_try),
          (check_quest_active, "qst_escort_lady"),
          (quest_slot_eq, "qst_escort_lady", slot_quest_target_center, "$g_encountered_party"),
          (quest_get_slot, ":quest_object_troop", "qst_escort_lady", slot_quest_object_troop),
          (modify_visitors_at_site,"scn_conversation_scene"),
          (reset_visitors),
          (set_visitor,0, "trp_player"),
          (set_visitor,17, ":quest_object_troop"),
          (set_jump_mission, "mt_conversation_encounter"),
          (jump_to_scene, "scn_conversation_scene"),
          (assign, "$talk_context", tc_entering_center_quest_talk),
          (change_screen_map_conversation, ":quest_object_troop"),
        (else_try),
          (check_quest_active, "qst_kidnapped_girl"),
          (quest_slot_eq, "qst_kidnapped_girl", slot_quest_giver_center, "$g_encountered_party"),
          (quest_slot_eq, "qst_kidnapped_girl", slot_quest_current_state, 3),
          (modify_visitors_at_site,"scn_conversation_scene"),
          (reset_visitors),
          (set_visitor,0, "trp_player"),
          (set_visitor,17, "trp_kidnapped_girl"),
          (set_jump_mission, "mt_conversation_encounter"),
          (jump_to_scene, "scn_conversation_scene"),
          (assign, "$talk_context", tc_entering_center_quest_talk),
          (change_screen_map_conversation, "trp_kidnapped_girl"),
##        (else_try),
##          (gt, "$lord_requested_to_talk_to", 0),
##          (store_current_hours, ":cur_hours"),
##          (neq, ":cur_hours", "$quest_given_time"),
##          (modify_visitors_at_site,"scn_conversation_scene"),
##          (reset_visitors),
##          (assign, ":cur_lord", "$lord_requested_to_talk_to"),
##          (assign, "$lord_requested_to_talk_to", 0),
##          (set_visitor,0,"trp_player"),
##          (set_visitor,17,":cur_lord"),
##          (set_jump_mission,"mt_conversation_encounter"),
##          (jump_to_scene,"scn_conversation_scene"),
##          (assign, "$talk_context", tc_castle_gate_lord),
##          (change_screen_map_conversation, ":cur_lord"),
        (else_try),
          (eq, "$g_town_visit_after_rest", 1),
          (assign, "$g_town_visit_after_rest", 0),
          (jump_to_menu,"mnu_town"),
        (else_try),
          (party_slot_eq,"$g_encountered_party", slot_town_lord, "trp_player"),
          (party_slot_eq,"$g_encountered_party", slot_party_type,spt_castle),
          (jump_to_menu, "mnu_enter_your_own_castle"),
        (else_try),
          (party_slot_eq,"$g_encountered_party", slot_party_type,spt_castle),
          (ge, "$g_encountered_party_relation", 0),
          (this_or_next|eq,"$castle_undefended",1),
          (eq, "$g_permitted_to_center",1),
          (jump_to_menu, "mnu_town"),
        (else_try),
          (party_slot_eq,"$g_encountered_party", slot_party_type,spt_town),
          (ge, "$g_encountered_party_relation", 0),
          (jump_to_menu, "mnu_town"),
        (else_try),
          (eq, "$g_player_besiege_town", "$g_encountered_party"),
          (jump_to_menu, "mnu_castle_besiege"),
        (try_end),
        ],
    [
#        ("talk_to_castle_commander",[
#            (party_get_num_companions, ":no_companions", "$g_encountered_party"),
#            (ge, ":no_companions", 1),
#            (eq,"$ruler_meeting_denied",0), #this variable is removed
#            ],
#        "Request a meeting with the lord of the castle.",[
#            (modify_visitors_at_site,"scn_conversation_scene"),(reset_visitors),
#            (set_visitor,0,"trp_player"),
#            (party_stack_get_troop_id, reg(6),"$g_encountered_party",0),
#            (party_stack_get_troop_dna,reg(7),"$g_encountered_party",0),
#            (set_visitor,17,reg(6),reg(7)),
#            (set_jump_mission,"mt_conversation_encounter"),
#            (jump_to_scene,"scn_conversation_scene"),
#            (assign, "$talk_context", tc_castle_commander),
#            (change_screen_map_conversation, reg(6))
#            ]),
      ("approach_gates",[(this_or_next|eq,"$entry_to_town_forbidden",1),
                          (party_slot_eq,"$g_encountered_party", slot_party_type,spt_castle)],
      "Approach the gates and hail the guard.",[
                                                  (jump_to_menu, "mnu_castle_guard"),
##                                                  (modify_visitors_at_site,"scn_conversation_scene"),(reset_visitors),
##                                                  (set_visitor,0,"trp_player"),
##                                                  (store_faction_of_party, ":cur_faction", "$g_encountered_party"),
##                                                  (faction_get_slot, ":cur_guard", ":cur_faction", slot_faction_guard_troop),
##                                                  (set_visitor,17,":cur_guard"),
##                                                  (set_jump_mission,"mt_conversation_encounter"),
##                                                  (jump_to_scene,"scn_conversation_scene"),
##                                                  (assign, "$talk_context", tc_castle_gate),
##                                                  (change_screen_map_conversation, ":cur_guard")
                                                  ]),
     
      ("town_sneak",[(party_slot_eq,"$g_encountered_party", slot_party_type,spt_town),
                    (eq,"$entry_to_town_forbidden",1),
                    (eq,"$cant_sneak_into_town",0)],
      "Disguise yourself and try to sneak into the town.",
      [
        (faction_get_slot, ":player_alarm", "$g_encountered_party_faction", slot_faction_player_alarm),
        (party_get_num_companions, ":num_men", "p_main_party"),
        (party_get_num_prisoners, ":num_prisoners", "p_main_party"),
        (val_add, ":num_men", ":num_prisoners"),
        (val_mul, ":num_men", 2),
        (val_div, ":num_men", 3),
        (store_add, ":get_caught_chance", ":player_alarm", ":num_men"),
        (store_random_in_range, ":random_chance", 0, 100),
        (try_begin),
          (this_or_next|ge, ":random_chance", ":get_caught_chance"),
          (eq, "$g_last_defeated_bandits_town", "$g_encountered_party"),
          (assign, "$g_last_defeated_bandits_town", 0),
          (assign, "$sneaked_into_town",1),
          (assign, "$town_entered", 1),
          (jump_to_menu,"mnu_sneak_into_town_suceeded"),
        (else_try),
          (jump_to_menu,"mnu_sneak_into_town_caught"),
        (try_end)
        ]),
      ("castle_start_siege",
      [
          (this_or_next|party_slot_eq, "$g_encountered_party", slot_center_is_besieged_by, -1),
          (            party_slot_eq, "$g_encountered_party", slot_center_is_besieged_by, "p_main_party"),
          (store_relation, ":reln", "$g_encountered_party_faction", "fac_player_supporters_faction"),
          (lt, ":reln", 0),
          (lt, "$g_encountered_party_2", 1),
          (call_script, "script_party_count_fit_for_battle","p_main_party"),
          (gt, reg(0), 5),
          (try_begin),
            (party_slot_eq, "$g_encountered_party", slot_party_type, spt_town),
            (assign, reg6, 1),
          (else_try),
            (assign, reg6, 0),
          (try_end),
          ],
      "Besiege the {reg6?town:castle}.",
      [
        (assign,"$g_player_besiege_town","$g_encountered_party"),
        (store_relation, ":relation", "fac_player_supporters_faction", "$g_encountered_party_faction"),
        (val_min, ":relation", -40),
        (call_script, "script_set_player_relation_with_faction", "$g_encountered_party_faction", ":relation"),
        (call_script, "script_update_all_notes"),
        (jump_to_menu, "mnu_castle_besiege"),
        ]),
Bear in mind this is just for castles.
I think the bit in red means if you have at least 6 men, you can besiege it.
And I *think* the bit in blue is the minimum relation you must have with the faction to besiege the castle, so if you set to 0, you *should* always be able to besiege them...
p.s. I'm new to this so I may be wrong (someone correct me)
 
Uhh let me think...are you sure you are besieging a castle, not a town?
also instead of this:  (gt, reg(0), 1), or  (gt, reg(0), 0),
put  (ge, reg(0), 0),
If it still doesn't work, I can't help you  :wink:
 
Thanks again for your input, but I tried different combinations. To no avail, nothing seemed to have changed, though it compiled just fine. I will keep searching for an answer. I realize that most on here think it's a ludicrous idea to go in without an army, I really don't care about that. I just want it to work.
 
Dragon_Lance 说:
Thanks again for your input, but I tried different combinations. To no avail, nothing seemed to have changed, though it compiled just fine. I will keep searching for an answer. I realize that most on here think it's a ludicrous idea to go in without an army, I really don't care about that. I just want it to work.
Sorry I can't help.
I don't think it's ludicrous, I go in with 10 guys, let them die then do it all my self (except I have teleportation and summoning spells and a sword that can kill 20 people at a time mwahahaha!)
 
后退
顶部 底部