OSP Code SP 1 vs 1 Tournament

Users who are viewing this thread

A minimod to make the tournament become 1 on 1 combat with per match bet system.
It also add hero that lead enemy troops on custom battles, and add quick tournament as a new game type on custom battle design.
Download Link
Source Code

Some screenshoot :
charts.jpg
npc.jpg
watching.jpg
Final.jpg
 
A little update. I forgot to reset the tournament participation  :oops:

Please edit these scripts :
Code:
# Open The Tournament 
("open_tournament",                
 [(store_script_param_1, ":center_no"),
  (try_begin),
     (party_slot_eq, ":center_no", slot_town_has_tournament, -1),
     (try_for_range, ":slot_no", 0, 64),
        (troop_set_slot, tournament_data, ":slot_no", 0),
     (try_end),
     (try_begin),
         (eq, "$g_tournament_winner", "trp_player"),
         (jump_to_menu,"mnu_town_tournament_won"),
     (else_try),
        (jump_to_menu,"mnu_town_tournament_won_by_another"),
     (try_end),        
   (else_try),
     (party_slot_ge, ":center_no", slot_town_has_tournament, 1),   
     (assign, "$g_tournament_town", ":center_no"),
     (party_set_slot, ":center_no", slot_town_has_tournament, 0),   
     (call_script, "script_seeding_tournament_participants"),
  (try_end), ]),

Code:
  # Adding tournaments to towns
  # Adding bandits to towns and villages
  (24,
   [(assign, ":num_active_tournaments", 0),
    (try_for_range, ":center_no", towns_begin, towns_end),
      (party_get_slot, ":has_tournament", ":center_no", slot_town_has_tournament),
      (try_begin),
        (eq, ":has_tournament", 1),#tournament ended, simulate
        (call_script, "script_fill_tournament_participants_troop", ":center_no", 0),
        (call_script, "script_sort_tournament_participant_troops"),#may not be needed
        (call_script, "script_get_num_tournament_participants"),
        (store_sub, ":needed_to_remove_randomly", reg0, 1),
        (call_script, "script_remove_tournament_participants_randomly", ":needed_to_remove_randomly"),
        (call_script, "script_sort_tournament_participant_troops"),
        (troop_get_slot, ":winner_troop", "trp_tournament_participants", 0),
        (try_begin),
          (is_between, ":winner_troop", active_npcs_begin, active_npcs_end),
          (str_store_troop_name_link, s1, ":winner_troop"),
          (str_store_party_name_link, s2, ":center_no"),
          (display_message, "@{s1} has won the tournament at {s2}."),
          (call_script, "script_change_troop_renown", ":winner_troop", 20),
        (try_end),
		# Dunde's Tournament #########################
		(try_for_range, ":slot_no", 0, 64),
           (troop_set_slot, tournament_data, ":slot_no", 0),  
        (try_end),
		##############################################
      (try_end),
      (val_sub, ":has_tournament", 1),
      (val_max, ":has_tournament", 0),
      (party_set_slot, ":center_no", slot_town_has_tournament, ":has_tournament"),
      (try_begin),
        (gt, ":has_tournament", 0),
        (val_add, ":num_active_tournaments", 1),
      (try_end),
    (try_end),
    
    (try_for_range, ":center_no", centers_begin, centers_end),
      (this_or_next|party_slot_eq, ":center_no", slot_party_type, spt_town),
      (party_slot_eq, ":center_no", slot_party_type, spt_village),
      (party_get_slot, ":has_bandits", ":center_no", slot_center_has_bandits),
      (try_begin),
        (le, ":has_bandits", 0),
        (assign, ":continue", 0),
        (try_begin),
          (check_quest_active, "qst_deal_with_night_bandits"),
          (quest_slot_eq, "qst_deal_with_night_bandits", slot_quest_target_center, ":center_no"),
          (neg|check_quest_succeeded, "qst_deal_with_night_bandits"),
          (assign, ":continue", 1),
        (else_try),
          (store_random_in_range, ":random_no", 0, 100),
          (lt, ":random_no", 3),
          (assign, ":continue", 1),
        (try_end),
        (try_begin),
          (eq, ":continue", 1),
          (store_random_in_range, ":random_no", 0, 3),
          (try_begin),
            (eq, ":random_no", 0),
            (assign, ":bandit_troop", "trp_bandit"),
          (else_try),
            (eq, ":random_no", 1),
            (assign, ":bandit_troop", "trp_mountain_bandit"),
          (else_try),
            (assign, ":bandit_troop", "trp_forest_bandit"),
          (try_end),
          (party_set_slot, ":center_no", slot_center_has_bandits, ":bandit_troop"),
          (try_begin),
            (eq, "$cheat_mode", 1),
            (str_store_party_name, s1, ":center_no"),
            (display_message, "@{!}{s1} is infested by bandits (at night)."),
          (try_end),
        (try_end),
      (else_try),
        (try_begin),
          (assign, ":random_chance", 40),
          (try_begin),
            (party_slot_eq, ":center_no", slot_party_type, spt_town),
            (assign, ":random_chance", 20),
          (try_end),
          (store_random_in_range, ":random_no", 0, 100),
          (lt, ":random_no", ":random_chance"),
          (party_set_slot, ":center_no", slot_center_has_bandits, 0),
          (try_begin),
            (eq, "$cheat_mode", 1),
            (str_store_party_name, s1, ":center_no"),
            (display_message, "@{s1} is no longer infested by bandits (at night)."),
          (try_end),
        (try_end),
      (try_end),
    (try_end),
	
    (try_for_range, ":faction_no", kingdoms_begin, kingdoms_end),
	  (faction_slot_eq, ":faction_no", slot_faction_ai_state, sfai_feast),
		
	  (faction_get_slot, ":faction_object", ":faction_no", slot_faction_ai_object),
	  (is_between, ":faction_object", towns_begin, towns_end),
	  
	  (party_slot_ge, ":faction_object", slot_town_has_tournament, 1),
	  #continue holding tournaments during the feast
      (party_set_slot, ":faction_object", slot_town_has_tournament, 2),
    (try_end),
	
	(try_begin),
      (lt, ":num_active_tournaments", 3),
      (store_random_in_range, ":random_no", 0, 100),
      #Add new tournaments with a 30% chance if there are less than 3 tournaments going on
      (lt, ":random_no", 30),
      (store_random_in_range, ":random_town", towns_begin, towns_end),
      (store_random_in_range, ":random_days", 12, 15),
      (party_set_slot, ":random_town", slot_town_has_tournament, ":random_days"),
      (try_begin),
        (eq, "$cheat_mode", 1),
        (str_store_party_name, s1, ":random_town"),
        (display_message, "@{!}{s1} is holding a tournament."),
      (try_end),
    (try_end),
    ]),

Edit : uploaded v0.11 to fix the bug.
 
What if we only have about 10 minutes free on our busy day, but we want to play WB just to kick and slash everyone there. Quick Battle is the answer, and it will be better if we can play a tournament there, turning WB to be tekken like game.
Here's WIP next version's feature : It's on the v0.2 now.
quick_battle.jpg


quick_tournament.jpg
 
how about tweak npc fight ability like they did on 1 of multiplayer servers("ndition" or smth like that)? So npc could block much more and faint much more. For this mode - must have
 
something error. I tried to add battle continuation before, and then I commented them. But I missed one line.
For anyone have downloaded the v0.2 source code, please add # on (else_try), here on module_presentations.py:
Code:
  # (else_try),    <------ This is the Error
        #(eq, ":object", "$g_presentation_obj_custom_battle_designer_26"),
        #(assign, "$g_battle_continuation", ":value"),
       #(presentation_set_duration, 0),

Sorry about that  :oops:

I have updated the files on repository with the fixed ones
 
Hello,

I'd like to use your minimpd in my mod but I just can't see the code you added or modified.
Could you please comment your modifs because I don't want to rebuuilt my entire mod which contains a lot of previous modifications.

Thanks
 
I think the jousting Tournaments should be open only to nobles and that they are wearing tournament plate armour as even with blunted lances the sheer forces will be lethal if you dont have the proper protection.
 
Dunde,

Aside modifications in tournament_*.py files, could you please indicate which *.py files you modified ?
And, could you tell me how I could make so the participants wear a different equipment than the standard one.

Thanks.
 
pino69 said:
Aside modifications in tournament_*.py files, could you please indicate which *.py files you modified ?

module_scripts.py and module_mission_templates.py. You can use notepad++, search for the keyword : dunde through all module_*.py to make it sure. And don't forget to add the import from tournament_*.py at related module_*.py.

pino69 said:
And, could you tell me how I could make so the participants wear a different equipment than the standard one.

Code:
      # Fighter 1
      (4,mtef_visitor_source|mtef_team_0,af_override_everything,aif_start_alarmed,1,[itm_arena_axe, itm_arena_tunic_red,itm_arena_helmet_red]),
      (4,mtef_visitor_source|mtef_team_0,af_override_everything,aif_start_alarmed,1,[itm_arena_sword,itm_arena_shield_red,itm_arena_tunic_red,itm_arena_helmet_red]),            
      (4,mtef_visitor_source|mtef_team_0,af_override_everything,aif_start_alarmed,1,[itm_arena_sword_two_handed,itm_arena_tunic_red,itm_arena_helmet_red]),
      (4,mtef_visitor_source|mtef_team_0,af_override_everything,aif_start_alarmed,1,[itm_practice_staff,itm_arena_tunic_red,itm_arena_helmet_red]),      
      (4,mtef_visitor_source|mtef_team_0,af_override_everything,aif_start_alarmed,1,[itm_arena_lance,itm_arena_shield_red,itm_practice_horse,itm_arena_tunic_red, itm_arena_helmet_red]),
      (4,mtef_visitor_source|mtef_team_0,af_override_everything,aif_start_alarmed,1,[itm_arena_sword_two_handed,itm_practice_horse,itm_arena_tunic_red,itm_arena_helmet_red]),
      (4,mtef_visitor_source|mtef_team_0,af_override_everything,aif_start_alarmed,1,[itm_practice_javelin,itm_practice_horse,itm_arena_tunic_red,itm_arena_helmet_red]),
      (4,mtef_visitor_source|mtef_team_0,af_override_everything,aif_start_alarmed,1,[itm_practice_javelin,itm_arena_tunic_red,itm_arena_helmet_red]),
      # Fighter 2
      (13,mtef_visitor_source|mtef_team_1,af_override_everything,aif_start_alarmed,1,[itm_arena_axe,itm_arena_tunic_blue,itm_arena_helmet_blue]),
      (13,mtef_visitor_source|mtef_team_1,af_override_everything,aif_start_alarmed,1,[itm_arena_sword,itm_arena_shield_blue,itm_arena_tunic_blue, itm_arena_helmet_blue]),
      (13,mtef_visitor_source|mtef_team_1,af_override_everything,aif_start_alarmed,1,[itm_arena_sword_two_handed,itm_arena_tunic_blue,itm_arena_helmet_blue]),
      (13,mtef_visitor_source|mtef_team_1,af_override_everything,aif_start_alarmed,1,[itm_practice_staff,itm_arena_tunic_blue,itm_arena_helmet_blue]),      
      (13,mtef_visitor_source|mtef_team_1,af_override_everything,aif_start_alarmed,1,[itm_arena_lance,itm_arena_shield_blue,itm_practice_horse,itm_arena_tunic_blue, itm_arena_helmet_blue]),
      (13,mtef_visitor_source|mtef_team_1,af_override_everything,aif_start_alarmed,1,[itm_arena_sword_two_handed,itm_practice_horse,itm_arena_tunic_blue,itm_arena_helmet_blue]),
      (13,mtef_visitor_source|mtef_team_1,af_override_everything,aif_start_alarmed,1,[itm_practice_javelin,itm_practice_horse,itm_arena_tunic_blue,itm_arena_helmet_blue]),       
      (13,mtef_visitor_source|mtef_team_1,af_override_everything,aif_start_alarmed,1,[itm_practice_javelin,itm_arena_tunic_blue,itm_arena_helmet_blue]),

That's the equipments list for fighter 1 and fighter 2. mission entry 1 and  9 for tournament type 1, entry 2 and 10 for tournament type 2. If you want the participants use their own gear, just replace af_override_everything.
 
Back
Top Bottom