PYTHON SCRIPT/SCHEME EXCHANGE

Best answers
0
DuoGum said:
André de Cuyne said:
bla bla bla...
I don't understand  :cry:
You have forgotten a comma somewhere in your code. Certainly at the end of a line.
A tuple is a data container which in Python is enclosed with parenthesis.
Basically, the Module System is a set of lists containing tuples.
lists and tuples members MUST be separated with commas, otherwise, you get a " 'tuple' [or list] object is not callable " error.

Check the code arround the line 2625 in 'module_simple_triggers.py'.
 

DuckSauce

Sergeant at Arms
Best answers
0
Just a mini-script from me, nothing that grand, but some beginner may find it usefull, you never know :grin:
Ok so here goes, the script can be used to set the level of a skill to something lower or higher, rather then just raise(and lower) it according to what it is at that moment. For my mod this was usefull in the character backgrounds section which I expanded with something special(will probably share when done with that) as I might want to set the rider skill of a player to 9, regardless of his current level at the skill, so it won't be 10 or 8 for example.

Put this somewhere below the other scripts:
Code:
    # script_troop_set_skill_level
    # Input: skill, skill_level
    # Output: none
    ("troop_set_skill_level",
     [
        (store_script_param_1, ":skill"),
        (store_script_param_2, ":skill_level"),
        (store_skill_level, ":player_skill_level", ":skill", "trp_player"),
        (val_sub, ":skill_level", ":player_skill_level"),
        (troop_raise_skill, "trp_player",":skill",":skill_level"),
     ]
    ),

To set the skill you call the script like this:
Code:
                (call_script, "script_troop_set_skill_level", "skl_riding", 10),

Replacing skl_riding with any skill you want and 10 with any level you want it to be at.
You can also lower the skill as well.

Haven't thoroughly tested this yet, but it's a simple script so it's unlikely any major issues come up, if you try to raise above 10 it should automatically stop at 10(unless you've modded it so that you can go above 10 ofcourse).

You could for example use it for an item that while equipped changes your leadership skill to 5 but no higher or lower, no sweat if it's only 1 item maybe, but with multiple items that speficially will set rather then increase/decrease the skill level a script will be handy :grin:
 

WilliamBerne

Master Knight
Best answers
0
when you are checking a presentation in game, click left ctrl to display the coordinate that the position your mouse currently at, easy to locate the right coordinate you need.
#script_display_prsnt_coordinate
  ("display_prsnt_coordinate",
    [
        (try_begin),
        (key_clicked,key_left_control),
        (mouse_get_position, pos2),
        (position_get_x,":pos_x",pos2),
        (position_get_y,":pos_y",pos2),
        (assign,reg1,":pos_x"),
        (assign,reg2,":pos_y"),
        (display_message,"@x: {reg1}, y: {reg2}"),
        (try_end),
      ]),
 

CinuzIta

Sergeant Knight at Arms
Best answers
0
someone can help me?

i'm trying to implement duel kit...i've managed to insert all the codes but module_game_menu's one...

while compiling, i get this error:

Code:
Exporting scripts...
Exporting mission_template data...
Exporting game menus data...
Error: Unable to find object:mt_arena_duel_thing_std
ERROR: Illegal Identifier:mt_arena_duel_thing_std
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...
WARNING: Global variable never used: array_party_num
WARNING: Global variable never used: talk_array_no

______________________________

Script processing has ended.
Press any key to exit. . .
and here's the code:
Code:
  ("arena_duel_fight",0,
   "You and your opponent prepare to fight for honour.",
   "none",
   [],
   [
     ("continue",[],"Continue...",
      [
 ############################### Duel Mod Start  ##############################


("duel_menu",0,
   "{s1}{s2}",
   "none",
   [
 (str_clear, s2),  (str_clear, s3), (str_clear, s5), (str_clear, s6), (str_clear, s7),
   (troop_get_slot, ":duel_wins", "$g_talk_troop", slot_troop_duel_won),
   (assign, reg(6), ":duel_wins"),
   (troop_get_slot, ":duel_losses", "$g_talk_troop", slot_troop_duel_lost),
   (assign, reg(7), ":duel_losses"),
   (store_add, ":duel_total", ":duel_wins", ":duel_losses"),
   (assign, reg(5), ":duel_total"),
   (str_store_troop_name, s3, "$g_talk_troop"),
   (try_begin),
      (eq, "$g_duel_result", -1),
      (str_store_string, s1, "@You lost your duel against ^^{s3}"),
   (else_try),
      (eq, "$g_duel_result", 1),
      (str_store_string, s1, "@You won your duel against ^^{s3}"),
   (else_try),
      (str_store_string, s1, "@You prepare to duel ^^{s3}"),
   (try_end),
    (try_begin),
      (troop_is_hero, "$g_talk_troop"),
      (str_store_string, s2, "@^^^^You have fought {s3} {reg5} times. ^^You've won {reg6} times. ^^You've lost {reg7} times"),
   (else_try),
      (str_store_string, s2, "@^^^^Dueling with your own troops will not count towards your dueling statistics."),
   (try_end),

    ],
   
   [
      ("start_fight",[(eq, "$g_duel_result", 0)],"Start the duel.",
       [(try_begin),     
          (is_between, "$g_encountered_party", towns_begin, towns_end),     
            (party_get_slot, ":arena_scene", "$g_encountered_party", slot_town_arena),   
        (else_try),     
            (assign, ":closest_dist", 100000),     
            (assign, ":closest_town", -1),     
            (try_for_range, ":cur_town", towns_begin, towns_end),       
                (store_distance_to_party_from_party, ":dist", ":cur_town", "p_main_party"),       
                (lt, ":dist", ":closest_dist"),       
                (assign, ":closest_dist", ":dist"),       
                (assign, ":closest_town", ":cur_town"),     
            (try_end),     
            (party_get_slot, ":arena_scene", ":closest_town", slot_town_arena),
        (try_end),   
        (modify_visitors_at_site, ":arena_scene"),   
        (reset_visitors),
    (set_visitor, "$g_duel_vis_point_opp", "$g_talk_troop"),
    (set_visitor, "$g_duel_vis_point_plyr", "trp_player"),

         (set_jump_mission, "mt_arena_duel_thing_std"),
         (jump_to_scene, ":arena_scene"),
         (change_screen_mission),
        ]
       ),
      ("duel_again",[(neq, "$g_duel_result", 0)],"Duel again.",
       [
           (assign, "$g_duel_result", 0),
           (jump_to_menu, "mnu_duel_menu"),
   ]
       ),
      ("leave",[],"Leave.",
       [(change_screen_map),
        ]
       ),
      ]
 ),


############################### Duel Mod End  ##############################


        (jump_to_menu, "mnu_simple_encounter"),
        (change_screen_mission),
        ]),
      ]
  ),
 


ideas? :???:



-EDIT: SOLVED
 

Jezze

Baron
WBM&BNWVC
Best answers
0
I was sick of when starting a new game, that you always spawned on the same places. So I looked for this piece of code and changed some things.

These codes regulates that you will always spawn in the neighbourhood of any trainging grounds on the map. I screwed around with the training grounds and after a while and my charac. spawned only at 1 from that time. So, to let your character spawn at much different places, I came up with this;

Code:
(store_random_in_range, ":starting_training_ground", training_grounds_begin, training_grounds_end),
(party_relocate_near_party, "p_main_party", ":starting_training_ground", 3),
(str_store_troop_name, s5, "trp_player"),
(party_set_name, "p_main_party", s5),
(call_script, "script_update_party_creation_random_limits"),
Replace with;
Code:
(store_random_in_range, ":starting_villages", villages_begin, villages_end),
(party_relocate_near_party, "p_main_party", ":starting_villages", 3),
(str_store_troop_name, s5, "trp_player"),
(party_set_name, "p_main_party", s5),
(call_script, "script_update_party_creation_random_limits"),

I just replaced all the training_ground by villages and now every time you start a new game, your character will spawn at a random village  :smile:. I think it is also possible for towns, castles etc. but I didn't tried that out yet.

I do not know if anyone has done this before but maybe it can help you if you need it.
 

Pisces

Veteran
Best answers
0
I've been playing around with trying to ensure certain troops have both a lance and a sword. I originally started with just adding a lance to the troop, which of course doesn't work as it adds it to the template of a troop, so the template is called and gets either a sword, lance or both randomly like normal. There appears to be no operation to give it to an agent. So I was trying an alternate strategy of reassigning the troops to an alternate entry point and deleting or removing the originals. I have very limited experience with mission_templates and scene editing so I haven't got it to work yet. I am just wondering if anyone has followed this line of logic before and can give any advice.
 

Rongar

Master Knight
M&BWB
Best answers
0
Culture-specific shop inventories

Prerequisites
1. Following scripts assume that factions are set correct for all troops (normally in native for regular troops nords are outlaws, vaerigs and swadian are neutral, khergits are khergits (should be kingdom_3)).

2. Merchants factions are set to original factions of their towns.

Code injection

Anywhere in module_constants.py, better to add around other slot_item_
slot_item_faction = 5 # additional item slot for culture-specific shop inventories

At the header of module_scripts.py
from ID_factions import *
from module_troops import *

In module_scripts.py just before scripts = [
def set_item_faction():
  command_list = []
  for i_troop in xrange(len(troops)):
    for i_item in troops[i_troop][7]:   
      command_list.append((item_get_slot, ":val",i_item, slot_item_faction))   
      command_list.append((val_or, ":val",1 << troops[i_troop][6]))   
      command_list.append((item_set_slot, i_item, slot_item_faction,":val"))   
  return command_list [:]
(Respect spaces!)

In module_scripts.py in game_start
(call_script,"script_set_item_faction"),

Anywhere in module_scripts.py inside  scripts
  # script_set_item_faction
  # Input: none
  # Output: none
  ("set_item_faction",  set_item_faction()), 
 
  # script_get_faction_mask
  # Input: faction
  # Output: reg0 -- mask
  ("get_faction_mask",  [
  (assign,reg0,1),
(store_script_param_1, ":faction"),
(try_for_range,":unused",0,":faction"),
(val_mul,reg0,2),
(try_end),
 
  ]),   

In armor, weapon and horse merchant refresh triggers in module_triggers.py between (try_for_range,reg(2),...), and (troop_add_merchandise,reg(2),...),
(reset_item_probabilities,100),     
(store_troop_faction,":faction",reg(2)),
(call_script,"script_get_faction_mask",":faction"),      
(store_add,":last_item_plus_one","itm_rabati",1),
(try_for_range,":i_item","itm_no_item",":last_item_plus_one"),
    (item_get_slot,":item_faction_mask",":i_item",slot_item_faction),
    (val_and,":item_faction_mask",reg0),
    (eq,":item_faction_mask",0),
    (set_item_probability_in_merchandise,":i_item",0),
(try_end),

# Refresh Armor sellers
(0.0, 0, 24.0, [], [
(set_merchandise_modifier_quality,150),      
(try_for_range,reg2,armor_merchants_begin,armor_merchants_end),

#code injection start
    (reset_item_probabilities,100),     
    (store_troop_faction,":faction",reg2),
    (call_script,"script_get_faction_mask",":faction"),      
    (store_add,":last_item_plus_one","itm_rabati",1),
    (try_for_range,":i_item","itm_no_item",":last_item_plus_one"),
        (item_get_slot,":item_faction_mask",":i_item",slot_item_faction),
        (val_and,":item_faction_mask",reg0),
        (eq,":item_faction_mask",0),
        (set_item_probability_in_merchandise,":i_item",0),
    (try_end),
#code injection end

    (troop_add_merchandise,reg2,itp_type_body_armor,16),
    (troop_add_merchandise,reg2,itp_type_head_armor,16),
    (troop_add_merchandise,reg2,itp_type_foot_armor,:cool:,
    (troop_add_merchandise,reg2,itp_type_hand_armor,4),
    (troop_ensure_inventory_space,reg2,merchant_inventory_space),
    (troop_sort_inventory, reg2),
    (store_troop_gold, reg6,reg2),
    (lt,reg6,900),
    (store_random_in_range,":new_gold",200,400),
    (call_script, "script_troop_add_gold",reg2,":new_gold"),
(try_end),
]),

Remarks

1. Current code take into account all troops (regulars, lords, merchants).  To set custom range you should change
  for i_troop in xrange(len(troops)):
on
for i_troop in range(trp_troop1, trp_troop2+1):
also you need to import ID_troops. More sophisticated ranges requires more sophisticated code.

2. Non-factional items will never appear in shops.  There are multiple bypasses. Shortest by description  - add one troop per faction and fill its inventory with non-factional items that you need in shops.

3. Debug code
      (try_begin),
      (eq, ":extra_text_id", 4),
(item_get_slot,reg1,":item_no",slot_item_faction),
(set_result_string, "@Mask={reg1}"),
      (else_try),
        (eq, ":extra_text_id", 5),
(item_get_slot,reg1,":item_no",slot_item_faction),
(str_clear,s1),
(try_begin),
(call_script,"script_get_faction_mask","fac_kingdom_1"),
(val_and,reg0,reg1),
(neq,reg0,0),
(str_store_string,s1,"@{s1}(S)"),
(try_end),
(try_begin),
(call_script,"script_get_faction_mask","fac_kingdom_2"),
(val_and,reg0,reg1),
(neq,reg0,0),
(str_store_string,s1,"@{s1}(V)"),
(try_end),
(try_begin),
(call_script,"script_get_faction_mask","fac_kingdom_3"),
(val_and,reg0,reg1),
(neq,reg0,0),
(str_store_string,s1,"@{s1}(K)"),
(try_end),
(try_begin),
(call_script,"script_get_faction_mask","fac_kingdom_4"),
(val_and,reg0,reg1),
(neq,reg0,0),
(str_store_string,s1,"@{s1}(N)"),
(try_end),
(try_begin),
(call_script,"script_get_faction_mask","fac_kingdom_5"),
(val_and,reg0,reg1),
(neq,reg0,0),
(str_store_string,s1,"@{s1}(R)"),
(try_end),
(set_result_string, s1),

      (try_end),

4. It is possible to avoid setting faction for merchants (there are couple reasons for that). Instead you can calculate offset for reg2 from town_1_<merchant type> and get original faction of town_1 + offset.

5. Lords in native have sometimes not that evident equipment,  kettle hat will be very popular.

6. No changes are needed for def set_item_faction() if you have more or less factions or have e.g. outlaw items seller. You should check only troop factions, refresh triggers and debug code (if you are going to use the last).
 

Arnior

Recruit
Best answers
0
It is actually stupid you can only give your troops max agi_30, str_30 and so on. These variables are defined in header_troops.py.

I changed that file, so now everyone can give there troops a max of _255 (no higher value is possible with only changing header_troops.py, because we can only use 2 places: eg: str_243 = bignum | 0x000000f3) and a min of _1 :grin:.

-----------------------------------------------------------------------
So what to do:
Just change this (in header_troop.py!):

Code:
str_3            = bignum | 0x0000000003
str_4            = bignum | 0x0000000004
str_5            = bignum | 0x0000000005
str_6            = bignum | 0x0000000006
str_7            = bignum | 0x0000000007
str_8            = bignum | 0x0000000008
str_9            = bignum | 0x0000000009
str_10           = bignum | 0x000000000a
str_11           = bignum | 0x000000000b
str_12           = bignum | 0x000000000c
str_13           = bignum | 0x000000000d
str_14           = bignum | 0x000000000e
str_15           = bignum | 0x000000000f
str_16           = bignum | 0x0000000010
str_17           = bignum | 0x0000000011
str_18           = bignum | 0x0000000012
str_19           = bignum | 0x0000000013
str_20           = bignum | 0x0000000014
str_21           = bignum | 0x0000000015
str_22           = bignum | 0x0000000016
str_23           = bignum | 0x0000000017
str_24           = bignum | 0x0000000018
str_25           = bignum | 0x0000000019
str_26           = bignum | 0x000000001a
str_27           = bignum | 0x000000001b
str_28           = bignum | 0x000000001c
str_29           = bignum | 0x000000001d
str_30           = bignum | 0x000000001e
str_31           = bignum | 0x00000000ff

agi_3            = bignum | 0x0000030000
agi_4            = bignum | 0x0000040000
agi_5            = bignum | 0x0000050000
agi_6            = bignum | 0x0000060000
agi_7            = bignum | 0x0000070000
agi_8            = bignum | 0x0000080000
agi_9            = bignum | 0x0000090000
agi_10           = bignum | 0x00000a0000
agi_11           = bignum | 0x00000b0000
agi_12           = bignum | 0x00000c0000
agi_13           = bignum | 0x00000d0000
agi_14           = bignum | 0x00000e0000
agi_15           = bignum | 0x00000f0000
agi_16           = bignum | 0x0000100000
agi_17           = bignum | 0x0000110000
agi_18           = bignum | 0x0000120000
agi_19           = bignum | 0x0000130000
agi_20           = bignum | 0x0000140000
agi_21           = bignum | 0x0000150000
agi_22           = bignum | 0x0000160000
agi_23           = bignum | 0x0000170000
agi_24           = bignum | 0x0000180000
agi_25           = bignum | 0x0000190000
agi_26           = bignum | 0x00001a0000
agi_27           = bignum | 0x00001b0000
agi_28           = bignum | 0x00001c0000
agi_29           = bignum | 0x00001d0000
agi_30           = bignum | 0x00001e0000

int_3            = bignum | 0x0003000000
int_4            = bignum | 0x0004000000
int_5            = bignum | 0x0005000000
int_6            = bignum | 0x0006000000
int_7            = bignum | 0x0007000000
int_8            = bignum | 0x0008000000
int_9            = bignum | 0x0009000000
int_10           = bignum | 0x000a000000
int_11           = bignum | 0x000b000000
int_12           = bignum | 0x000c000000
int_13           = bignum | 0x000d000000
int_14           = bignum | 0x000e000000
int_15           = bignum | 0x000f000000
int_16           = bignum | 0x0010000000
int_17           = bignum | 0x0011000000
int_18           = bignum | 0x0012000000
int_19           = bignum | 0x0013000000
int_20           = bignum | 0x0014000000
int_21           = bignum | 0x0015000000
int_22           = bignum | 0x0016000000
int_23           = bignum | 0x0017000000
int_24           = bignum | 0x0018000000
int_25           = bignum | 0x0019000000
int_26           = bignum | 0x001a000000
int_27           = bignum | 0x001b000000
int_28           = bignum | 0x001c000000
int_29           = bignum | 0x001d000000
int_30           = bignum | 0x001e000000


cha_3            = bignum | 0x0300000000
cha_4            = bignum | 0x0400000000
cha_5            = bignum | 0x0500000000
cha_6            = bignum | 0x0600000000
cha_7            = bignum | 0x0700000000
cha_8            = bignum | 0x0800000000
cha_9            = bignum | 0x0900000000
cha_10           = bignum | 0x0a00000000
cha_11           = bignum | 0x0b00000000
cha_12           = bignum | 0x0c00000000
cha_13           = bignum | 0x0d00000000
cha_14           = bignum | 0x0e00000000
cha_15           = bignum | 0x0f00000000
cha_16           = bignum | 0x1000000000
cha_17           = bignum | 0x1100000000
cha_18           = bignum | 0x1200000000
cha_19           = bignum | 0x1300000000
cha_20           = bignum | 0x1400000000
cha_21           = bignum | 0x1500000000
cha_22           = bignum | 0x1600000000
cha_23           = bignum | 0x1700000000
cha_24           = bignum | 0x1800000000
cha_25           = bignum | 0x1900000000
cha_26           = bignum | 0x1a00000000
cha_27           = bignum | 0x1b00000000
cha_28           = bignum | 0x1c00000000
cha_29           = bignum | 0x1d00000000

into this:
Variable list is too long: Just download it here.

-------------------------------------------
I posted this before in the "guide of usefull scripts".

Because tansvanio said
tansvanio said:
(...)u should post that on the thread of the script, this is a script list thread, not a script thread :wink:
I do post it here too!
 

Amman d Stazia

Master Knight
Best answers
0
Pisces said:
I've been playing around with trying to ensure certain troops have both a lance and a sword. I originally started with just adding a lance to the troop, which of course doesn't work as it adds it to the template of a troop, so the template is called and gets either a sword, lance or both randomly like normal. There appears to be no operation to give it to an agent. So I was trying an alternate strategy of reassigning the troops to an alternate entry point and deleting or removing the originals. I have very limited experience with mission_templates and scene editing so I haven't got it to work yet. I am just wondering if anyone has followed this line of logic before and can give any advice.
well.....  take the tournaments mission_template as your guide.  In tournaments (arena fights) every agent is assigned a set weaponry.
So if you are happy for all of one team to be given sword+lance, you can do it.  But I am not sure that you can limit it to certain troops.

you might want to try something like this though:

Create a new sword item and equip only that on your troop.
Create a script which is called by activation of that new-sword.  This script is basically to equip the agent with a lance.

In theory then, every time your troop draws their sword, they will be equipped with a lance.
 

Pisces

Veteran
Best answers
0
I started with that line of thought, but can you add a weapon to an agent? I'm not too experience but I can't find any operation or example of such. Adding it to the troop only works for heros. It would be quite easy to make a script to give the knights only lances in open battles and only hand weapons for sieges, which would be good, but not quite what I'm looking for.

My plan was to create new entry points with the override weapons flag & assign the knights to it. I'm not sure what will happen when I create new entry points as the entry points are automatically generated, but so far I haven't been successful in assigning the knights to the new entry points.
 

dunde

Count
WB
Best answers
0
I found death cam from MartinF in this thread, I use it and I like it very much.
Then,I download rubik'scustom commander kits. The custom camera feature in the mod is very great.
So I think, It will be nice if both combined to be single feature.
Here it is, combined Custom Camera features :
- In every scenes, battle or visiting, press END to toggle camera mode, Default Camera and Custom Camera.
  Hold Page Down/Page Up to adjust camera height.
  Hold Up/Down to adjust camera distance.
- When player's knocked down, as long as there are ally that still alive, battle continue.
  Press LEFT and RIGHT to switch between allies viewpoints. END will make camera back to player troop.
  Press TAB to retreat as normal.

Edited/new Triggers :
Code:
# Replaced
#custom_battle_check_victory_condition = (
#  1, 60, ti_once,
#  [
#    (store_mission_timer_a,reg(1)),
#    (ge,reg(1),10),
#    (all_enemies_defeated, 2),
#    (neg|main_hero_fallen, 0),
#    (set_mission_result,1),
#    (display_message,"str_msg_battle_won"),
#    (assign, "$battle_won",1),
#    (assign, "$g_battle_result", 1),
#    ],
#  [
#    (call_script, "script_custom_battle_end"),
#    (finish_mission, 1),
#    ])
#
#custom_battle_check_defeat_condition = (
#  1, 4, ti_once,
#  [
#    (main_hero_fallen),
#    (assign,"$g_battle_result",-1),
#    ],
#  [
#    (call_script, "script_custom_battle_end"),
#    (finish_mission),
#    ])
#
#common_battle_victory_display = (
#  10, 0, 0, [],
#  [
#    (eq,"$battle_won",1),
#    (display_message,"str_msg_battle_won"),
#    ])
#
common_battle_check_victory_condition = (
  1, 60, ti_once,
  [
    (store_mission_timer_a,reg(1)),
    (ge,reg(1),10),
    (all_enemies_defeated, 5),
    (set_mission_result,1),
    (display_message,"str_msg_battle_won"),
    (assign,"$battle_won",1),
    (assign, "$g_battle_result", 1),
    (call_script, "script_play_victorious_sound"),
    ],
  [
    (call_script, "script_count_mission_casualties_from_agents"),
    (finish_mission, 1),
    ])

common_battle_check_defeat_condition = (
  1, 60, ti_once,
  [
    (store_mission_timer_a,reg(1)),
    (ge,reg(1),10),
    (main_hero_fallen),
    (assign, ":num_allies", 0),
    (try_for_agents, ":agent"),
        (agent_is_ally, ":agent"),
        (agent_is_alive, ":agent"),
        (val_add, ":num_allies", 1),
    (try_end),
    (set_mission_result,-1),    
    (eq, ":num_allies", 0),
    (display_message,"str_msg_battle_lost"),
    (assign,"$battle_won",-1),
    (assign, "$g_battle_result", -1),
    ],
  [
    (call_script, "script_count_mission_casualties_from_agents"),
    (finish_mission, 0),
    ])


common_battle_result_display = (
  10, 0, 0, [],
  [
    (try_begin),
        (eq,"$battle_won",1),
        (display_message,"str_msg_battle_won"),
    (else_try),
        (eq,"$battle_won",-1),
        (display_message,"str_msg_battle_lost"),
    (try_end),
    ])

player_fall_check_continue = (
    1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (display_message, "@You have been knocked out by the enemy."),
              (assign, ":num_allies", 0),
              (try_for_agents, ":agent"),
                 (agent_is_ally, ":agent"),
                 (agent_is_alive, ":agent"),
                 (val_add, ":num_allies", 1),
              (try_end),
              (try_begin),
                 (eq, ":num_allies", 0),
                 (assign, "$g_battle_result", -1),
                 (set_mission_result,-1),
                 (call_script, "script_count_mission_casualties_from_agents"),
                 (finish_mission,0),
             (else_try),
                (display_message, "@Watch your men continue the fight without you or press Tab to retreat."),
                (display_message, "@If you choose to watch the fight you can use the LEFT ARROW and RIGHT ARROW keys to change your camera view."),
             (try_end),
           ])

player_fall_check_retreat = (
    1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (display_message, "@You have been knocked out by the enemy."),
              (str_store_string, s5, "str_retreat"),
            (call_script, "script_simulate_retreat", "$retreat_player_side", "$retreat_enemy_side"),
              (assign, "$g_battle_result", -1),
              (set_mission_result, -1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0)
           ])

retreat_confirm = (
    ti_question_answered, 0, 0, [],
       [(store_trigger_param_1,":answer"),
        (eq,":answer",0),
        (assign, "$pin_player_fallen", 0),
        (assign, ":retreat", 1),
        (try_begin),
          (eq, "$retreat_type", 2),
          (store_mission_timer_a, ":elapsed_time"),
          (le, ":elapsed_time", 20),
          (assign, ":retreat", 0),
        (try_end),
        (try_begin),        
            (eq, ":retreat", 1),
            (str_store_string, s5, "str_retreat"),
            (call_script, "script_simulate_retreat", "$retreat_player_side", "$retreat_enemy_side"),
        (try_end),
        (try_begin),
           (eq, "$retreat_type", 1),
           (assign, "$g_battle_result", -1),
        (try_end),
        (call_script, "script_count_mission_casualties_from_agents"),
        (finish_mission,0),])
################################################################
## CUSTOM CAMERA
################################################################
camera_init = ( 0, 0, ti_once, [],
        [
          (get_player_agent_no, "$cam_current_agent"),
          (mission_cam_set_mode, "$cam_mode"),
        ])

camera_mode = ( 0, 0, 0, [], 
  [
    (try_begin),
       (eq, "$cam_mode", 1),
       (agent_get_look_position, pos1, "$cam_current_agent"),
       (position_move_z, pos1, "$g_camera_z"),
       (position_move_y, pos1, "$g_camera_y"),
       (agent_get_horse, ":horse_agent", "$cam_current_agent"),
       (try_begin),
         (ge, ":horse_agent", 0),
         (position_move_z, pos1, 80),
       (try_end),
       (mission_cam_set_position, pos1),
    (else_try),
       (main_hero_fallen),
       (agent_get_position, 1, "$cam_current_agent"),     
       (get_player_agent_no, ":player_agent"),
       (agent_set_position, ":player_agent", 1),
    (try_end),
  ])
camera_zoom_in =    ( 0, 0, 0,[(key_is_down, key_up)],
        [
            (eq, "$cam_mode", 1),
            (val_add, "$g_camera_y",1),
        ])
camera_zoom_out =    ( 0, 0, 0,[(key_is_down, key_down)],
        [
            (eq, "$cam_mode", 1),
            (val_sub, "$g_camera_y",1),
        ])
camera_raise =    ( 0, 0, 0,[(key_is_down, key_page_up)],
        [
            (eq, "$cam_mode", 1),
            (val_add, "$g_camera_z",1),
        ])
camera_lower =    ( 0, 0, 0,[(key_is_down, key_page_down)],
        [
            (eq, "$cam_mode", 1),
            (val_sub, "$g_camera_z",1),
        ])
camera_set =     ( 0, 0, 0,[(key_clicked, key_end)],
        [            
            (try_begin),
               (eq, "$cam_mode", 0),
               (assign, "$cam_mode", 1),
               (assign, reg6, "$g_camera_y"),
               (assign, reg7, "$g_camera_z"),
               (display_message,"@Custom Camera ( Distance = {reg6} ; Height = {reg7} )"),                                     
            (else_try),
               (eq, "$cam_mode", 1),
               (try_begin),
                  (neg|main_hero_fallen, 0),
                  (get_player_agent_no, "$cam_current_agent"),                  
               (try_end), 
               (assign, "$cam_mode", 0),
               (display_message,"@Default Camera"),            
            (try_end),
            (mission_cam_set_mode, "$cam_mode"),
        ])
camera_cycle_fowards =    ( 0, 0, 0,[(key_clicked, key_right),
        (call_script, "script_dmod_cycle_forwards"),
        ], [])      
camera_cycle_backwards = ( 0, 0, 0,[(key_clicked, key_left),
        (call_script, "script_dmod_cycle_backwards"),
        ], [])
###############################################
On every mission template,
1. init the retreat penalty, this can be varied for every mission template, based on their native penalty (this sample is for "lead_charge" mission template) :
Code:
      (0, 0, ti_once, [], [(assign,"$battle_won",0),
                           (assign,"$defender_reinforcement_stage",0),
                           (assign,"$attacker_reinforcement_stage",0),
                           (assign,"$g_presentation_battle_active", 0),
                           (call_script, "script_place_player_banner_near_inventory"),
                           (call_script, "script_combat_music_set_situation_with_culture"),
                           (assign, "$retreat_player_side", 10),	# Retreat Penalty Initialization
                           (assign, "$retreat_enemy_side", 20),		#
                           (assign, "$retreat_type", 2),		#
                          ]),
2. and comment/delete & replace the native retreat confirmation :
Code:
#      (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),					# for mission that has this check give  "$retreat_type" =2, else "$retreat_type"=1	
#          (str_store_string, s5, "str_retreat"),
#          (call_script, "script_simulate_retreat", 10, 20),		# 10 & 20 is assigned to "$retreat_player_side" and "$retreat_enemy_side"
#        (try_end),
#        (call_script, "script_count_mission_casualties_from_agents"),
#        (finish_mission,0),]),
# Replaced by :
      retreat_confirm,
3. and comment/delete & replace the native player fallen check :
Code:
      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),
#              (assign, "$g_battle_result", -1),
#              (set_mission_result,-1),
#              (call_script, "script_count_mission_casualties_from_agents"),
#              (finish_mission,0)]),
# Replaced by :
      common_battle_check_defeat_condition,
      common_battle_result_display,  
      player_fall_check_continue,
Add the camera triggers :
Code:
      camera_init,	
      camera_mode,
      camera_zoom_out,
      camera_zoom_in,
      camera_raise,
      camera_lower,
      camera_set,
      camera_cycle_fowards,
      camera_cycle_backwards,

Code:
on "game_start" script, add camera position initialization :
  ("game_start",
   [
      # DUNDE : Camera Init
      (assign, "$g_camera_z", 600),
      (assign, "$g_camera_y", -1000),
add new scripts :
Code:
  # Modified MartinF's code for DeathCam 
  # script_dmod_cycle_forwards
  # Output: New $dmod_current_agent
  # Used to cycle forwards through valid agents
  ("dmod_cycle_forwards",[
     (assign, ":agent_moved", 0),
     (assign, ":first_agent", -1),
     (get_player_agent_no, ":player_agent"),
     (agent_get_team, ":player_team", ":player_agent"),
     (try_for_agents, ":agent_no"),
        (neq, ":agent_moved", 1),
        (agent_is_human, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_get_team, ":cur_team", ":agent_no"),
	###############################################################
	# This is for compability with my new tournament only 	
        #(this_or_next|eq, "$cam_free", 1),
	###############################################################         
        (eq, ":cur_team", ":player_team"),
        (try_begin),
           (lt, ":first_agent", 0),                         # Find the 1st agent alive and (1 team or free mod)
           (assign, ":first_agent", ":agent_no"),
        (try_end),
        (gt, ":agent_no", "$cam_current_agent"),            # Find next agent  alive and (1 team or free mod)
        (assign, "$cam_current_agent", ":agent_no"),
        (assign, ":agent_moved", 1),
     (try_end),
     (try_begin),
        (eq, ":agent_moved", 0),                            # Next Agent not found, but 1st agent found, then the next is the first one
        (neq, ":first_agent", -1),
        (assign, "$cam_current_agent", ":first_agent"),
        (assign, ":agent_moved", 1),        
     (else_try),
        (eq, ":agent_moved", 0),
        (eq, ":first_agent", -1),
        (display_message, "@No Troops Left."),
     (try_end),
     (try_begin),
        (eq, ":agent_moved", 1),                            # there is next one
         (try_begin),
             (agent_is_alive, ":player_agent"),             # if player is still alive, push to mode 1
             (assign, "$cam_mode", 1),
             (mission_cam_set_mode, "$cam_mode"),
         (try_end),
         (str_store_agent_name, 1, "$cam_current_agent"),
     (try_end),
    ]),
   
  # script_dmod_cycle_backwards
  # Output: New $dmod_current_agent
  # Used to cycle backwards through valid agents
  ("dmod_cycle_backwards",[
      (assign, ":new_agent", -1),
      (assign, ":last_agent", -1),
      (get_player_agent_no, ":player_agent"),
      (agent_get_team, ":player_team", ":player_agent"),
      (try_for_agents, ":agent_no"),
         (agent_is_human, ":agent_no"),
         (agent_is_alive, ":agent_no"),
         (agent_get_team, ":cur_team", ":agent_no"),
	###############################################################
	# This is for compability with my new tournament only
        #(this_or_next|eq, "$cam_free", 1),    
	############################################################### 	
         (eq, ":cur_team", ":player_team"),
         (assign, ":last_agent", ":agent_no"),          # Ok, the last
         (lt, ":agent_no", "$cam_current_agent"),
         (assign, ":new_agent", ":agent_no"),           # prev agent    
      (try_end),
      (try_begin),
         (eq, ":new_agent", -1),
         (neq, ":last_agent", -1),
         (assign, ":new_agent", ":last_agent"),               
      (else_try),
         (eq, ":new_agent", -1),
         (eq, ":last_agent", -1),
         (display_message, "@No Troops Left."),
      (try_end),
      (try_begin),
         (neq, ":new_agent", -1),                       # There is prev agent
         (assign, "$cam_current_agent", ":new_agent"), 
         (try_begin),
             (agent_is_alive, ":player_agent"),
             (assign, "$cam_mode", 1),
             (mission_cam_set_mode, "$cam_mode"),
         (try_end),
         (str_store_agent_name, 1, "$cam_current_agent"),
      (try_end),
   ]),

EDIT 1:
adding triggers :
common_battle_check_victory_condition,
common_battle_victory_display,
common_battle_check_defeat_condition,
common_battle_defeat_display,
Thanks for Red River for noting this.

EDIT 2 :
Totally new code.
 

Kuba

Knight
Best answers
0
I just made a small script and I thought it would be nice to share it with modding community  :smile:

This script can change template of any (I think so) party.

Code:
	#script_change_party_template by Kuba
	#INPUT: arg1=party_no, arg2=template_no,
	#OUTPUT: $g_encountered_party = party_no after template change
	("change_party_template", [
		(store_script_param_1, ":party_no"),
		(store_script_param_2, ":template_no"),
		
		(str_store_party_name, s19, ":party_no"),
		(set_spawn_radius, 0),
		(spawn_around_party, ":party_no", ":template_no"),
		(assign, ":new_party", reg0),
		(party_set_name, ":new_party", s19),
		(call_script, "script_party_add_party", ":new_party", ":party_no"),
		(try_for_range, ":cur_slot", 0, 500),
			(party_get_slot, ":cur_value", ":party_no", ":cur_slot"),
			(party_set_slot, ":new_party", ":cur_slot", ":cur_value"),
		(try_end),
		(try_for_range, ":troop_no", kingdom_heroes_begin, kingdom_heroes_end),
			(troop_slot_eq, ":troop_no", slot_troop_leaded_party, ":party_no"),
			(troop_set_slot, ":troop_no", slot_troop_leaded_party, ":new_party"),
			(assign, ":party_leader", ":troop_no"),
		(try_end),
		(store_faction_of_party, ":cur_faction", ":party_no"),
		(party_set_faction, ":new_party", ":cur_faction"),
		(try_begin),
			(gt, ":party_leader", 0),
			(troop_get_slot, ":cur_banner", ":party_leader", slot_troop_banner_scene_prop),
			(val_sub, ":cur_banner", banner_scene_props_begin),
			(val_add, ":cur_banner", banner_map_icons_begin),
			(party_set_banner_icon, ":new_party", ":cur_banner"),
		(try_end),
		(get_party_ai_behavior, ":cur_bhvr", ":party_no"),
		(get_party_ai_object, ":cur_ai_obj", ":party_no"),
		(party_get_ai_target_position, pos1, ":party_no"),
		(party_set_ai_behavior, ":new_party", ":cur_bhvr"),
		(party_set_ai_object, ":new_party", ":cur_ai_obj"),
		(party_set_ai_target_position, ":new_party", pos1),
		(remove_party, ":party_no"),
		(assign, "$g_encountered_party", ":new_party"),
		]),
 

MaverickJones

Sergeant
WBNWWF&S
Best answers
0
Updated and better version of my troop recruiting companions script :razz:
You can now choose how many troops you want to recruit

:September 2012:
Companion recruit script updated for warband (includes sarranids).

Old (working) version
Code:
# Maverick Companion Script Start #EPIC#
  #Gain 20000 gold randomly if cheat mode is on
  [anyone|plyr,"member_question_2", [(eq,"$cheat_mode",1)], "Cheat: Could you give me some cash from that large pot of gold?", "member_moneys",[]],
  #recruit troops for a price
  [anyone|plyr,"member_question_2", [], "Could you draft in some troops for me?", "member_draft_question",[]],



  [anyone, "member_moneys", [
	    (call_script, "script_troop_add_gold", "trp_player", 20000),
		], "Sure why not, there is plenty in here", "do_member_view_char",[]],
		
  [anyone, "member_draft_question", [], "So what kind of troops do you want?", "member_draft_troop",[]],
  
  [anyone|plyr,"member_draft_troop", [], "I would like some Caravan guards.", "member_draft_troop_big_small",[ (assign, "$cost_draft", 400),(assign, "$draft_id", "trp_caravan_guard"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Watchmen.", "member_draft_troop_big_small",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_watchman")]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Huntresses.", "member_draft_troop_big_small",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_hunter_woman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Slave Drivers.", "member_draft_troop_big_small",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_slave_driver"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Swadian recruits.", "member_draft_troop_big_small",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_swadian_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Veagir recruits.", "member_draft_troop_big_small",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_vaegir_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Khergit tribesmen.", "member_draft_troop_big_small",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_khergit_tribesman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Nord recruits.", "member_draft_troop_big_small",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_nord_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Rhodok tribesmen.", "member_draft_troop_big_small",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_rhodok_tribesman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Sarranid recruit.", "member_draft_troop_big_small",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_sarranid_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Looters.", "member_draft_troop_big_small",[(assign, "$cost_draft", 50), (assign, "$draft_id", "trp_looter"),]],
  [anyone|plyr,"member_draft_troop", [], "Never mind.", "close_window",[]],

  [anyone, "member_draft_troop_big_small",[],"Will you need many soldiers?","member_draft_big_small_ans",[]],  
  [anyone|plyr,"member_draft_big_small_ans", [], "I will need many soldiers.", "member_draft_troop_question2",[(assign, "$draft_big", 1),]],
  [anyone|plyr,"member_draft_big_small_ans", [], "I only need a few soldiers.", "member_draft_troop_question2",[(assign, "$draft_big", 0),]], 
  [anyone|plyr,"member_draft_big_small_ans", [], "Never mind.", "close_window",[]],
   
  [anyone, "member_draft_troop_question2", [], "How many troops do you want?", "member_draft_troop_2",[]],
   [anyone|plyr,"member_draft_troop_2", [], "I would like 100.", "member_draft_troop_3",[ (assign, "$draft_num", 100)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 1),], "I would like 50.", "member_draft_troop_3",[(assign, "$draft_num", 50)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 1),], "I would like 40.", "member_draft_troop_3",[(assign, "$draft_num", 40)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 1),], "I would like 35.", "member_draft_troop_3",[(assign, "$draft_num", 35)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 1),], "I would like 30.", "member_draft_troop_3",[(assign, "$draft_num", 30)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 1),], "I would like 25.", "member_draft_troop_3",[(assign, "$draft_num", 25)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 1),], "I would like 20.", "member_draft_troop_3",[(assign, "$draft_num", 20)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 1),], "I would like 15.", "member_draft_troop_3",[(assign, "$draft_num", 15)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 10.", "member_draft_troop_3",[ (assign, "$draft_num", 10)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 0),], "I would like 9.", "member_draft_troop_3",[(assign, "$draft_num", 9)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 0),], "I would like 8.", "member_draft_troop_3",[(assign, "$draft_num", 8)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 0),], "I would like 7.", "member_draft_troop_3",[(assign, "$draft_num", 7)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 0),], "I would like 6.", "member_draft_troop_3",[(assign, "$draft_num", 6)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 5.", "member_draft_troop_3",[(assign, "$draft_num", 5)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 0),], "I would like 4.", "member_draft_troop_3",[(assign, "$draft_num", 4)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 0),], "I would like 3.", "member_draft_troop_3",[(assign, "$draft_num", 3)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 0),], "I would like 2.", "member_draft_troop_3",[(assign, "$draft_num", 2)]],
  [anyone|plyr,"member_draft_troop_2", [(eq, $draft_big, 0),], "I would like 1.", "member_draft_troop_3",[(assign, "$draft_num", 1)]],
  [anyone|plyr,"member_draft_troop_2", [], "Never mind.", "close_window",[]],
  
  [anyone, "member_draft_troop_3", [
  (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
     (val_min, "$draft_num", ":free_capacity"),
     (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", "$cost_draft"),#denars relevant to the troop you are hiring
	 (val_min, "$draft_num", ":gold_capacity"),
     (party_add_members, "p_main_party", "$draft_id", "$draft_num"),# sets troop to the one you chose
     (store_mul, ":cost", "$draft_num", "$cost_draft"),
     (troop_remove_gold, "trp_player", ":cost"),	
	 ], "It didn't take much to convince them to join you, Hope they serve you well.", "do_member_view_char",[]],
#This new piece of script allows you to recruit from 1 to 10 troops rather than the previous locked 10 :D
 
# Maverick Companion Script End #EPIC#

New Version (beta, not fully tested) larger sizes, and written specifically for warband, includes a little more dialogue than before.
Code:
  # Maverick Companion Script Start #EPIC#
  #Gain 20000 gold randomly if cheat mode is on
  [anyone|plyr,"member_question_2", [(eq,"$cheat_mode",1)], "Cheat: Could you give me some cash from that large pot of gold?", "member_moneys",[]],
  #recruit troops for a price
  [anyone|plyr,"member_question_2", [], "Could you draft in some troops for me?", "member_draft_question",[]],

  [anyone, "member_moneys", [
	    (call_script, "script_troop_add_gold", "trp_player", 20000),
		], "Sure why not, there is plenty in here", "do_member_view_char",[]],
		
  [anyone, "member_draft_question", [], "So what kind of troops do you want?", "member_draft_troop",[]],
  
  [anyone|plyr,"member_draft_troop", [], "I would like some Caravan guards.", "member_draft_troop_question2",[ (assign, "$cost_draft", 400),(assign, "$draft_id", "trp_caravan_guard"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Watchmen.", "member_draft_troop_question2",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_watchman")]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Huntresses.", "member_draft_troop_question2",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_hunter_woman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Slave Drivers.", "member_draft_troop_question2",[(assign, "$cost_draft", 200), (assign, "$draft_id", "trp_slave_driver"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Swadian recruits.", "member_draft_troop_question2",[(assign, "$cost_draft", 150), (assign, "$draft_id", "trp_swadian_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Veagir recruits.", "member_draft_troop_question2",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_vaegir_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Khergit tribesmen.", "member_draft_troop_question2",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_khergit_tribesman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Nord recruits.", "member_draft_troop_question2",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_nord_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Rhodok tribesmen.", "member_draft_troop_question2",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_rhodok_tribesman"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Sarranid recruit.", "member_draft_troop_question2",[(assign, "$cost_draft", 100), (assign, "$draft_id", "trp_sarranid_recruit"),]],
  [anyone|plyr,"member_draft_troop", [], "I would like some Looters.", "member_draft_troop_question2",[(assign, "$cost_draft", 50), (assign, "$draft_id", "trp_looter"),]],
  [anyone|plyr,"member_draft_troop", [], "Never mind.", "close_window",[]],

  [anyone, "member_draft_troop_question2", [], "How many troops do you want?", "member_draft_troop_2",[]],
    
  [anyone|plyr,"member_draft_troop_2", [], "I would like 100.", "member_draft_troop_3",[ (assign, "$draft_num", 100)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 50.", "member_draft_troop_3",[(assign, "$draft_num", 50)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 40.", "member_draft_troop_3",[(assign, "$draft_num", 40)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 35.", "member_draft_troop_3",[(assign, "$draft_num", 35)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 30.", "member_draft_troop_3",[(assign, "$draft_num", 30)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 25.", "member_draft_troop_3",[(assign, "$draft_num", 25)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 20.", "member_draft_troop_3",[(assign, "$draft_num", 20)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 15.", "member_draft_troop_3",[(assign, "$draft_num", 15)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 10.", "member_draft_troop_3",[(assign, "$draft_num", 10)]],
  [anyone|plyr,"member_draft_troop_2", [], "I would like 5.", "member_draft_troop_3",[(assign, "$draft_num", 5)]],
  [anyone|plyr,"member_draft_troop_2", [], "Never mind.", "close_window",[]],
#This new piece of script allows you to recruit from 1 to 10 troops rather than the previous locked 10  or if you like bigger numbers (later on in the game) 5 - 100 soldiers :D
## add soldiers to party and print some stuff  
#Old answer
#  [anyone, "member_draft_troop_3", [
#  (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
#     (val_min, "$draft_num", ":free_capacity"),
#     (store_troop_gold, ":gold", "trp_player"),
#     (store_div, ":gold_capacity", ":gold", "$cost_draft"),#denars relevant to the troop you are hiring
#	 (val_min, "$draft_num", ":gold_capacity"),
#     (party_add_members, "p_main_party", "$draft_id", "$draft_num"),# sets troop to the one you chose
#     (store_mul, ":cost", "$draft_num", "$cost_draft"),
#     (troop_remove_gold, "trp_player", ":cost"),	
#	 ], "It didn't take much to convince them to join you, Hope they serve you well.", "do_member_view_char",[]],
# new version of resulting answer
	 [anyone, "member_draft_troop_3", [
	 (party_get_free_companions_capacity, ":free_capacity", "p_main_party"), 
	 (store_troop_gold, ":gold", "trp_player"),
     (store_div, ":gold_capacity", ":gold", "$cost_draft"),#denars relevant to the troop you are hiring
	 (store_mul, ":cost", "$draft_num", "$cost_draft"),
	 (try_begin)
	 (ge, ":gold", ":cost"), 
	#this line would check to see if party is full (gt, ":free_capacity",0), but currently adding it bugs my game.
		(val_min, "$draft_num", ":free_capacity"),
		(val_min, "$draft_num", ":gold_capacity"),
		(party_add_members, "p_main_party", "$draft_id", "$draft_num"),# sets troop to the one you chose
		(troop_remove_gold, "trp_player", ":cost"),
		(str_store_troop_name, s9, "$draft_id"),
		(assign, reg3, ":cost"),
		(assign, reg5, "$draft_num"),
		(str_store_string, s17, "Allright, I've recruited {reg5} {s9} as you ordered, it has cost me {reg3} denars to recruit them. Use them well. {m'lord/m'lady}."),
	 (else_try)
	 	(lt, ":gold", ":cost"),
	 	(str_store_troop_name, s9, "$draft_id"),
		(assign, reg3, ":cost"),
		(assign, reg5, "$draft_num"),
		(assign, reg6, ":gold"),
		(str_store_string, s17, "{M'lord/M'lady}, I'm afraid you have insufficient funds to recruit {reg5} {s9} like you wanted, it would cost me {reg3} denars to recruit them and you've only got {reg6} denars. talk to me again when you've enough money."),
	 #(else_try) # third if would be have enough money but not enough space in the party
	 #	(le, ":free_capacity", "0"),
	 #	(str_store_troop_name, s9, "$draft_id"),
	 #  	(assign, reg3, ":cost"),
	 #	(assign, reg5, "$draft_num"),
	 #	(assign, reg6, ":gold"),
	 #	(str_store_string, s17, "{M'lord/M'lady}, I'm afraid you don't have enough space in your party for an extra {reg5} soldiers even if they are {s9} like you wanted, free up some space and then come back and talk to me."),
	 #
	 (try_end)
	 ],"{s17}","do_member_view_char",[]], 
# use this to store resulting text	(str_store_string, s17, "text"),

 
# Maverick Companion Script End #EPIC#
 

Arch

Master Knight
M&BWB
Best answers
0
This is a script I found from Cruger, props to dzorro for fixing it:

Faction Patrols

Go into module_triggers.py, and uncomment this:
Code:
##      (try_begin),
##        (store_random_in_range, ":random_no", 0, 100),
##        (lt, ":random_no", 10),
##        (call_script, "script_create_kingdom_party_if_below_limit", ":cur_kingdom", spt_patrol),
##      (try_end),
then go to module_scripts.py and uncomment this:
Code:
##        (eq, ":party_type", spt_patrol),
##        (assign, ":party_count_limit", 1),
##      (else_try),
and this
Code:
##        (eq, ":party_type", spt_patrol),
##        (assign, ":party_template", "pt_patrol_party"),
#        (assign, ":party_name_str", "str_s7_patrol"), <---- keep this outcommented
##      (else_try),
Also, uncomment this in module_constants.py:
Code:
spt_patrol             = 7
And you have faction patrols. :smile: