OSP Code Combat Crouch Stance and Walking

Users who are viewing this thread

Hello =)

Im quite new to the whole module stuff and moding overall, so i have encountered a problem.

- add + crouching_triggers  to trigger list  of any mission templates you want to enable crouching

what am i supposed to do? i really can't understand what im supposed to do there (step 2).

 
Example, enable it on open battle (mst_lead_charge) :
Code:
  (
    "lead_charge",mtf_battle_mode|mtf_synch_inventory,charge,
    "You lead your men to battle.",
    [
     (1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
     (0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
     ],
    [
      (ti_on_agent_spawn, 0, 0, [],
       [
         (store_trigger_param_1, ":agent_no"),
         (call_script, "script_agent_reassign_team", ":agent_no"),

         (assign, ":initial_courage_score", 5000),
                  
         (agent_get_troop_id, ":troop_id", ":agent_no"),
         (store_character_level, ":troop_level", ":troop_id"),
         (val_mul, ":troop_level", 35),
         (val_add, ":initial_courage_score", ":troop_level"), #average : 20 * 35 = 700
         
         (store_random_in_range, ":randomized_addition_courage", 0, 3000), #average : 1500
         (val_add, ":initial_courage_score", ":randomized_addition_courage"), 
                   
         (agent_get_party_id, ":agent_party", ":agent_no"),         
         (party_get_morale, ":cur_morale", ":agent_party"),
         
         (store_sub, ":morale_effect_on_courage", ":cur_morale", 70),
         (val_mul, ":morale_effect_on_courage", 30), #this can effect morale with -2100..900
         (val_add, ":initial_courage_score", ":morale_effect_on_courage"), 
         
         #average = 5000 + 700 + 1500 = 7200; min : 5700, max : 8700
         #morale effect = min : -2100(party morale is 0), average : 0(party morale is 70), max : 900(party morale is 100)
         #min starting : 3600, max starting  : 9600, average starting : 7200
         (agent_set_slot, ":agent_no", slot_agent_courage_score, ":initial_courage_score"), 
         ]),

      common_battle_init_banner,
		 
      (ti_on_agent_killed_or_wounded, 0, 0, [],
       [
        (store_trigger_param_1, ":dead_agent_no"),
        (store_trigger_param_2, ":killer_agent_no"),
        (store_trigger_param_3, ":is_wounded"),

        (try_begin),
          (ge, ":dead_agent_no", 0),
          (neg|agent_is_ally, ":dead_agent_no"),
          (agent_is_human, ":dead_agent_no"),
          (agent_get_troop_id, ":dead_agent_troop_id", ":dead_agent_no"),
##          (str_store_troop_name, s6, ":dead_agent_troop_id"),
##          (assign, reg0, ":dead_agent_no"),
##          (assign, reg1, ":killer_agent_no"),
##          (assign, reg2, ":is_wounded"),
##          (agent_get_team, reg3, ":dead_agent_no"),          
          #(display_message, "@{!}dead agent no : {reg0} ; killer agent no : {reg1} ; is_wounded : {reg2} ; dead agent team : {reg3} ; {s6} is added"), 
          (party_add_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1), #addition_to_p_total_enemy_casualties
          (eq, ":is_wounded", 1),
          (party_wound_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1), 
        (try_end),

        (call_script, "script_apply_death_effect_on_courage_scores", ":dead_agent_no", ":killer_agent_no"),
       ]),

      common_battle_tab_press,

      (ti_question_answered, 0, 0, [],
       [(store_trigger_param_1,":answer"),
        (eq,":answer",0),
        (assign, "$pin_player_fallen", 0),
        (try_begin),
          (store_mission_timer_a, ":elapsed_time"),
          (gt, ":elapsed_time", 20),
          (str_store_string, s5, "str_retreat"),
          (call_script, "script_simulate_retreat", 10, 20, 1),
        (try_end),
        (call_script, "script_count_mission_casualties_from_agents"),
        (finish_mission,0),]),

      (ti_before_mission_start, 0, 0, [],
       [
         (team_set_relation, 0, 2, 1),
         (team_set_relation, 1, 3, 1),
         (call_script, "script_place_player_banner_near_inventory_bms"),

         (party_clear, "p_routed_enemies"),

         (assign, "$g_latest_order_1", 1), 
         (assign, "$g_latest_order_2", 1), 
         (assign, "$g_latest_order_3", 1), 
         (assign, "$g_latest_order_4", 1), 
         ]),

      
      (0, 0, ti_once, [], [(assign,"$g_battle_won",0),
                           (assign,"$defender_reinforcement_stage",0),
                           (assign,"$attacker_reinforcement_stage",0),
                           (call_script, "script_place_player_banner_near_inventory"),
                           (call_script, "script_combat_music_set_situation_with_culture"),
                           (assign, "$g_defender_reinforcement_limit", 2),
                           ]),

      common_music_situation_update,
      common_battle_check_friendly_kills,

      (1, 0, 5, [
                              
      #new (25.11.09) starts (sdsd = TODO : make a similar code to also helping ally encounters)
      #count all total (not dead) enemy soldiers (in battle area + not currently placed in battle area)
      (call_script, "script_party_count_members_with_full_health", "p_collective_enemy"),
      (assign, ":total_enemy_soldiers", reg0),
      
      #decrease number of agents already in battle area to find all number of reinforcement enemies
      (assign, ":enemy_soldiers_in_battle_area", 0),
      (try_for_agents,":cur_agent"),
        (agent_is_human, ":cur_agent"),
        (agent_get_party_id, ":agent_party", ":cur_agent"),
        (try_begin),
          (neq, ":agent_party", "p_main_party"),
          (neg|agent_is_ally, ":cur_agent"),
          (val_add, ":enemy_soldiers_in_battle_area", 1),
        (try_end),
      (try_end),
      (store_sub, ":total_enemy_reinforcements", ":total_enemy_soldiers", ":enemy_soldiers_in_battle_area"),

      (try_begin),
        (lt, ":total_enemy_reinforcements", 15),
        (ge, "$defender_reinforcement_stage", 2),
        (eq, "$defender_reinforcement_limit_increased", 0),
        (val_add, "$g_defender_reinforcement_limit", 1),                    
        (assign, "$defender_reinforcement_limit_increased", 1),
      (try_end),    
      #new (25.11.09) ends
      
      
      
      
      
      
      (lt,"$defender_reinforcement_stage","$g_defender_reinforcement_limit"),
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_defenders", 0),
                 (lt,":num_defenders",6)],
           [(add_reinforcements_to_entry,0,7),(assign, "$defender_reinforcement_limit_increased", 0),(val_add,"$defender_reinforcement_stage",1)]),
      
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_attackers", 1),
                 (lt,":num_attackers",6)],
           [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),

      common_battle_check_victory_condition,
      common_battle_victory_display,

      (1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (str_store_string, s5, "str_retreat"),
              (call_script, "script_simulate_retreat", 10, 20, 1),
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0)]),

      common_battle_inventory,


      #AI Triggers
      (0, 0, ti_once, [
          (store_mission_timer_a,":mission_time"),(ge,":mission_time",2),
          ],
       [(call_script, "script_select_battle_tactic"),
        (call_script, "script_battle_tactic_init"),
        #(call_script, "script_battle_calculate_initial_powers"), #deciding run away method changed and that line is erased
        ]),
      
      (3, 0, 0, [
          (call_script, "script_apply_effect_of_other_people_on_courage_scores"),
              ], []), #calculating and applying effect of people on others courage scores

      (3, 0, 0, [
          (try_for_agents, ":agent_no"),
            (agent_is_human, ":agent_no"),
            (agent_is_alive, ":agent_no"),          
            (store_mission_timer_a,":mission_time"),
            (ge,":mission_time",3),          
            (call_script, "script_decide_run_away_or_not", ":agent_no", ":mission_time"),
          (try_end),          
              ], []), #controlling courage score and if needed deciding to run away for each agent

      (5, 0, 0, [
          (store_mission_timer_a,":mission_time"),

          (ge,":mission_time",3),
          
          (call_script, "script_battle_tactic_apply"),
          ], []), #applying battle tactic

      common_battle_order_panel,
      common_battle_order_panel_tick,

    ] + crouching_triggers,
  ),
 
Put into "game_start" script at module_scripts.py :

(assign, "$key_crouch", key_caps_lock),
(assign,"$key_crouch_command",key_comma),
(assign,"$key_stand_command",key_period),

If you want fix key to do it, just replace "$key_crouch" with key_caps_lock directly. Using of global variable is to make it possible to remap.
 
Temp link for the custom animation stuff from the last version of Vision LE

http://www.mediafire.com/?ziwv645f188vty4
 
  Hail, there is a mistake for me :

Usage :
- put these mission template's triggers above mission_templates = [ at module_mission_templates.py
- add + crouching_triggers to trigger list  of any mission templates you want to enable crouching
- put these scripts to module_scripts.py

I just want to add an animation of crouching that allows players ( from MultiPlayer gamemode ) to crouch down and moove.
I didn't understand what is in red in the quoation, I mean that I don't understand at all where I am supposed to add the line "+ crouching_triggers" - in which mission templates ( module / ID / process / header ? ) and what is the line ?

Between, I want to use an other crouch animation, so I just have to change the name of the animation he used in his code, for the name of the other animation I use.

Plus there is something else :
Code:
player_crouch = (0, 0, 2,
  [(neg|main_hero_fallen),(key_clicked,"$key_crouch"),
   (get_player_agent_no, ":player_agent"), (agent_get_horse, ":horse", ":player_agent"), (le, ":horse", 0),
   (try_begin),
At "$key_crouch" , if I enter "C" intead of it, does the ingame key "C" when pressured will begins the animation ? Or do I have to leave it as "$key_crouch_C" or "$C" ?

Thank you.
 
  Okay, thanks if I understand, I have to modify
Code:
player_crouch = (0, 0, 2,
  [(neg|main_hero_fallen),(key_clicked,"$key_crouch"),
   (get_player_agent_no, ":player_agent"), (agent_get_horse, ":horse", ":player_agent"), (le, ":horse", 0),
   (try_begin),
into
Code:
player_crouch = (0, 0, 2,
  [(neg|main_hero_fallen),(key_clicked,"key_clicked,key_C"),
   (get_player_agent_no, ":player_agent"), (agent_get_horse, ":horse", ":player_agent"), (le, ":horse", 0),
   (try_begin),
if I want it as C for begins the animation.

PS : AAAH no ! I understood, it's :
Code:
player_crouch = (0, 0, 2,
  [(neg|main_hero_fallen),(key_clicked, key_c),
   (get_player_agent_no, ":player_agent"), (agent_get_horse, ":horse", ":player_agent"), (le, ":horse", 0),
   (try_begin),
 
    I don't understand a turtle of this, I really have tried ! Plus, it seems that there is not the animations in the brf given from the Module of the topic maker :
there is just the crouch_side animation, but not the 3 others ! (forward; the moovement from high to ground)
achier.png

And it seems that I have a syntax error for each line with "player_crouch = (0, 0, 2," when I add the code given in the module_mission_template with editing with IDLE.
achier3.png

achier4.png



_Am I supposed to find animation from somewhere else ?
_Can you tell me what I have to do for change the " = " syntax error ? I mean that I personally don't find it incorrect.

Thank you !
 
Ehh, the crouching animations *should* be in your CommonRes, so there won't be an issue loading them. (except the crouch_side.smd)

Otherwise, did you just post all of the code the way the instructions say? If not, that could be your syntax errors' source
 
    Here is the code I have entered into "module_mission_template" :
Code:
mission_templates = [
    player_crouch = (0, 0, 2,
  [(neg|main_hero_fallen),(key_clicked, key_c),
   (get_player_agent_no, ":player_agent"), (agent_get_horse, ":horse", ":player_agent"), (le, ":horse", 0),
   (try_begin),
   #pavise_related_things BEGIN
   #   (key_is_down, key_left_control),
   #   (call_script, "script_deploy_pavise", ":player_agent"),
   #(else_try),
   #pavise_related_things END
      (agent_get_slot, ":crouching", ":player_agent", slot_agent_crouching),
      (eq, ":crouching", 0),
      (agent_set_animation, ":player_agent", "anim_stand_to_crouch"),
      (agent_set_slot, ":player_agent", slot_agent_crouching, 1),
   (else_try),         
      (agent_set_animation, ":player_agent", "anim_crouch_to_stand"),
      (agent_set_slot, ":player_agent", slot_agent_crouching, 0),
   (try_end)], [])

crouching_command = (0, 0, 0, 
  [(neg|main_hero_fallen),
   (assign, ":command", -1),
   (try_begin),
     (key_clicked, key_o),
     #Pavise related things BEGIN
     #(try_begin),
     #   (key_is_down, key_left_control),
     #   (assign, ":command", 2),
     #(else_try),
     #Pavise related things END
        (assign, ":command", 1),
     #Pavise related things BEGIN
     #(try_end),   
     #Pavise related things END
   (else_try),
     (key_clicked, key_s),   
     (assign, ":command", 0),
   (try_end),
   (ge, ":command", 0),
   (call_script, "script_crouch_command", ":command"),], [])  
   
crouching_scan = (0, 0, 0,  [(call_script, "script_crouching_scan"),], [])

crouching_triggers = [player_crouch,crouching_command,crouching_scan]
  (
    "town_default",0,-1,
    "Default town visit",
That begins at    " player_crouch = (0, 0, 2,"  and finishs at " crouching_triggers = [player_crouch,crouching_command,crouching_scan]
  ("


The crouching animation should be in CommonRes, it's from Native ?

PS :  Ah yes I found it.
 
That's the problem. You have your sections of "player_crouch" underneath "mission_templates =" You have to put the crouch codes above the mission_templates section and then put "+ crouching_triggers," at the end of each template above the last bracket

@Animations
Yeah, all but crouch_side are a part of native. :smile:
 
    Hail ! That's the error message I have :
achier6.png
I have tried to find out the animations named "anim_walk_backward_crouch" , "anim_walk_right_crouch" , "anim_walk_left_crouch" , but I only have "anim_crouch_down" in CommonRes.

In the Harry's mod animations, there is the "crouch_side" animation, am I supposed to edit it and split it up into 3 other animations that I call  "walk_backward_crouch" , "walk_right_crouch" , "walk_left_crouch" and I add it into CommonRes and my module Ressource ?

PS : I have tried it by adding 3 news .brf files named "anim_walk_backward_crouch" , "anim_walk_right_crouch" , "anim_walk_left_crouch" ( and respective animations in its, without prefix "anim_" in their names ) but the message error didn't change, I am thinking that it comes from module_script.
 
Back
Top Bottom