Single Player Victory Cheer

Users who are viewing this thread

emw98

Recruit
Is there a way that I can make my player cheer during a battle? Breaks immersion when all I can do is go from low block to high block with a polearm lol :facepalm: thanks!
 
Hello,

For cheer animation with player, make a new trigger in mission_template.py. (appropriate mission template) or independant trigger

Inside the trigger.
Victory condition and the fonction animation for player agent.
Precise the key for activate the animation.

Greetings.
 
kozure okami said:
Hello,

For cheer animation with player, make a new trigger in mission_template.py. (appropriate mission template) or independant trigger

Inside the trigger.
Victory condition and the fonction animation for player agent.
Precise the key for activate the animation.

Greetings.
can you explain more  please thanks!
 
Hello imado552,

Here is my own script,
-------------------------------------------
animation_victoire = ( 0, 0, 4,
    [
      (key_clicked, key_k),
      (all_enemies_defeated, 5),          # si victoire
    ],
    [
      (get_player_agent_no,":player"),
      (agent_is_alive, ":player"),
      (agent_set_animation, ":player", "anim_cheer",1),
    ])

-------------------------------------------
The script is short and very practical. You can change the key_cliqued. You put this script inside your appropriate mission_template, or at the start of the file, before mission_template declaration. For the last choice, call the trigger inside your mission template :
animation_victoire,

Greetings,
 
Is it possible to make it so that when pressed the key again it stops playing the animation? I ask because I'm tweaking it to give morale bonus to friendly units mid battle.
 
Aruda said:
Is it possible to make it so that when pressed the key again it stops playing the animation? I ask because I'm tweaking it to give morale bonus to friendly units mid battle.

you can use a key for that

you can set a timer (keep repeating/loop for 10 sec, etc)

and so on


check tutorial on triggers and read the comments on the header_operations.py section related to animations. You should get Lav's modsys as that one has a better documented file (easier to understand).
 
Sorry to necro the thread but can I have a more clear tutorial on this?
I added the code to module_mission_templates, but when I try to compile the module, it gives me an error.
Where do I put the code? Exactly?
Thanks!
 
PitchPL said:
what error, where you put it...

I put it into module_mission_templates.py, right after mission_templates = [.
Here's the error:
Loading module... FAILED.
MODULE `mission_templates` ERROR:
Traceback (most recent call last):
  File "compile.py", line 95, in <module>
    from module_mission_templates import *
  File "C:\Users\home\Desktop\warband modding\Red Stars - Awra\Module_system 1.1
66\module_mission_templates.py", line 1269
    animation_victoire = ( 0, 0, 4,
                              ^
SyntaxError: invalid syntax


COMPILATION FAILED.
It's not the 'victoire' part, because I tried changing it to 'victory' and I still got this error.
 
put it after

Code:
pilgrim_disguise = [itm_pilgrim_hood,itm_pilgrim_disguise,itm_practice_staff, itm_throwing_daggers]
af_castle_lord = af_override_horse | af_override_weapons| af_require_civilian

in module_mission_templates.py


This should looks like that


Code:
pilgrim_disguise = [itm_pilgrim_hood,itm_pilgrim_disguise,itm_practice_staff, itm_throwing_daggers]
af_castle_lord = af_override_horse | af_override_weapons| af_require_civilian



animation_victoire = ( 0, 0, 4,
    [
       (key_clicked, key_k),
       (all_enemies_defeated, 5),          # si victoire
    ],
    [
       (get_player_agent_no,":player"),
       (agent_is_alive, ":player"),
       (agent_set_animation, ":player", "anim_cheer",1),
    ])



Keep in mind that you need add this triger somewhere. So find


Code:
    "lead_charge",mtf_battle_mode|mtf_synch_inventory,charge,
    "You lead your men to battle.",



Under  common_battle_init_banner,  add

animation_victoire,



This should look like this;



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,
      animation_victoire,




Last thing you need to  do is ... read modding tutorials.


 
And to play sound you can add this to your code  :fruity::

animation_victoire = ( 0, 0, 4,
    [
      (key_clicked, key_k),
      (all_enemies_defeated, 5),          # si victoire
    ],
    [
      (get_player_agent_no, ":player"),
      (agent_is_alive, ":player"),
      (agent_set_animation, ":player", "anim_cheer", 1),

      (try_begin),
          (eq, "$character_gender", tf_female),
          (agent_play_sound, ":player", "snd_woman_yell"),
      (else_try),
          (agent_play_sound, ":player", "snd_man_victory"),
      (try_end),

    ])

 
PitchPL said:
put it after

Code:
pilgrim_disguise = [itm_pilgrim_hood,itm_pilgrim_disguise,itm_practice_staff, itm_throwing_daggers]
af_castle_lord = af_override_horse | af_override_weapons| af_require_civilian

in module_mission_templates.py


This should looks like that


Code:
pilgrim_disguise = [itm_pilgrim_hood,itm_pilgrim_disguise,itm_practice_staff, itm_throwing_daggers]
af_castle_lord = af_override_horse | af_override_weapons| af_require_civilian



animation_victoire = ( 0, 0, 4,
    [
       (key_clicked, key_k),
       (all_enemies_defeated, 5),          # si victoire
    ],
    [
       (get_player_agent_no,":player"),
       (agent_is_alive, ":player"),
       (agent_set_animation, ":player", "anim_cheer",1),
    ])



Keep in mind that you need add this triger somewhere. So find


Code:
    "lead_charge",mtf_battle_mode|mtf_synch_inventory,charge,
    "You lead your men to battle.",



Under  common_battle_init_banner,  add

animation_victoire,



This should look like this;



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,
      animation_victoire,




Last thing you need to  do is ... read modding tutorials.
Kinda late reply on my part, but thanks :grin:
 
Back
Top Bottom