SP Tutorial Module System Customizable sparring matches

Users who are viewing this thread

Jinnai

Sergeant at Arms
So I got bored a couple weeks ago and wrote some code which has been immensely helpful in testing mission triggers and troop or item changes, so I thought I would share with everyone.

What this code does is let you create customizable sparring matches.  When you go to a town and talk to the arena master there will be a new option to spar with your troops.  You then get to select how many teams will be fighting (2 to 4) and you are assigned to the first team.  Then you get to choose which troops from your party will fill out the rest of each team with up to 8 people per team.  Once you've selected it all you get thrown into the arena and the battle commences.  No damage is permanent and everyone has their standard gear.  If the player is knocked out, the battle does not end, that way you can watch how the battle goes between the remaining troops.  Hit tab to end the scene.

The code segments below are in two colors.  The black text is what should already exist in your file, and will help people who don't fully understand the module system to place the new code correctly.  The blue text is what to add.

module_mission_templates.py:
    tournament_triggers
  ),

## Created a new template for sparring, just for simplicity - Jinnai
  ("arena_spar_fight",mtf_arena_fight,-1,
    "You enter a sparring match in the arena.",
    [
      (0,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (4,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (5,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (6,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),
      (7,mtef_visitor_source|mtef_team_0,0,aif_start_alarmed,1,[]),

      (8,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (9,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (10,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (11,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (12,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (13,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (14,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (15,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),

      (16,mtef_visitor_source|mtef_team_2,0,aif_start_alarmed,1,[]),
      (17,mtef_visitor_source|mtef_team_2,0,aif_start_alarmed,1,[]),
      (18,mtef_visitor_source|mtef_team_2,0,aif_start_alarmed,1,[]),
      (19,mtef_visitor_source|mtef_team_2,0,aif_start_alarmed,1,[]),
      (20,mtef_visitor_source|mtef_team_2,0,aif_start_alarmed,1,[]),
      (21,mtef_visitor_source|mtef_team_2,0,aif_start_alarmed,1,[]),
      (22,mtef_visitor_source|mtef_team_2,0,aif_start_alarmed,1,[]),
      (23,mtef_visitor_source|mtef_team_2,0,aif_start_alarmed,1,[]),

      (24,mtef_visitor_source|mtef_team_3,0,aif_start_alarmed,1,[]),
      (25,mtef_visitor_source|mtef_team_3,0,aif_start_alarmed,1,[]),
      (26,mtef_visitor_source|mtef_team_3,0,aif_start_alarmed,1,[]),
      (27,mtef_visitor_source|mtef_team_3,0,aif_start_alarmed,1,[]),
      (28,mtef_visitor_source|mtef_team_3,0,aif_start_alarmed,1,[]),
      (29,mtef_visitor_source|mtef_team_3,0,aif_start_alarmed,1,[]),
      (30,mtef_visitor_source|mtef_team_3,0,aif_start_alarmed,1,[]),
      (31,mtef_visitor_source|mtef_team_3,0,aif_start_alarmed,1,[]),

      (50, mtef_scene_source,af_override_horse|af_override_weapons|af_override_head,0,1,[]),
      (52, mtef_scene_source,af_override_horse,0,1,[]),
      (53, mtef_scene_source,af_override_horse,0,1,[]),
      (54, mtef_scene_source,af_override_horse,0,1,[]),
      (55, mtef_scene_source,af_override_horse,0,1,[]),
    ],
    [
    (ti_before_mission_start, 0, 0, [], [(call_script, "script_change_banners_and_chest")]),
    (ti_inventory_key_pressed, 0, 0, [(display_message,"str_cant_use_inventory_arena")], []),
    (ti_tab_pressed, 0, 0, [],
      [(question_box,"@End the sparring match?")]),
    (ti_question_answered, 0, 0, [],
      [(store_trigger_param_1,":answer"),
      (eq,":answer",0),
      (assign, "$g_mt_mode", abm_visit),
      (set_jump_mission, "mt_arena_melee_fight"),
      (party_get_slot, ":arena_scene", "$current_town", slot_town_arena),
      (modify_visitors_at_site, ":arena_scene"),
      (reset_visitors),
      (set_visitor, 35, "trp_veteran_fighter"),
      (set_visitor, 36, "trp_hired_blade"),
      (set_jump_entry, 50),
      (jump_to_scene, ":arena_scene"),
      ]),

    (0, 0, ti_once, [],
      [(play_sound, "snd_arena_ambiance", sf_looping),
    (call_script, "script_music_set_situation_with_culture", mtf_sit_arena),
      ]),

    (0.1, 0, 0, [],
      [
        (try_for_agents,":agent"),
          (agent_is_alive,":agent"),
          (agent_is_human,":agent"),
          (agent_get_position,pos1,":agent"),
          (position_set_z_to_ground_level, pos1),
          (agent_get_horse,":horse",":agent"),
          (try_begin),
            (gt,":horse",0),
            (position_move_z,pos1,300),
          (else_try),
            (position_move_z,pos1,225),
          (try_end),
          (agent_get_team, ":team", ":agent"),
          (try_begin),
            (eq,":team",0),
            (particle_system_burst,"psys_team_0",pos1,30),
          (else_try),
            (eq,":team",1),
            (particle_system_burst,"psys_team_1",pos1,30),
          (else_try),
            (eq,":team",2),
            (particle_system_burst,"psys_team_2",pos1,30),
          (else_try),
            (eq,":team",3),
            (particle_system_burst,"psys_team_3",pos1,30),
          (try_end),
        (try_end),
      ]),

    (1, 4, ti_once, [(num_active_teams_le, 1)],
      [
      (try_begin),
        (neg|main_hero_fallen),
        (call_script, "script_play_victorious_sound"),
      (try_end),
      (assign, "$g_mt_mode", abm_visit),
      (set_jump_mission, "mt_arena_melee_fight"),
      (party_get_slot, ":arena_scene", "$current_town", slot_town_arena),
      (modify_visitors_at_site, ":arena_scene"),
      (reset_visitors),
      (set_visitor, 35, "trp_veteran_fighter"),
      (set_visitor, 36, "trp_hired_blade"),
      (set_jump_entry, 50),
      (jump_to_scene, ":arena_scene"),
      ]),
    ],
  ),


  (
    "arena_challenge_fight",mtf_arena_fight|mtf_commit_casualties,-1,
    "You enter a melee fight in the arena.",
    [
      (56, mtef_visitor_source|mtef_team_0, 0, aif_start_alarmed, 1, []),
      (58, mtef_visitor_source|mtef_team_2, 0, aif_start_alarmed, 1, []),

module_dialogs.py: (Yeah I could have done some of this in a loop, but I didn't so people would be able to see what's going on easier)
  [anyone|plyr,"arena_master_talk", [], "About the melee fights...", "arena_master_melee_pretalk",[]],
  [anyone|plyr,"arena_master_talk", [(party_get_num_companions,":troops","p_main_party"),(gt,":troops",1)], "I would like to spar with some of my men.", "arena_master_spar_teams",[]], # Jinnai
  [anyone|plyr,"arena_master_talk", [(eq, "$arena_tournaments_asked", 0)], "Will there be a tournament in nearby towns soon?", "arena_master_ask_tournaments",[(assign, "$arena_tournaments_asked", 1)]],
  [anyone|plyr,"arena_master_talk", [], "I need to leave now. Good bye.", "close_window",[]],

## Arena sparring begin - Jinnai

  [anyone,"arena_master_spar_teams", [], "Certainly. The arena is currently available. Of course, you will have to supply your own gear, which means there will be no team uniforms.  But that aside, how many teams would you like?",
    "arena_master_spar_teams_choose",[(try_for_range,":slot",1,33),(troop_set_slot, "trp_temp_array_a", ":slot", -1),(try_end),(troop_set_slot, "trp_temp_array_a", 1, "trp_player"),(assign,"$temp",1)]],
  [anyone|plyr,"arena_master_spar_teams_choose", [], "Two.", "arena_master_spar_team_one",[(assign, "$g_tournament_next_num_teams", 2),]],
  [anyone|plyr,"arena_master_spar_teams_choose", [(party_get_num_companions,":troops","p_main_party"),(gt,":troops",2)], "Three.", "arena_master_spar_team_one",[(assign, "$g_tournament_next_num_teams", 3),]],
  [anyone|plyr,"arena_master_spar_teams_choose", [(party_get_num_companions,":troops","p_main_party"),(gt,":troops",3)], "Four.", "arena_master_spar_team_one",[(assign, "$g_tournament_next_num_teams", 4),]],
  [anyone|plyr,"arena_master_spar_teams_choose", [], "Never mind. I've changed my mind.", "arena_master_pre_talk",[]],

  [anyone,"arena_master_spar_team_one", [(eq,"$temp",:cool:], "Team One is full. Team Two is next.", "arena_master_spar_team_two",[(assign,"$temp",0)]],
  [anyone,"arena_master_spar_team_one", [(assign,reg0,"$temp"),(store_sub,reg1,reg0,1)], "There {reg1?are:is} currently {reg0} {reg1?troops:troop} on Team One.  Which troop would you like to add?", "arena_master_spar_team_one_choose",[]],
  [anyone|plyr|repeat_for_troops, "arena_master_spar_team_one_choose",
  [
    (store_repeat_object, ":troop"),
    (party_get_num_companion_stacks,":num_stacks","p_main_party"),
    (assign,":include",0),
    (try_for_range,":stack",0,":num_stacks"),
      (eq,":include",0),
      (party_stack_get_troop_id,":troop_id","p_main_party",":stack"),
      (ge,":troop_id",0),
      (eq,":troop_id",":troop"),
      (assign,":num_in",0),
      (try_for_range,":counting",1,33),
        (troop_get_slot,":already_in","trp_temp_array_a",":counting"),
        (eq,":already_in",":troop"),
        (val_add,":num_in",1),
      (try_end),
      (party_stack_get_size,":available","p_main_party",":stack"),
      (gt,":available",":num_in"),
      (assign,":include",1),
    (try_end),
    (eq,":include",1),
    (store_sub,reg0,":available",":num_in"),
    (str_store_troop_name,s11,":troop"),
    ],
  "{s11}. ({reg0} left.)", "arena_master_spar_team_one_add",
  [
    (store_repeat_object, "$temp_2"),
    (val_add,"$temp",1),
    (store_add,":eek:ffset","$temp",0),
    (troop_set_slot, "trp_temp_array_a", ":eek:ffset", "$temp_2"),
    (str_store_troop_name,s11,"$temp_2")
    ]],
  [anyone,"arena_master_spar_team_one_add", [], "{s11} has been added to Team One.", "arena_master_spar_team_one",[]],
  [anyone|plyr,"arena_master_spar_team_one_choose", [], "I am finished with Team One.  Let's move on to Team Two.", "arena_master_spar_team_two",[(assign,"$temp",0)]],
  [anyone|plyr,"arena_master_spar_team_one_choose", [], "Never mind. I'm calling the whole thing off.", "arena_master_pre_talk",[]],

  [anyone,"arena_master_spar_team_two", [(gt,"$g_tournament_next_num_teams",2),(eq,"$temp",:cool:], "Team Two is full. Team Three is next.", "arena_master_spar_team_three",[(assign,"$temp",0)]],
  [anyone,"arena_master_spar_team_two", [(eq,"$g_tournament_next_num_teams",2),(eq,"$temp",:cool:], "Team Two is full. Let the match begin!", "arena_master_spar_start_it_up",[]],
  [anyone,"arena_master_spar_team_two", [(assign,reg0,"$temp"),(store_sub,reg1,reg0,1)], "There {reg1?are:is} currently {reg0} {reg1?troops:troop} on Team Two.  Which troop would you like to add?", "arena_master_spar_team_two_choose",[]],
  [anyone|plyr|repeat_for_troops, "arena_master_spar_team_two_choose",
  [
    (store_repeat_object, ":troop"),
    (party_get_num_companion_stacks,":num_stacks","p_main_party"),
    (assign,":include",0),
    (try_for_range,":stack",0,":num_stacks"),
      (eq,":include",0),
      (party_stack_get_troop_id,":troop_id","p_main_party",":stack"),
      (ge,":troop_id",0),
      (eq,":troop_id",":troop"),
      (assign,":num_in",0),
      (try_for_range,":counting",1,33),
        (troop_get_slot,":already_in","trp_temp_array_a",":counting"),
        (eq,":already_in",":troop"),
        (val_add,":num_in",1),
      (try_end),
      (party_stack_get_size,":available","p_main_party",":stack"),
      (gt,":available",":num_in"),
      (assign,":include",1),
    (try_end),
    (eq,":include",1),
    (store_sub,reg0,":available",":num_in"),
    (str_store_troop_name,s11,":troop"),
    ],
  "{s11}. ({reg0} left.)", "arena_master_spar_team_two_add",
  [
    (store_repeat_object, "$temp_2"),
    (val_add,"$temp",1),
    (store_add,":eek:ffset","$temp",:cool:,
    (troop_set_slot, "trp_temp_array_a", ":eek:ffset", "$temp_2"),
    (str_store_troop_name,s11,"$temp_2")
    ]],
  [anyone,"arena_master_spar_team_two_add", [], "{s11} has been added to Team Two.", "arena_master_spar_team_two",[]],
  [anyone|plyr,"arena_master_spar_team_two_choose", [(gt,"$g_tournament_next_num_teams",2)], "I am finished with Team Two.  Let's move on to Team Three.", "arena_master_spar_team_three",[(assign,"$temp",0)]],
  [anyone|plyr,"arena_master_spar_team_two_choose", [(eq,"$g_tournament_next_num_teams",2)], "I am finished with Team Two.  Let's begin the match.", "arena_master_spar_start_it_up",[]],
  [anyone|plyr,"arena_master_spar_team_two_choose", [], "Never mind. I'm calling the whole thing off.", "arena_master_pre_talk",[]],

  [anyone,"arena_master_spar_team_three", [(gt,"$g_tournament_next_num_teams",3),(eq,"$temp",:cool:], "Team Three is full. Team Four is next.", "arena_master_spar_team_four",[(assign,"$temp",0)]],
  [anyone,"arena_master_spar_team_three", [(eq,"$g_tournament_next_num_teams",3),(eq,"$temp",:cool:], "Team Three is full. Let the match begin!", "arena_master_spar_start_it_up",[]],
  [anyone,"arena_master_spar_team_three", [(assign,reg0,"$temp"),(store_sub,reg1,reg0,1)], "There {reg1?are:is} currently {reg0} {reg1?troops:troop} on Team Three.  Which troop would you like to add?", "arena_master_spar_team_three_choose",[]],
  [anyone|plyr|repeat_for_troops, "arena_master_spar_team_three_choose",
  [
    (store_repeat_object, ":troop"),
    (party_get_num_companion_stacks,":num_stacks","p_main_party"),
    (assign,":include",0),
    (try_for_range,":stack",0,":num_stacks"),
      (eq,":include",0),
      (party_stack_get_troop_id,":troop_id","p_main_party",":stack"),
      (ge,":troop_id",0),
      (eq,":troop_id",":troop"),
      (assign,":num_in",0),
      (try_for_range,":counting",1,33),
        (troop_get_slot,":already_in","trp_temp_array_a",":counting"),
        (eq,":already_in",":troop"),
        (val_add,":num_in",1),
      (try_end),
      (party_stack_get_size,":available","p_main_party",":stack"),
      (gt,":available",":num_in"),
      (assign,":include",1),
    (try_end),
    (eq,":include",1),
    (store_sub,reg0,":available",":num_in"),
    (str_store_troop_name,s11,":troop"),
    ],
  "{s11}. ({reg0} left.)", "arena_master_spar_team_three_add",
  [
    (store_repeat_object, "$temp_2"),
    (val_add,"$temp",1),
    (store_add,":eek:ffset","$temp",16),
    (troop_set_slot, "trp_temp_array_a", ":eek:ffset", "$temp_2"),
    (str_store_troop_name,s11,"$temp_2")
    ]],
  [anyone,"arena_master_spar_team_three_add", [], "{s11} has been added to Team Three.", "arena_master_spar_team_three",[]],
  [anyone|plyr,"arena_master_spar_team_three_choose", [(gt,"$g_tournament_next_num_teams",3)], "I am finished with Team Three.  Let's move on to Team Four.", "arena_master_spar_team_four",[(assign,"$temp",0)]],
  [anyone|plyr,"arena_master_spar_team_three_choose", [(eq,"$g_tournament_next_num_teams",3)], "I am finished with Team Three.  Let's begin the match.", "arena_master_spar_start_it_up",[]],
  [anyone|plyr,"arena_master_spar_team_three_choose", [], "Never mind. I'm calling the whole thing off.", "arena_master_pre_talk",[]],

  [anyone,"arena_master_spar_team_four", [(eq,"$temp",:cool:], "Team Four is full. Let the match begin!", "arena_master_spar_start_it_up",[]],
  [anyone,"arena_master_spar_team_four", [(assign,reg0,"$temp"),(store_sub,reg1,reg0,1)], "There {reg1?are:is} currently {reg0} {reg1?troops:troop} on Team Four.  Which troop would you like to add?", "arena_master_spar_team_four_choose",[]],
  [anyone|plyr|repeat_for_troops, "arena_master_spar_team_four_choose",
  [
    (store_repeat_object, ":troop"),
    (party_get_num_companion_stacks,":num_stacks","p_main_party"),
    (assign,":include",0),
    (try_for_range,":stack",0,":num_stacks"),
      (eq,":include",0),
      (party_stack_get_troop_id,":troop_id","p_main_party",":stack"),
      (ge,":troop_id",0),
      (eq,":troop_id",":troop"),
      (assign,":num_in",0),
      (try_for_range,":counting",1,33),
        (troop_get_slot,":already_in","trp_temp_array_a",":counting"),
        (eq,":already_in",":troop"),
        (val_add,":num_in",1),
      (try_end),
      (party_stack_get_size,":available","p_main_party",":stack"),
      (gt,":available",":num_in"),
      (assign,":include",1),
    (try_end),
    (eq,":include",1),
    (store_sub,reg0,":available",":num_in"),
    (str_store_troop_name,s11,":troop"),
    ],
  "{s11}. ({reg0} left.)", "arena_master_spar_team_four_add",
  [
    (store_repeat_object, "$temp_2"),
    (val_add,"$temp",1),
    (store_add,":eek:ffset","$temp",24),
    (troop_set_slot, "trp_temp_array_a", ":eek:ffset", "$temp_2"),
    (str_store_troop_name,s11,"$temp_2")
    ]],
  [anyone,"arena_master_spar_team_four_add", [], "{s11} has been added to Team Four.", "arena_master_spar_team_four",[]],
  [anyone|plyr,"arena_master_spar_team_four_choose", [], "I am finished with Team Four.  Let's begin the match.", "arena_master_spar_start_it_up",[]],
  [anyone|plyr,"arena_master_spar_team_four_choose", [], "Never mind. I'm calling the whole thing off.", "arena_master_pre_talk",[]],

  [anyone,"arena_master_spar_start_it_up", [], "Here you go then. Good luck.", "close_window",
  [
    (party_get_slot, ":arena_scene", "$current_town", slot_town_arena),
    (modify_visitors_at_site, ":arena_scene"),
    (reset_visitors),
    (try_for_range,":num",1,33),
      (troop_get_slot,":troop","trp_temp_array_a",":num"),
      (ge,":troop",0),
      (store_sub,":eek:ffset",":num",1), #Oops, easier to add this than go back and fix all the other instances
      (set_visitor, ":eek:ffset", ":troop"),
    (try_end),
    (set_jump_mission, "mt_arena_spar_fight"),
    (jump_to_scene, ":arena_scene"),
    (change_screen_mission),
    ]],

## Arena sparring end


  [anyone,"arena_master_ask_tournaments", [], "{reg2?There won't be any tournaments any time soon.:{reg1?Tournaments are:A tournament is} going to be held at {s15}.}", "arena_master_talk",

module_particle_systems.py:
    ("game_water_splash_3", psf_emit_at_water_level , "prt_mesh_water_wave_1",
    5, 2.0, 0, 0.0, 10.0, 0.0,    #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
    (0.03, 0.2), (1, 0.0),        #alpha keys
    (1.0, 1.0), (1, 1.0),      #red keys
    (1.0, 1.0), (1, 1.0),      #green keys
    (1.0, 1.0), (1, 1.0),      #blue keys
    (0.0, 3),  (1.0, 10),  #scale keys
    (0.0, 0.0, 0.0),          #emit box size
    (0, 0, 0),                #emit velocity
    0.0,                      #emit dir randomness
    0,                      #rotation speed
    0.5                        #rotation damping
    ),

    ("team_0", psf_billboard_3d|psf_global_emit_dir|psf_always_emit, "prt_mesh_fire_1",
    50, 0.35, 0.2, 0.03, 10.0, 0.0,    #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
    (0.0, 0.:cool:, (1, 0),        #alpha keys
    (0.0, 0.1), (1, 0.:cool:,      #red keys
    (0.0, 0.0),(1, 0.0),      #green keys
    (0.0, 0), (1, 0.0),      #blue keys
    (0, 0.15),  (0.4, 0.3),  #scale keys
    (0.04, 0.04, 0.04),      #emit box size
    (0, 0, 0.5),              #emit velocity
    0.0,                      #emit dir randomness
    200,                      #rotation speed
    0.5                        #rotation damping
    ),

    ("team_1", psf_billboard_3d|psf_global_emit_dir|psf_always_emit, "prt_mesh_fire_1",
    50, 0.35, 0.2, 0.03, 10.0, 0.0,    #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
    (0.0, 0.:cool:, (1, 0),        #alpha keys
    (0.0, 0.0), (1, 0.0),      #red keys
    (0.0, 0.0),(1, 0.0),      #green keys
    (0.0, 1), (1, 0.:cool:,      #blue keys
    (0, 0.15),  (0.4, 0.3),  #scale keys
    (0.04, 0.04, 0.04),      #emit box size
    (0, 0, 0.5),              #emit velocity
    0.0,                      #emit dir randomness
    200,                      #rotation speed
    0.5                        #rotation damping
    ),

    ("team_2", psf_billboard_3d|psf_global_emit_dir|psf_always_emit, "prt_mesh_fire_1",
    50, 0.35, 0.2, 0.03, 10.0, 0.0,    #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
    (0.0, 0.:cool:, (1, 0),        #alpha keys
    (0.0, 0.0), (1, 0.0),      #red keys
    (0.0, 1),(1, 0.:cool:,      #green keys
    (0.0, 0), (1, 0.0),      #blue keys
    (0, 0.15),  (0.4, 0.3),  #scale keys
    (0.04, 0.04, 0.04),      #emit box size
    (0, 0, 0.5),              #emit velocity
    0.0,                      #emit dir randomness
    200,                      #rotation speed
    0.5                        #rotation damping
    ),

    ("team_3", psf_billboard_3d|psf_global_emit_dir|psf_always_emit, "prt_mesh_fire_1",
    50, 0.35, 0.2, 0.03, 10.0, 0.0,    #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
    (0.0, 0.:cool:, (1, 0),        #alpha keys
    (0.0, 1), (1, 0.:cool:,      #red keys
    (0.0, 1),(1, 0.:cool:,      #green keys
    (0.0, 1), (1, 0.:cool:,      #blue keys
    (0, 0.15),  (0.4, 0.3),  #scale keys
    (0.04, 0.04, 0.04),      #emit box size
    (0, 0, 0.5),              #emit velocity
    0.0,                      #emit dir randomness
    200,                      #rotation speed
    0.5                        #rotation damping
    ),

    ("torch_fire", psf_billboard_3d|psf_global_emit_dir|psf_always_emit|psf_randomize_size|psf_randomize_rotation, "prt_mesh_fire_1",
    50, 0.35, 0.2, 0.03, 10.0, 0.0,    #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
    (0.5, 0.:cool:, (1, 0),        #alpha keys
    (0.5, 1.0), (1, 0.9),      #red keys
    (0.5, 0.7),(1, 0.3),      #green keys
    (0.5, 0.2), (1, 0.0),      #blue keys
    (0, 0.15),  (0.4, 0.3),  #scale keys
    (0.04, 0.04, 0.01),      #emit box size
    (0, 0, 0.5),              #emit velocity
    0.0,                      #emit dir randomness
    200,                      #rotation speed
    0.5                        #rotation damping
    ),

I think those are the only three files you need to edit, but it's been a while since I wrote this.  Let me know if it works or if I left something out and I'll fix it.  And if I'm in a good mood later I'll even share the code I use to let the player move the camera around after death to watch the fight from a better view.

EDIT: I added little flame clouds above the heads of all combatants.  The colors depict what team they're on. The player is always red, but feel free to play around with the team colors in the particle system thingy.
 
Cool.

Today I looked at your reply to the FALCON PUNCH thread, and though, if you can make a constant particle system around a troop, could you not make something like a flag floating above thier heads to show which team they are part of?  Ya it is more fun if you don't know, but it would be nice to have a marker of some type.  Jut curious if this is possible, or is it only possible with particles?
 
The particle system for the falcon punch bit was by doing a burst every half second or so on the troop.  That's easy, just loop the agents and call the burst.  It's not a persistent item.  A marker over an NPC is an interesting idea, but requires generating static props, then linking those props to the agents (relatively easy using a slot), but then you need to update the locations of those props constantly and quickly.  Since you're limited to only 32 agents on the field it could probably work without a slowdown.  I'll look into it later tonight or tomorrow and see what I can come up with.
 
There you go, I added colored flames over the heads of all the living combatants which will reveal which team they're on.  That works a lot better than I expected, actually, and looks pretty cool at the same time.
 
well damn, you guys are coming up with some great scripts!  I added this to my star wars mod, very cool, thanks!



edit:  I wanted to remove the particle effects from the player so I added this code to the mission template.  It works fine but let me know if there is a better way I should be doing this...

Code:
    (0.1, 0, 0, [],
      [
	    (get_player_agent_no,":player_no"),		#added to get the player agent
        (try_for_agents,":agent"),
		  (neq,":agent",":player_no"),			#added so player won't have particle effects
          (agent_is_alive,":agent"),
          (agent_is_human,":agent"),
          (agent_get_position,pos1,":agent"),

Also, is there anyway to add a battle summary at the end or something like that?  Its somewhat weird how you just jump back to the tournament master.  Regardless, very cool tho.
 
That's exactly how I would remove it for the player.  I considered removing it as well, but figured I'd leave it in just to make it clear to the player which team they were on. :wink:
 
can you post your update?

I was thinking more of a 'ping' box that would appear every so often (sonar ping).  The flame thing seems kind of an overkill for what we are using it for.  A faded (alpha-ed) circle would have been good and less overhead.  Even a colored disc around the feet (like in EA sports games to denote which player you are controlling on the ice).

But I guess this works good.

Next you need on the field body looting!
 
Hokie, glad it worked for you.  I do love the look of your mod, it looks like you've changed almost everything about its appearance.

Post what update?  The flames over the heads is in there, I added that right after I made the post about the update.  I originally tried something on the ground like you describe, but the problem is it doesn't conform to the terrain, so large portions were hidden under hills and things due to rough terrain.  So I just went with the over the head method.

Martin: Thanks for the compliment.  Spawning a chest would be easy, linking the contents of the chest to the inventory of the defeated without having to create a TON of chest entries in the troops file would be a little more difficult.  I wonder if you could do it with props instead and just have the items themselves actually on the ground to be picked up like can happen with random gear after you kill someone.  Might look into it later.
 
I know I'm posting in a 182 day old thread, but I wanted to point out that the particle_system code comes up as invalid syntax when compiling.

Apart from that small issue, it works perfectly! Thanks.
 
Back
Top Bottom