OSP Kit Combat Battlefield Tactics kit. Multiple formations per team+command revamp!

Users who are viewing this thread

Do I have to replace all the txt files except mission templates and scripts even if I'm using the formation on pure Native?
 
No, I'm certain there's ones you don't have to replace. That's simply what I did to get it to work. Your results may vary.
 
Ah, so you have a separate folder for compiling the the module systems into, instead of the Native folder itself.

Trying now.
 
Cloud Breaker said:
Ah, so you have a separate folder for compiling the the module systems into, instead of the Native folder itself.

Trying now.

http://forums.taleworlds.com/index.php/topic,5408.0.html
 
What do you want me to know?

My default folder in module_info isn't set to the Native folder. I compile the module system into a separate folder then paste it onto the Native folder. Just my way of knowing when each of my files were modified, because the module system update all the files' date.
 
I got it to work, no worries. You can mess with Native, if you have a back up.

The scene files for the new modules use up too much space.
 
I HATE the fact that cavalry dismounts if they are fewer than infantry. I deleted all the lines I considered were related to this, but they still do it, I must be missing some  :mad:
 
Hi, guys

I need some help if you please...

I have version 1.011. I downloaded the Module  System, installed Python, everything is looking good. Inserted the provided string into mission templates and scripts, but the darn thing does not compile well:

Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 11, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 59, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
  File "process_scene_props.py", line 7, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 6, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Exporting quest data...
Traceback (most recent call last):
  File "process_scripts.py", line 4, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Traceback (most recent call last):
  File "process_game_menus.py", line 8, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Traceback (most recent call last):
  File "process_simple_triggers.py", line 5, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Traceback (most recent call last):
  File "process_dialogs.py", line 9, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "H:\ModuleSystem\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "H:\ModuleSystem\module_scripts.py", line 11978, in <module>
    (troop_get_xp, ":mad:p", ":troop"),
NameError: name 'troop_get_xp' is not defined

______________________________

Script processing has ended.
Press any key to exit. . .

This is my missions_template:

from header_common import *
from header_operations import *
from header_mission_templates import *
from header_animations import *
from module_constants import *

####################################################################################################################
#  Each mission-template is a tuple that contains the following fields:
#  1) Mission-template id (string): used for referencing mission-templates in other files.
#    The prefix mt_ is automatically added before each mission-template id
#
#  2) Mission-template flags (int): See header_mission-templates.py for a list of available flags
#  3) Mission-type(int): Which mission types this mission template matches.
#    For mission-types to be used with the default party-meeting system,
#    this should be 'charge' or 'charge_with_ally' otherwise must be -1.
#   
#  4) Mission description text (string).
#  5) List of spawn records (list): Each spawn record is a tuple that contains the following fields:
#    5.1) entry-no: Troops spawned from this spawn record will use this entry
#    5.2) spawn flags.
#    5.3) alter flags. which equipment will be overriden
#    5.4) ai flags.
#    5.5) Number of troops to spawn.
#    5.6) list of equipment to add to troops spawned from here (maximum :cool:.
#  6) List of triggers (list).
#    See module_triggers.py for infomation about triggers.
#
#  Please note that mission templates is work in progress and can be changed in the future versions.
#
####################################################################################################################

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

mission_templates = [
  (
    "town_default",0,-1,
    "Default town visit",
    [(0,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
    (1,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),(2,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),(3,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),(4,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),(5,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),(6,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),(7,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
    (8,mtef_scene_source,af_override_horse,0,1,[]),(9,mtef_scene_source,af_override_horse,0,1,[]),(10,mtef_scene_source,af_override_horse,0,1,[]),(11,mtef_scene_source,af_override_horse,0,1,[]),
    (12,mtef_scene_source,af_override_horse,0,1,[]),(13,mtef_scene_source,0,0,1,[]),(14,mtef_scene_source,0,0,1,[]),(15,mtef_scene_source,0,0,1,[]),
    (16,mtef_visitor_source,af_override_horse,0,1,[]),(17,mtef_visitor_source,af_override_horse,0,1,[]),(18,mtef_visitor_source,af_override_horse,0,1,[]),(19,mtef_visitor_source,af_override_horse,0,1,[]),(20,mtef_visitor_source,af_override_horse,0,1,[]),(21,mtef_visitor_source,af_override_horse,0,1,[]),(22,mtef_visitor_source,af_override_horse,0,1,[]),(23,mtef_visitor_source,af_override_horse,0,1,[]),(24,mtef_visitor_source,af_override_horse,0,1,[]),
    (25,mtef_visitor_source,af_override_horse,0,1,[]),(26,mtef_visitor_source,af_override_horse,0,1,[]),(27,mtef_visitor_source,af_override_horse,0,1,[]),(28,mtef_visitor_source,af_override_horse,0,1,[]),(29,mtef_visitor_source,af_override_horse,0,1,[]),(30,mtef_visitor_source,af_override_horse,0,1,[]),(31,mtef_visitor_source,af_override_horse,0,1,[])
    ],
    [
      (1, 0, ti_once, [], [
          (store_current_scene, ":cur_scene"),
          (scene_set_slot, ":cur_scene", slot_scene_visited, 1),
        ]),
      (ti_before_mission_start, 0, 0, [], [(call_script, "script_change_banners")]),
      (ti_inventory_key_pressed, 0, 0, [(set_trigger_result,1)], []),
      (ti_tab_pressed, 0, 0, [(set_trigger_result,1)], []),
    ],
  ),


  .....................
  .....................
  .....................
  .....................
  .....................

  (
    "custom_battle_5",mtf_battle_mode,-1,
    "You lead your men to battle.",
    [
      (0,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (4,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (5,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (6,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),
      (7,mtef_visitor_source|mtef_team_0,af_override_horse,aif_start_alarmed,1,[]),

      (8,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (9,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (10,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (11,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (12,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (13,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (14,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
      (15,mtef_visitor_source|mtef_team_1,af_override_horse,aif_start_alarmed,1,[]),
    ],
    [
               
      (ti_tab_pressed, 0, 0, [],
      [(question_box,"str_give_up_fight")]),

      (ti_question_answered, 0, 0, [],
      [(store_trigger_param_1,":answer"),
        (eq,":answer",0),
        (assign, "$g_battle_result", -1),
        (assign, "$g_custom_battle_team1_death_count", 0),
        (assign, "$g_custom_battle_team2_death_count", 0),
        (try_for_agents, ":cur_agent"),
          (agent_is_human, ":cur_agent"),
          (neg|agent_is_alive, ":cur_agent"),
          (agent_get_team, ":cur_team", ":cur_agent"),
          (try_begin),
            (eq, ":cur_team", 0),
            (val_add, "$g_custom_battle_team1_death_count", 1),
          (else_try),
            (val_add, "$g_custom_battle_team2_death_count", 1),
          (try_end),
        (try_end),
        (finish_mission),]),
 
      (ti_inventory_key_pressed, 0, 0, [(display_message,"str_cant_use_inventory_now")], []),

      (1, 4, ti_once, [(this_or_next|main_hero_fallen),(num_active_teams_le,1)],
      [
          (assign,"$g_battle_result",0),
          (try_begin),
            (neg|main_hero_fallen),
            (assign,"$g_battle_result",1),
          (else_try),
            (assign,"$g_battle_result",-1),
          (try_end),
          (assign, "$g_custom_battle_team1_death_count", 0),
          (assign, "$g_custom_battle_team2_death_count", 0),
          (try_for_agents, ":cur_agent"),
            (agent_is_human, ":cur_agent"),
            (neg|agent_is_alive, ":cur_agent"),
            (agent_get_team, ":cur_team", ":cur_agent"),
            (try_begin),
              (eq, ":cur_team", 0),
              (val_add, "$g_custom_battle_team1_death_count", 1),
            (else_try),
              (val_add, "$g_custom_battle_team2_death_count", 1),
            (try_end),
          (try_end),
          (finish_mission),
          ]),

      #AI Tiggers
      (0, 0, ti_once, [
          (assign, "$ai_team", 1),
          (team_give_order, "$ai_team", grc_infantry, mordr_stand_closer),
          (team_give_order, "$ai_team", grc_infantry, mordr_stand_closer),
          (team_give_order, "$ai_team", grc_archers, mordr_stand_ground),
          (entry_point_get_position,pos8,:cool:,
          (team_give_order, "$ai_team", grc_infantry, mordr_hold),
          (team_set_order_position, "$ai_team", grc_everyone, pos:cool:,
          ], []),
     
      (5, 0, 0, [], [ #Make sure attackers do not stall on the ladders...
          (assign, "$attacker_team", 0),
          (try_for_agents, ":agent_no"),
            (agent_is_human, ":agent_no"),
            (agent_is_alive, ":agent_no"),
            (agent_get_team, ":agent_team", ":agent_no"),
            (eq, "$attacker_team", ":agent_team"),
            (agent_ai_set_always_attack_in_melee, ":agent_no", 1),
          (try_end),
          ]),
#refill ammo of defenders every two minutes.
      (120, 0, 0, [], [
                      (assign, "$defender_team", 1),
                      (try_for_agents,":cur_agent"),
                        (agent_get_team, ":agent_team", ":cur_agent"),
                        (eq, "$defender_team", ":agent_team"),
                        (agent_is_alive, ":cur_agent"),
                        (agent_is_human, ":cur_agent"),
                        (agent_refill_ammo, ":cur_agent"),
                      (try_end)]),
     
    ],
  ),
 
######Tactical triggers below##########

(ti_before_mission_start, 0, 0, [],
  [ (assign,"$formation",0),
    (assign,"$infantryformationtype",0),
    (assign,"$archerformationtype",0),
    (assign,"$cavalryformationtype",0),]),


    (0, 0, 0,
      [(key_clicked, key_2),     
      (assign,"$formation",grc_infantry),
        ], []),
    (0, 0, 0,
      [(key_clicked, key_3),     
      (assign,"$formation",grc_archers),
        ], []),
    (0, 0, 0,
      [(key_clicked, key_4),     
      (assign,"$formation",grc_cavalry),
        ], []),


    (0, 0, 0,
      [(key_clicked, key_j),     
      (get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (assign,reg1,"$formation"),
      (call_script,"script_cf_formation"),
      (try_begin),
          (eq,"$formation",grc_infantry),
          (assign,"$infantryformationtype",1),
      (else_try),
          (eq,"$formation",grc_archers),
          (assign,"$archerformationtype",1),
      (else_try),
          (eq,"$formation",grc_cavalry),
          (assign,"$cavalryformationtype",1),
      (end_try),
      (display_message,"@Forming_ranks."),
        ], []),

    (0, 0, 0,
      [(key_clicked, key_p),     
      (get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (assign,reg1,"$formation"),
      (call_script,"script_cf_formation_stagger"),
      (call_script,"script_cf_formation"),
      (try_begin),
          (eq,"$formation",grc_infantry),
          (assign,"$infantryformationtype",3),
      (else_try),
          (eq,"$formation",grc_archers),
          (assign,"$archerformationtype",3),
      (else_try),
          (eq,"$formation",grc_cavalry),
          (assign,"$cavalryformationtype",3),
      (end_try),
      (display_message,"@Forming_a_line."),
        ], []),

    (0, 0, 0,
      [(key_clicked, key_k),     
      (get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (assign,reg1,"$formation"),
      (call_script,"script_cf_formation_wedge"),
      (call_script,"script_cf_formation"),
      (try_begin),
          (eq,"$formation",grc_infantry),
          (assign,"$infantryformationtype",2),
      (else_try),
          (eq,"$formation",grc_archers),
          (assign,"$archerformationtype",2),
      (else_try),
          (eq,"$formation",grc_cavalry),
          (assign,"$cavalryformationtype",2),
      (end_try),
      (display_message,"@Forming_a_wedge."),
        ], []),

    (0, 0, 0,
      [(key_clicked, key_u),     
      (get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (assign,reg1,"$formation"),
      (call_script,"script_formation_end"),
      (call_script,"script_cf_formation"),
      (try_begin),
          (eq,"$formation",grc_infantry),
          (assign,"$infantryformationtype",0),
      (else_try),
          (eq,"$formation",grc_archers),
          (assign,"$archerformationtype",0),
      (else_try),
          (eq,"$formation",grc_cavalry),
          (assign,"$cavalryformationtype",0),
      (end_try),
      (display_message,"@Formation_disassembled."),
        ], []),

    (5.0, 0, 0,
      [(try_for_agents,":agent"),
        (agent_is_human,":agent"),
        (neg|agent_is_ally,":agent"),
        (assign,":enemy",":agent"),
      (end_try),
      (gt,":enemy",-1),
      (agent_get_team  ,reg0, ":enemy"),
      (assign,reg1,grc_cavalry),
      (call_script,"script_formation_end"),
      (assign,reg1,grc_infantry),
      (call_script,"script_formation_end"),
      (assign,reg1,grc_archers),
      (call_script,"script_formation_end"),], []),

    (5.0, 0, 0,
      [(assign,":enemy",-1),
      (assign,":infantry",0),
      (assign,":cavalry",0),
      (try_for_agents,":agent"),
        (agent_is_human,":agent"),
        (agent_is_alive,":agent"),
        (neg|agent_is_ally,":agent"),
        (assign,":enemy",":agent"),
        (agent_get_class ,":class", ":agent"),
        (try_begin),
            (eq,":class",grc_cavalry),
            (val_add,":cavalry",1),
        (else_try),
            (val_add,":infantry",1),
        (end_try),
      (end_try),
      (gt,":enemy",-1),
      (agent_get_team  ,reg0, ":enemy"),
      (assign,":ratio",":infantry"),
      (val_div,":ratio",":cavalry"),
      (try_begin),
        (gt,":ratio",2),
        (lt,":cavalry",10),
        (team_give_order, reg0, grc_everyone, mordr_dismount),
      (else_try),
        (team_give_order, reg0, grc_everyone, mordr_mount),
      (end_try),], []),


    (5.0, 0, 0,
      [(get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (val_add,reg0,2),
      (assign,reg1,grc_cavalry),
      (call_script,"script_formation_end"),
      (assign,reg1,grc_infantry),
      (call_script,"script_formation_end"),
      (assign,reg1,grc_archers),
      (call_script,"script_formation_end"),], []),

    (5.0, 0, 0,
      [(neq, "$battle_won", 1),
      (assign,":infantry",0),
      (assign,":cavalry",0),
      (get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (val_add,reg0,2),
      (try_for_agents,":agent"),
        (agent_is_human,":agent"),
        (agent_is_alive,":agent"),
        (agent_get_team  ,":team", ":agent"),
        (eq,":team",reg0),
        (agent_get_class ,":class", ":agent"),
        (try_begin),
            (eq,":class",grc_cavalry),
            (val_add,":cavalry",1),
        (else_try),
            (val_add,":infantry",1),
        (end_try),
      (end_try),
      (assign,":ratio",":infantry"),
      (val_div,":ratio",":cavalry"),
      (try_begin),
        (gt,":ratio",2),
        (lt,":cavalry",10),
        (team_give_order, reg0, grc_everyone, mordr_dismount),
      (else_try),
        (team_give_order, reg0, grc_everyone, mordr_mount),
      (end_try),], []),

    (0.2, 0, 0,
      [(get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (assign,reg1,grc_infantry),
      (try_begin),
          (eq,"$infantryformationtype",1),
          (call_script,"script_cf_formation"),
      (else_try),
          (eq,"$infantryformationtype",2),
          (call_script,"script_cf_formation_wedge"),
      (else_try),
          (eq,"$infantryformationtype",3),
          (call_script,"script_cf_formation_stagger"),
      (else_try),
          (call_script,"script_formation_end"),
      (end_try),], []),

    (0.2, 0, 0,
      [(get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (assign,reg1,grc_archers),
      (try_begin),
          (eq,"$archerformationtype",1),
          (call_script,"script_cf_formation"),
      (else_try),
          (eq,"$archerformationtype",2),
          (call_script,"script_cf_formation_wedge"),
      (else_try),
          (eq,"$archerformationtype",3),
          (call_script,"script_cf_formation_stagger"),
      (else_try),
          (call_script,"script_formation_end"),
      (end_try),], []),

    (0.2, 0, 0,
      [(get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (assign,reg1,grc_cavalry),
      (try_begin),
          (eq,"$cavalryformationtype",1),
          (call_script,"script_cf_formation"),
      (else_try),
          (eq,"$cavalryformationtype",2),
          (call_script,"script_cf_formation_wedge"),
      (else_try),
          (eq,"$cavalryformationtype",3),
          (call_script,"script_cf_formation_stagger"),
      (else_try),
          (call_script,"script_formation_end"),
      (end_try),], []),

    (0.2, 0, 0,
      [(try_for_agents,":agent"),
        (agent_is_human,":agent"),
        (neg|agent_is_ally,":agent"),
        (assign,":enemy",":agent"),
      (end_try),
      (gt,":enemy",-1),
      (agent_get_team  ,reg0, ":enemy"),
      (store_normalized_team_count,":num", reg0),
      (gt,":num",5),
      (assign,reg1,grc_infantry),
      (call_script,"script_cf_formation"),
        ], []),

    (0.2, 0, 0,
      [(try_for_agents,":agent"),
        (agent_is_human,":agent"),
        (neg|agent_is_ally,":agent"),
        (assign,":enemy",":agent"),
      (end_try),
      (gt,":enemy",-1),
      (agent_get_team  ,reg0, ":enemy"),
      (store_normalized_team_count,":num", reg0),
      (gt,":num",5),
      (assign,reg1,grc_archers),
      (call_script,"script_cf_formation_stagger"),
        ], []),

    (0.2, 0, 0,
      [(try_for_agents,":agent"),
        (agent_is_human,":agent"),
        (neg|agent_is_ally,":agent"),
        (assign,":enemy",":agent"),
      (end_try),
      (gt,":enemy",-1),
      (agent_get_team  ,reg0, ":enemy"),
      (store_normalized_team_count,":num", reg0),
      (gt,":num",5),
      (assign,reg1,grc_cavalry),
      (call_script,"script_cf_formation_wedge"),
        ], []),

    (0.2, 0, 0,
      [(get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (val_add,reg0,2),
      (store_normalized_team_count,":num", reg0),
      (gt,":num",5),
      (assign,reg1,grc_infantry),
      (call_script,"script_cf_formation"),
        ], []),

    (0.2, 0, 0,
      [(get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (val_add,reg0,2),
      (store_normalized_team_count,":num", reg0),
      (gt,":num",5),
      (assign,reg1,grc_archers),
      (call_script,"script_cf_formation_stagger"),
        ], []),

    (0.2, 0, 0,
      [(get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (val_add,reg0,2),
      (store_normalized_team_count,":num", reg0),
      (gt,":num",5),
      (assign,reg1,grc_cavalry),
      (call_script,"script_cf_formation_wedge"),
        ], []),


##########Tactical triggers above########



]

And this is the scripts:
# -*- coding: cp1254 -*-
from header_common import *
from header_operations import *
from module_constants import *
from header_parties import *
from header_skills import *
from header_mission_templates import *
from header_items import *
from header_triggers import *
from header_terrain_types import *

####################################################################################################################
# scripts is a list of script records.
# Each script record contns the following two fields:
# 1) Script id: The prefix "script_" will be inserted when referencing scripts.
# 2) Operation block: This must be a valid operation block. See header_operations.py for reference.
####################################################################################################################

scripts = [

   

  #game_start:
  # This script is called when a new game is started
  # INPUT: none
  ("game_start",
  [
      (str_store_troop_name, s5, "trp_player"),
      (party_set_name, "p_main_party", s5),
      (call_script, "script_update_party_creation_random_limits"),     
# Reseting player party icon
      (assign, "$g_player_party_icon", -1),
# Setting food bonuses
      (item_set_slot, "itm_smoked_fish", slot_item_food_bonus, 3),
      (item_set_slot, "itm_dried_meat", slot_item_food_bonus, 4),
      (item_set_slot, "itm_cattle_meat", slot_item_food_bonus, 4),
      (item_set_slot, "itm_pork", slot_item_food_bonus, 4),
      (item_set_slot, "itm_bread", slot_item_food_bonus, 2),
      (item_set_slot, "itm_apples", slot_item_food_bonus, 2),
      (item_set_slot, "itm_cheese", slot_item_food_bonus, 3),
      (item_set_slot, "itm_chicken", slot_item_food_bonus, 3),
      (item_set_slot, "itm_honey", slot_item_food_bonus, 5),
      (item_set_slot, "itm_cabbages", slot_item_food_bonus, 1),
      (item_set_slot, "itm_sausages", slot_item_food_bonus, 4),
      (item_set_slot, "itm_butter", slot_item_food_bonus, 5),
     
      (item_set_slot, "itm_wine", slot_item_food_bonus, 4),
      (item_set_slot, "itm_ale", slot_item_food_bonus, 3),

    .....................
    .....................
    .....................
    .....................
   
  #script_change_center_prosperity
  # INPUT: arg1 = center_no, arg2 = difference
  # OUTPUT: none
  ("change_center_prosperity",
    [(store_script_param, ":center_no", 1),
    (store_script_param, ":difference", 2),
    (party_get_slot, ":prosperity", ":center_no", slot_town_prosperity),
    (store_add, ":new_prosperity", ":prosperity", ":difference"),
    (val_clamp, ":new_prosperity", 0, 100),
    (store_div, ":eek:ld_state", ":prosperity", 20),
    (store_div, ":new_state", ":new_prosperity", 20),
    (try_begin),
      (neq, ":eek:ld_state", ":new_state"),
      (str_store_party_name, s2, ":center_no"),
      (call_script, "script_get_prosperity_text_to_s50", ":center_no"),
      (str_store_string, s3, s50),
      (party_set_slot, ":center_no", slot_town_prosperity, ":new_prosperity"),
      (call_script, "script_get_prosperity_text_to_s50", ":center_no"),
      (str_store_string, s4, s50),
      (display_message, "@Prosperity of {s2} has changed from {s3} to {s4}."),
    (else_try),
      (party_set_slot, ":center_no", slot_town_prosperity, ":new_prosperity"),
    (try_end),
    ]),

  #script_get_center_ideal_prosperity
  # INPUT: arg1 = center_no
  # OUTPUT: reg0 = ideal_prosperity
  ("get_center_ideal_prosperity",
    [(store_script_param, ":center_no", 1),
    (assign, ":ideal", 40),
    (try_begin),
      (is_between, ":center_no", villages_begin, villages_end),
      (try_begin),
        (party_slot_eq, ":center_no", slot_village_has_fish_pond, 1),
        (val_add, ":ideal", 5),
      (try_end),
      (party_get_slot, ":land_quality", ":center_no", slot_village_land_quality),
      (val_mul, ":land_quality", 3),
      (val_add, ":ideal", ":land_quality"),
      (party_get_slot, ":num_cattle", ":center_no", slot_village_number_of_cattle),
      (val_div, ":num_cattle", 20),
      (val_add, ":ideal", ":num_cattle"),
    (else_try),
      (try_for_range, ":village_no", villages_begin, villages_end),
        (party_slot_eq, ":village_no", slot_village_bound_center, ":center_no"),
        (party_get_slot, ":prosperity", ":village_no", slot_town_prosperity),
        (val_div, ":prosperity", 20),
        (val_add, ":ideal", ":prosperity"),
      (try_end),
    (try_end),
    (assign, reg0, ":ideal"),
    ]),

  #script_get_poorest_village_of_faction
  # INPUT: arg1 = center_no
  # OUTPUT: reg0 = ideal_prosperity
  ("get_poorest_village_of_faction",
    [(store_script_param, ":faction_no", 1),
    (assign, ":min_prosperity_village", -1),
    (assign, ":min_prosperity", 101),
    (try_for_range, ":village_no", villages_begin, villages_end),
      (store_faction_of_party, ":village_faction", ":village_no"),
      (eq, ":village_faction", ":faction_no"),
      (party_get_slot, ":prosperity", ":village_no", slot_town_prosperity),
      (lt, ":prosperity", ":min_prosperity"),
      (assign, ":min_prosperity", ":prosperity"),
      (assign, ":min_prosperity_village", ":village_no"),
    (try_end),
    (assign, reg0, ":min_prosperity_village"),
    ]),

  ("cf_formation",
  [(team_get_leader, ":teamleader", reg0),
    (gt,":teamleader",-1),
    (assign,":leader",-1),
    (agent_get_class,":class",":teamleader"),
    (try_begin),
      (eq,":class",reg1),
      (get_player_agent_no,":player"),
      (neq,":teamleader",":player"),
      (assign,":leader",":teamleader"),
    (else_try),
      (call_script,"script_choose_formation_leader"),
      (gt,reg2,-1),
      (assign,":leader",reg2),
    (end_try),
    (gt,":leader",-1),
    (agent_get_position,1,":leader"),
    (position_move_x,1,100),
    (assign,":collumn",1),
    (try_for_agents,reg(5)),
      (neq,reg5,":leader"),
      (agent_is_alive,reg(5)),
      (agent_is_human,reg(5)),
      (agent_get_team  ,":team", reg5),
      (eq,":team",reg0),
      (agent_get_class ,":class", reg5),
      (eq,":class",reg1),                                 
      (agent_set_scripted_destination,reg(5),1),
      (position_move_x,1,100),
      (try_begin),
          (eq,":collumn",12),
          (position_move_x,1,-12*100),
          (position_move_y,1,-200),
          (assign,":collumn",1),
      (else_try),
          (val_add,":collumn",1),
      (end_try),
    (end_try)]),

  ("cf_formation_stagger",
  [(team_get_leader, ":teamleader", reg0),
    (gt,":teamleader",-1),
    (assign,":leader",-1),
    (agent_get_class,":class",":teamleader"),
    (try_begin),
      (eq,":class",reg1),
      (get_player_agent_no,":player"),
      (neq,":teamleader",":player"),
      (assign,":leader",":teamleader"),
    (else_try),
      (call_script,"script_choose_formation_leader"),
      (gt,reg2,-1),
      (assign,":leader",reg2),
    (end_try),
    (gt,":leader",-1),
    (agent_get_position,1,":leader"),
    (position_move_x,1,100),
    (assign,":move_y",-100),
    (try_for_agents,reg(5)),
      (neq,reg5,":leader"),
      (agent_is_alive,reg(5)),
      (agent_is_human,reg(5)),
      (agent_get_team  ,":team", reg5),
      (eq,":team",reg0),
      (agent_get_class ,":class", reg5),
      (eq,":class",reg1),                                 
      (agent_set_scripted_destination,reg(5),1),
      (position_move_x,1,100),
      (position_move_y,1,":move_y"),
      (val_mul,":move_y",-1),
    (end_try)]),

  ("cf_formation_wedge",
  [(team_get_leader, ":teamleader", reg0),
    (gt,":teamleader",-1),
    (assign,":leader",-1),
    (agent_get_class,":class",":teamleader"),
    (try_begin),
      (eq,":class",reg1),
      (get_player_agent_no,":player"),
      (neq,":teamleader",":player"),
          (assign,":fail",0),
          (try_for_range,":ranged_item","itm_jarid","itm_flintlock_pistol"),
            (agent_has_item_equipped,":teamleader",":ranged_item"),
            (assign,":fail",1),
          (end_try),
          (eq,":fail",0),
      (assign,":leader",":teamleader"),
    (else_try),
      (assign,reg2,-1),
      (assign,":max_xp",0),
      (try_for_agents,":agent"),
          (agent_is_alive,":agent"),
          (agent_is_human,":agent"),
          (agent_get_team,":team",":agent"),
          (eq,":team",reg0),
          (agent_get_class,":class",":agent"),
          (eq,":class",reg1),
          (get_player_agent_no,":player"),
          (neq,":player",":agent"),
          (assign,":fail",0),
          (try_for_range,":ranged_item","itm_jarid","itm_flintlock_pistol"),
            (agent_has_item_equipped,":agent",":ranged_item"),
            (assign,":fail",1),
          (end_try),
          (eq,":fail",0),
          (agent_get_troop_id,":troop", ":agent"),
          (troop_get_xp, ":mad:p", ":troop"),
          (gt,":mad:p",":max_xp"),
          (assign,":max_xp",":mad:p"),
          (assign,reg2,":agent"),
      (end_try),
      (gt,reg2,-1),
      (assign,":leader",reg2),
    (end_try),
    (gt,":leader",-1),
    (agent_get_position,1,":leader"),
    (assign,":collumn",1),
    (assign,":nc",3),
    (position_move_x,1,-150),
    (try_for_agents,reg(5)),
      (neq,reg5,":leader"),
      (agent_is_alive,reg(5)),
      (agent_is_human,reg(5)),
      (agent_get_team  ,":team", reg5),
      (eq,":team",reg0),
      (agent_get_class ,":class", reg5),
      (eq,":class",reg1),
          (assign,":fail",0),
          (try_for_range,":ranged_item","itm_jarid","itm_flintlock_pistol"),
            (agent_has_item_equipped,reg5,":ranged_item"),
            (assign,":fail",1),
          (end_try),
          (eq,":fail",0),
      (agent_set_scripted_destination,reg(5),1),
      (try_begin),
          (eq,":collumn",":nc"),
          (val_mul,":nc",-150),
          (position_move_x,1,":nc"),
          (position_move_y,1,-300),
          (assign,":collumn",1),
          (val_div,":nc",-150),
          (val_add,":nc",2),
      (else_try),
          (position_move_x,1,150),
          (val_add,":collumn",1),
      (end_try),
    (end_try)]),

  ("formation_end",
  [(try_for_agents,reg(5)),
      (agent_is_alive,reg(5)),
      (agent_is_human,reg(5)),
      (agent_get_team  ,":team", reg5),
      (eq,":team",reg0),
      (agent_get_class ,":class", reg5),
      (eq,":class",reg1),
      (agent_clear_scripted_mode,reg5),
    (try_end),]),

  ("choose_formation_leader",
  [(assign,reg2,-1),
    (assign,":max_xp",0),
    (try_for_agents,":agent"),
        (agent_is_alive,":agent"),
        (agent_is_human,":agent"),
        (agent_get_team,":team",":agent"),
        (eq,":team",reg0),
        (agent_get_class,":class",":agent"),
        (eq,":class",reg1),
        (get_player_agent_no,":player"),
        (neq,":player",":agent"),
        (agent_get_troop_id,":troop", ":agent"),
        (troop_get_xp, ":mad:p", ":troop"),
        (gt,":mad:p",":max_xp"),
        (assign,":max_xp",":mad:p"),
        (assign,reg2,":agent"),
    (end_try),]),


 
]

Now, here: http://forums.taleworlds.com/index.php/topic,34685.msg1077570.html#msg1077570 it is claimed that this global var is declared, this file really does not containt that declaration.
May be it is another file in this version?...


Does anyone have a clue of what I'm doing wrong?
 
D'Sparil said:
I HATE the fact that cavalry dismounts if they are fewer than infantry. I deleted all the lines I considered were related to this, but they still do it, I must be missing some  :mad:

I dislike that as well.  As far as I know, remove these:
    (5.0, 0, 0,
      [(assign,":enemy",-1),
      (assign,":infantry",0),
      (assign,":cavalry",0),
      (try_for_agents,":agent"),
        (agent_is_human,":agent"),
        (agent_is_alive,":agent"),
        (neg|agent_is_ally,":agent"),
        (assign,":enemy",":agent"),
        (agent_get_class ,":class", ":agent"),
        (try_begin),
            (eq,":class",grc_cavalry),
            (val_add,":cavalry",1),
        (else_try),
            (val_add,":infantry",1),
        (end_try),
      (end_try),
      (gt,":enemy",-1),
      (agent_get_team  ,reg0, ":enemy"),
      (assign,":ratio",":infantry"),
      (val_div,":ratio",":cavalry"),
      (try_begin),
        (gt,":ratio",2),
        (lt,":cavalry",10),
        (team_give_order, reg0, grc_everyone, mordr_dismount),
      (else_try),
        (team_give_order, reg0, grc_everyone, mordr_mount),
      (end_try),], []),

(5.0, 0, 0,
      [(neq, "$battle_won", 1),
      (assign,":infantry",0),
      (assign,":cavalry",0),
      (get_player_agent_no,":player"),
      (agent_get_team  ,reg0, ":player"),
      (val_add,reg0,2),
      (try_for_agents,":agent"),
        (agent_is_human,":agent"),
        (agent_is_alive,":agent"),
        (agent_get_team  ,":team", ":agent"),
        (eq,":team",reg0),
        (agent_get_class ,":class", ":agent"),
        (try_begin),
            (eq,":class",grc_cavalry),
            (val_add,":cavalry",1),
        (else_try),
            (val_add,":infantry",1),
        (end_try),
      (end_try),
      (assign,":ratio",":infantry"),
      (val_div,":ratio",":cavalry"),
      (try_begin),
        (gt,":ratio",2),
        (lt,":cavalry",10),
        (team_give_order, reg0, grc_everyone, mordr_dismount),
      (else_try),
        (team_give_order, reg0, grc_everyone, mordr_mount),
      (end_try),], []),

 
I've got a question. Are those lines of code for 1.011?
And also (as I'm not a moder) can someone supply me (and others) with "native 1.011" with the formations and morale embedded in it?
Thanks in advance.
 
I second Yussof's request.

But let me get this straight... in the morale implementation, routing men do not rout off of the map?  They just go to the edge and wait?
 
This script still works and it is fantastic to see a line of Holy Roman Halberdiers in line formation with some Imperial Knights in the background. Thanks to Mirathei and Chel for the formations + morale!
 
If you mean "http://rapidshare.com/files/159932543/formations_m_templates_and_scripts.rar.html" then the answer is:


"Error
This file is neither allocated to a Premium Account, or a Collector's Account, and can therefore only be downloaded 10 times.
This limit is reached.
To download this file, the uploader either needs to transfer this file into his/her Collector's Account, or upload the file again. The file can later be moved to a Collector's Account. The uploader just needs to click the delete link of the file to get further information."

No it's not working.

I've checked before i wrote the first post.
 
Bismarck said:
This script still works and it is fantastic to see a line of Holy Roman Halberdiers in line formation with some Imperial Knights in the background.

I really would just like to see Swadian Knights rampaging into Rhodok hedgehog. They don't have to be holy.

-edit-

If the "mod" would be only with formations and without morale i would be happy.
this is the second day I'm trying to implement it myself, and... i strictly can't, i give up. So please help.
 
Back
Top Bottom