Untitled

mail@pastecode.io avatar
unknown
python
2 months ago
11 kB
4
Indexable
Never
  (20, [
         (store_and, ":homes_fixed", "$first_time", first_time_fix_home_center),
        
      (try_for_parties, ":party_no"),
        (gt, ":party_no", "p_spawn_points_end"),
        #Splitting big deserters parties
        (store_party_size_wo_prisoners, ":party_count", ":party_no"),
        (store_faction_of_party, ":faction", ":party_no"),
        (try_begin),
          (eq, ":faction", "fac_deserters"),
		  (gt, ":party_count", 54),#JC	
          (try_begin),
            (gt, ":party_count", 1000),
            (neg|quest_slot_eq, "qst_blank_quest_4", slot_quest_target_party, ":party_no"),
            (neg|quest_slot_eq, "qst_track_down_bandits", slot_quest_target_party, ":party_no"),
            (remove_party, ":party_no"),
          (try_end),
          (gt, ":party_no", 0),
          
          (try_begin),
            (party_clear, "p_temp_party"),
            (party_clear, "p_temp_party_2"),
            (party_get_num_companion_stacks, ":num_stacks", ":party_no"),
            (try_for_range_backwards, ":cur_stack", 0, ":num_stacks"),
              (party_stack_get_troop_id, ":cur_troop_id", ":party_no", ":cur_stack"),
              (neg|troop_is_hero, ":cur_troop_id"),
              (party_stack_get_size, ":cur_size", ":party_no", ":cur_stack"),
              #(assign, reg44, ":cur_size"),
              #	(assign, reg45, ":cur_size"),
              #	(str_store_troop_name, s33, ":cur_troop_id"),
              #	(display_log_message, "@orig size is {reg44}, adjusted {reg45} of {s33}"),
              (store_party_size_wo_prisoners, ":new_party_count", "p_temp_party"),
              (store_party_size_wo_prisoners, ":new_party_count2", "p_temp_party_2"),
			  (party_remove_members, ":party_no", ":cur_troop_id", ":cur_size"),#remove first
			  (neq, ":cur_troop_id", "trp_looter_leader2"),
              (try_begin),
                (lt, ":new_party_count", 53),#JC was le 200
				(assign, ":delta_count", 0),
				(try_begin),
					(store_add, ":pot_count", ":new_party_count", ":cur_size"),#instead of adding a lot over the limit, only add up to 53
					(store_sub, ":delta_count", 53, ":pot_count"),
					(lt, ":delta_count", 0),
					(val_add, ":cur_size", ":delta_count"),
				(try_end),	                			
				(party_add_members, "p_temp_party", ":cur_troop_id", ":cur_size"),
				(try_begin),
					(lt, ":delta_count", 0),
					(lt, ":new_party_count2", 53),
					(store_mul, ":cur_size", ":delta_count", -1),#the rest can go here if there's space				
					(try_begin),
						(store_add, ":pot_count", ":new_party_count2", ":cur_size"),#instead of adding a lot over the limit, only add up to 53
						(store_sub, ":delta_count2", 53, ":pot_count"),
						(lt, ":delta_count2", 0),
						(val_add, ":cur_size", ":delta_count2"),
					(try_end),								
					(party_add_members, "p_temp_party_2", ":cur_troop_id", ":cur_size"),
				(try_end),		
              (else_try),
                (lt, ":new_party_count2",53),#JC was le 200					
				(try_begin),
					(store_add, ":pot_count", ":new_party_count2", ":cur_size"),#instead of adding a lot over the limit, only add up to 53
					(store_sub, ":delta_count", 53, ":pot_count"),
					(lt, ":delta_count", 0),
					(val_add, ":cur_size", ":delta_count"),
				(try_end),							
				(party_add_members, "p_temp_party_2", ":cur_troop_id", ":cur_size"),
              (end_try),
            (try_end),
            (try_begin),
              (party_get_num_prisoners , ":prisoners_count", ":party_no"),
              (gt, ":prisoners_count", 0),
              (store_div, ":prisoner_move", ":prisoners_count", 3),
              (party_get_num_prisoner_stacks, ":prisoner_stacks", ":party_no"),
              (try_for_range_backwards, ":prisoner_stack_no", 0, ":prisoner_stacks"),
                (party_prisoner_stack_get_troop_id, ":prisoner_troop_no", ":party_no", ":prisoner_stack_no"),
                (neg|troop_is_hero, ":prisoner_troop_no"),
                (party_prisoner_stack_get_size, ":prisoner_stack_size", ":party_no", ":prisoner_stack_no"),
                (try_begin),
                  (gt, ":prisoner_stack_size", ":prisoner_move"),
                  (assign, ":prisoner_stack_size", ":prisoner_move"),
                (try_end),
                (party_get_num_prisoners, ":prisoner_count1", "p_temp_party"),
                (party_get_num_prisoners, ":prisoner_count2", "p_temp_party_2"),
                #(assign, reg44, ":new_party_count"),
                (try_begin),
                  (le, ":prisoner_count1",":prisoner_move"),
                  (party_add_prisoners, "p_temp_party", ":prisoner_troop_no", ":prisoner_stack_size"),
                  (party_remove_prisoners, ":party_no", ":prisoner_troop_no", ":prisoner_stack_size"),
                (else_try),
                  (le, ":prisoner_count2",":prisoner_move"),
                  #(display_message, "@{reg44} is too high"),
                  (party_add_prisoners, "p_temp_party_2", ":prisoner_troop_no", ":prisoner_stack_size"),
                  (party_remove_prisoners, ":party_no", ":prisoner_troop_no", ":prisoner_stack_size"),
                (try_end),
              (try_end),
            (try_end),
            (try_begin),#JC added			
              (store_party_size_wo_prisoners, ":party_count1", "p_temp_party"),
			  # (assign, reg0, ":party_count1"),#JC TEST
			  # (display_message, "@p_temp_party1 size={reg0}"),#
              (gt,  ":party_count1", 0),			  
              #(store_random_in_range, ":spawn", "p_monasterio1", "p_yourlair"),#JC c/o
              #			(str_store_party_name, s33, ":spawn"),
              (set_spawn_radius, 4),
              (spawn_around_party,":party_no","pt_deserters"),#JC was (spawn_around_party, ":spawn", "pt_deserters"),
              (assign, ":new_party1", reg(0)),
              (call_script, "script_party_add_party", ":new_party1", "p_temp_party"),
              (party_set_faction, ":new_party1", "fac_deserters"),
              (party_get_position, pos0,  ":new_party1"),
              (party_set_ai_behavior, ":new_party1", ai_bhvr_patrol_location),
              (party_set_ai_patrol_radius, ":new_party1", 40),
              (party_set_ai_target_position, ":new_party1", pos0),
              (store_party_size_wo_prisoners, ":party_count1", ":new_party1"),
              (try_begin),
                (gt, ":party_count1", 25),
                (party_add_leader, ":new_party1", "trp_looter_leader2", 1),
              (try_end),
              #			(display_log_message,"@party broke apart near {s33}"),
			(try_end),#	
            (try_begin),
              (store_party_size_wo_prisoners, ":party_count2", "p_temp_party_2"),
			  # (assign, reg0, ":party_count2"),#JC TEST
			  # (display_message, "@p_temp_party2 size={reg0}"),#			  
              #				(assign, reg44, ":new_party_count"),
              #				(display_log_message, "@{reg44} is in temp2"),
              (gt,  ":party_count2", 0),
              #(store_random_in_range, ":spawn", "p_battle_stones", "p_bjorn_camp"),#JC c/o
              #				(str_store_party_name, s33, ":spawn"),
              (set_spawn_radius, 4),
              (spawn_around_party,":party_no","pt_deserters"),#JC was (spawn_around_party, ":spawn", "pt_deserters"),
              (assign, ":new_party2", reg(0)),
              (call_script, "script_party_add_party", ":new_party2", "p_temp_party_2"),
              (party_set_faction, ":new_party2", "fac_deserters"),
              (party_get_position, pos0,  ":new_party2"),
              (party_set_ai_behavior, ":new_party2", ai_bhvr_patrol_location),
              (party_set_ai_patrol_radius, ":new_party2", 40),
              (party_set_ai_target_position, ":new_party2", pos0),
              (store_party_size_wo_prisoners, ":party_count2", ":new_party2"),
              (try_begin),
                (gt, ":party_count2", 25),
                (party_add_leader, ":new_party2", "trp_looter_leader2", 1),
              (try_end),
              #				(display_log_message,"@party broke apart near {s33}"),
            (try_end),
			(remove_party, ":party_no"),#JC added
          (try_end),
          
                      #clean up small ship bandit parties -- there is no other mechanism that does this (like the one that sends routed enemies to nearest center)
        (else_try),
            (party_get_slot, ":spawn_point", ":party_no", slot_party_spawn_point),
            (is_between, ":spawn_point", spawn_points_begin, spawn_points_end),
            (party_get_slot, ":flags", ":spawn_point", slot_party_spawn_flags),
            (store_and, reg1, ":flags", spsf_seaborne),
            (neq, reg1, 0),
            (lt, ":party_count", 6),	#fishers are generally 3, but not always available to bandits
            (remove_party, ":party_no"),
            
          #VC-3825 just remove ghost parties here, as there are dozens of places where they could be made
        (else_try),
            (party_get_num_companion_stacks, reg4, ":party_no"),
            (gt, reg4, 0),
            
            (party_stack_get_troop_id, ":commander", ":party_no", 0),
            (is_between, ":commander", active_npcs_begin, active_npcs_end),
            
            (troop_get_slot, ":commander_party", ":commander", slot_troop_leaded_party),
            (neq, ":party_no", ":commander_party"),
            (remove_party, ":party_no"),
            
          #VC-3829 fix remnants of defeated factions
        (else_try),
            (eq, ":homes_fixed", 0),
            (party_get_slot, ":cur_center", ":party_no", slot_party_home_center),
            
            (try_begin),
              (is_between, ":cur_center", centers_begin, centers_end),
              (store_faction_of_party, ":cur_faction", ":cur_center"),
              (party_set_faction, ":party_no", ":cur_faction"),
              
            (else_try), #seek port
              (party_get_slot, ":cur_town", ":party_no", slot_party_port_party),
              (is_between, ":cur_town", walled_centers_begin, walled_centers_end),
              (party_set_slot, ":party_no", slot_party_home_center, ":cur_town"),
              
            (else_try), #seek fishermen, etc.
              (neq, ":cur_center", 0),
              (try_for_range, ":cur_town", walled_centers_begin, walled_centers_end), #have to do it this way because no way to distinguish inactive from invalid parties
                (party_get_slot, ":cur_port", ":cur_town", slot_party_port_party),
                (eq, ":cur_port", ":cur_center"),
                (store_faction_of_party, ":cur_faction", ":cur_town"),
                (party_set_faction, ":party_no", ":cur_faction"),
              (try_end),
            (try_end),
        (try_end),
      (try_end),
        
      (store_and, reg0, "$first_time", first_time_fix_ports),
      (try_begin),
        (neq, reg0, 0), #ports were fixed before this trigger was called?
        (val_or, "$first_time", first_time_fix_home_center),
      (try_end),
        
        (val_or, "$first_time", first_time_fix_ports),
    ]),
    #STrig 170
Leave a Comment