How to create unique/special units?

Users who are viewing this thread

agunter999

Recruit
How do you create unique/special units that only certain lords can recruit much like in A Clash of Kings and the how would it be possible that they can only be recruited in certain villages to where that lord ruled in theory?

Mods currently do it but I havebt found any source code for it. Any help would be amazing thanks
 
With module system.
By altering script cf_reinforce_party with either a set of try_begin - else try - else try - ... - try_end operations aimed at adding particular soldiers to particular lords or by requesting data from previously filled slots for such lords (like slot_lord_unique_troop, slot_lord_unique_troop_max_quantity).

Code:
	("initialize_aristocracy", #search "The first thing - family structure" to move to code and skip manual settings
	[
#...
	  (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop, "trp_k01_tol_n_champion"), #lvl 60
	  (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop_max_quantity, quantity_lvl57_65), 

	  (troop_set_slot, "trp_knight_1_3", slot_lord_unique_template, "pt_lord_ut_enduinius"),
	  (troop_set_slot, "trp_knight_1_3", slot_lord_unique_troop, "trp_k01_tol_kingsman"), #lvl 38
	  (troop_set_slot, "trp_knight_1_3", slot_lord_unique_troop_max_quantity, quantity_lvl30_39), 
#...
]

Code:
 # script_cf_reinforce_party
  # Input: arg1 = party_no,
  # Output: none
  # Adds reinforcement to party according to its type and faction
  # Called from several places, simple_triggers for centers, script_hire_men_to_kingdom_hero_party for hero parties
  ("cf_reinforce_party",
    [
#...
		(try_begin),
			(troop_slot_eq, ":leader", slot_lord_troops_override, 0), #lord isn't forced to use specific troops
			(troop_slot_ge, ":leader", slot_lord_unique_troop, 1), #and he's got unique troops
			(troop_get_slot, ":unique_troops", ":leader", slot_lord_unique_troop),
			(troop_get_slot, ":unique_troops_max_quantity", ":leader", slot_lord_unique_troop_max_quantity),
			(store_random_in_range, ":random_number_of_troops", 0, ":unique_troops_max_quantity"),
			(party_add_members, ":party_no", ":unique_troops", ":random_number_of_troops"),
		(try_end),
#...

P.S. For simple questions there is Q& thread.
https://forums.taleworlds.com/index.php/topic,6575.0.html
 
Thanks for the reply,

I'm a bit new to M&B modding (ive a fair experience in modding though not in python) where would I define
Code:
 slot_lord_troops_override, slot_lord_unique_troop
  If you haven't guessed I get the slot_lord_troops_override not defined error

 
Ok that works :grin:

however when using the  cf_reinforce_party  improvement I see no change in game. the lord only uses faction units. Am I missing something, do I need to define his units in a way other than the party_template?
 
Well, I added your script

Code:
		(try_begin),
			(troop_slot_eq, ":leader", slot_lord_troops_override, 0), #lord isn't forced to use specific troops
			(troop_slot_ge, ":leader", slot_lord_unique_troop, 1), #and he's got unique troops
			(troop_get_slot, ":unique_troops", ":leader", slot_lord_unique_troop),
			(troop_get_slot, ":unique_troops_max_quantity", ":leader", slot_lord_unique_troop_max_quantity),
			(store_random_in_range, ":random_number_of_troops", 0, ":unique_troops_max_quantity"),
			(party_add_members, ":party_no", ":unique_troops", ":random_number_of_troops"),
		(try_end),

then I added a party template

Code:
("kingdom_12_lord_unique_troops", "{!}kingdom_12_lord_unique_troops", 0, 0, fac_commoners, 0, [(trp_kaiser_swadian_recruit,10,15)] ),

and obviously the troop and the lord and faction that go with them.

and then the constants

Code:
slot_lord_troops_override			= 3333		
slot_lord_unique_troop				= 3334
slot_lord_unique_troop_max_quantity		= 3335
 
First, there is party_add_members operation and there is party_add_template operation.
The operation from my code works with troops, not templates.

Second, you "declared" the slots, but the most important thing is filling them.
Go to game_start script or any other script that only runs once at the start of the game, like initialize_faction_troop_types or initialize_aristocracy.
And use troop_set_slot operation to actually fill the slots. I gave examples above.

 
Code:
    ("initialize_faction_troop_types",
    [

	  (troop_set_slot, "trp_kingdom_12_lord", slot_lord_unique_troop, "trp_kaiser_swadian_recruit"), 
	  (troop_set_slot, "trp_kingdom_12_lord", slot_lord_unique_troop_max_quantity, quantity_lvl4_65), 


      (try_for_range, ":faction_no", kingdoms_begin, kingdoms_end),
        (faction_get_slot, ":culture", ":faction_no", slot_faction_culture),
	  
        (faction_get_slot, ":troop", ":culture",  slot_faction_tier_1_troop),

Its giving me a syntax error on
Code:
	  (troop_set_slot, "trp_kingdom_12_lord", slot_lord_unique_troop, "trp_kaiser_swadian_recruit"), 
 
good afternoon. do not tell me what is the error?
I understand that there is a mistake, but in what?

(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),

Scripts
Python:
    ("initialize_faction_troop_types",
    [

      (troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),   
      (troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop, "trp_nogai_kazak"),
      (troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl14_65),

      (try_for_range, ":faction_no", kingdoms_begin, kingdoms_end),
        (faction_get_slot, ":culture", ":faction_no", slot_faction_culture),

        (faction_get_slot, ":troop", ":culture",  slot_faction_tier_1_troop),
        (faction_set_slot, ":faction_no",  slot_faction_tier_1_troop, ":troop"),
        (faction_get_slot, ":troop", ":culture",  slot_faction_tier_2_troop),
        (faction_set_slot, ":faction_no",  slot_faction_tier_2_troop, ":troop"),
        (faction_get_slot, ":troop", ":culture",  slot_faction_tier_3_troop),
        (faction_set_slot, ":faction_no",  slot_faction_tier_3_troop, ":troop"),
        (faction_get_slot, ":troop", ":culture",  slot_faction_tier_4_troop),
        (faction_set_slot, ":faction_no",  slot_faction_tier_4_troop, ":troop"),
        (faction_get_slot, ":troop", ":culture",  slot_faction_tier_5_troop),
        (faction_set_slot, ":faction_no",  slot_faction_tier_5_troop, ":troop")
    
        (try_begin),
          (faction_slot_eq, ":faction_no", slot_faction_culture, "fac_culture_1"),

          (faction_set_slot, ":faction_no",  slot_faction_deserter_troop, "trp_swadian_deserter"),

Python:
  ("cf_reinforce_party",
    [
      (store_script_param_1, ":party_no"),

      (store_faction_of_party, ":party_faction", ":party_no"),
      ##diplomacy start+ The party faction may be changed for culture, but we still need the original
      (assign, ":real_party_faction", ":party_faction"),
      ##diplomacy end+
      (party_get_slot, ":party_type",":party_no", slot_party_type),

        (try_begin),
            (troop_slot_eq, ":leader", slot_lord_troops_override, 0), #lord isn't forced to use specific troops
            (troop_slot_ge, ":leader", slot_lord_unique_troop, 1), #and he's got unique troops
            (troop_get_slot, ":unique_troops", ":leader", slot_lord_unique_troop),
            (troop_get_slot, ":unique_troops_max_quantity", ":leader", slot_lord_unique_troop_max_quantity),
            (store_random_in_range, ":random_number_of_troops", 0, ":unique_troops_max_quantity"),
            (party_add_members, ":party_no", ":unique_troops", ":random_number_of_troops"),
        (try_end),
    
#Rebellion changes begin:
      (try_begin),
        (eq, ":party_type", spt_kingdom_hero_party),
        (party_stack_get_troop_id, ":leader", ":party_no"),
        (troop_get_slot, ":party_faction",  ":leader", slot_troop_original_faction),
        ##diplomacy start+ Use player culture for companions and spouse (and any hypothetical non-hero mercenaries)
        (eq, ":real_party_faction", "fac_player_supporters_faction"),
        (is_between, "$g_player_culture", kingdoms_begin, kingdoms_end), ## Tocan
        (this_or_next|is_between, ":leader", companions_begin, companions_end),
        (this_or_next|troop_slot_eq, "trp_player", slot_troop_spouse, ":leader"),
           (neg|is_between, ":leader", heroes_begin, heroes_end),
        (assign, ":party_faction", "$g_player_culture"),
        ##diplomacy end+
      (try_end),
#Rebellion changes end

Party templates
Python:
("lord_nogai_unique_troops", "{!}lord_nogai_unique_troops", 0, 0, fac_commoners, 0, [(trp_nogai_kazak,30,65)] ),

Constants
Python:
#CONTROVERSY
#This is used to create a more "rational choice" model of faction politics, in which lords pick fights with other lords for gain, rather than simply because of clashing personalities
#It is intended to be a limiting factor for players and lords in their ability to intrigue against each other. It represents the embroilment of a lord in internal factional disputes. In contemporary media English, a lord with high "controversy" would be described as "embattled."
#The main effect of high controversy is that it disqualifies a lord from receiving a fief or an appointment
#It is a key political concept because it provides incentive for much of the political activity. For example, Lord Red Senior is worried that his rival, Lord Blue Senior, is going to get a fied which Lord Red wants. So, Lord Red turns to his protege, Lord Orange Junior, to attack Lord Blue in public. The fief goes to Lord Red instead of Lord Blue, and Lord Red helps Lord Orange at a later date.


slot_troop_will_join_prison_break      = 161


slot_lord_troops_override            = 162     
slot_lord_unique_troop                = 163
slot_lord_unique_troop_max_quantity        = 164

troop_slots_reserved_for_relations_start        = 165 #this is based on id_troops, and might change

slot_troop_relations_begin                = 0 #this creates an array for relations between troops
                                            #Right now, lords start at 165 and run to around 290, including pretenders

An error like this is issued
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_init.py", line 2, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_global_variables.py", line 12, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_map_icons.py", line 6, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_items.py", line 66, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Exporting scene data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_scenes.py", line 15, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_scene_props.py", line 7, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_tableau_materials.py", line 8, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_presentations.py", line 8, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Exporting party_template data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_parties.py", line 6, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_scripts.py", line 4, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_mission_tmps.py", line 8, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_game_menus.py", line 8, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_simple_triggers.py", line 5, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_dialogs.py", line 9, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_global_variables_unused.py", line 3, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10481, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
NameError: name 'slot_lord_unique_template' is not defined
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .
 
Last edited:
after adding to constants slot_lord_unique_template, it produces the following when compiled

Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_init.py", line 2, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_global_variables.py", line 12, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_map_icons.py", line 6, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_items.py", line 66, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Exporting scene data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_scenes.py", line 15, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_scene_props.py", line 7, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lv10_65),
NameError: name 'quantity_lv10_65' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_tableau_materials.py", line 8, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_presentations.py", line 8, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Exporting party_template data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_parties.py", line 6, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lv10_65),
NameError: name 'quantity_lv10_65' is not defined
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_scripts.py", line 4, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_mission_tmps.py", line 8, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_game_menus.py", line 8, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lv10_65),
NameError: name 'quantity_lv10_65' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_simple_triggers.py", line 5, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_dialogs.py", line 9, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Traceback (most recent call last):
File "F:\Games\Warband\Modules\1487AD\Source Code\process_global_variables_unused.py", line 3, in <module>
from process_operations import *
File "F:\Games\Warband\Modules\1487AD\Source Code\process_operations.py", line 20, in <module>
from module_scripts import *
File "F:\Games\Warband\Modules\1487AD\Source Code\module_scripts.py", line 10469, in <module>
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
NameError: name 'quantity_lvl10_65' is not defined
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .
 
Last edited:
Either you define them in module_constants, like you did with the slot, or you assign a value to it within the script which is using the constant. I however don't know why you wrote now
Code:
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl10_65),
Before you have had
Code:
(troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),
 
So it seems like this is here

Python:
      (troop_set_slot, "trp_knight_14_5", slot_lord_unique_template, "pt_lord_nogai_unique_troops"), 
      (troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop, "trp_nogai_kazak"),
      (troop_set_slot, "trp_knight_14_5", slot_lord_unique_troop_max_quantity, quantity_lvl14_65),

according to the pattern above

Python:
(troop_set_slot, "trp_knight_1_3", slot_lord_unique_template, "pt_lord_ut_enduinius"),
      (troop_set_slot, "trp_knight_1_3", slot_lord_unique_troop, "trp_k01_tol_kingsman"), #lvl 38
      (troop_set_slot, "trp_knight_1_3", slot_lord_unique_troop_max_quantity, quantity_lvl30_39),

This is the scenario, as I understand it, which uses this constant.

Python:
(try_begin),
            (troop_slot_eq, ":leader", slot_lord_troops_override, 0), #lord isn't forced to use specific troops
            (troop_slot_ge, ":leader", slot_lord_unique_troop, 1), #and he's got unique troops
            (troop_get_slot, ":unique_troops", ":leader", slot_lord_unique_troop),
            (troop_get_slot, ":unique_troops_max_quantity", ":leader", slot_lord_unique_troop_max_quantity),
            (store_random_in_range, ":random_number_of_troops", 0, ":unique_troops_max_quantity"),
            (party_add_members, ":party_no", ":unique_troops", ":random_number_of_troops"),
        (try_end),
 
According to the instructions above I made this script and it works, but it works with troops, I would like it to work with templates. Can anybody help me?
Python:
(try_for_range, ":troop_slot", slot_lord_unique_troop, slot_lord_unique_troop_3),
(troop_get_slot, ":unique_troops", ":leader", ":troop_slot"),
(troop_get_slot, ":unique_troops_max_quantity", ":leader", slot_lord_unique_troop_max_quantity),
(gt, ":unique_troops", 0),
(party_add_members, ":party_no", ":unique_troops", ":unique_troops_max_quantity"),
(try_end),

Python:
    ("initialize_faction_troop_types",
    [
      ##ediion doblettes
   
    #(troop_set_slot, "trp_kingdom_2_lord", slot_lord_unique_template, "pt_lord_nogai_unique_troops"),  
    (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop, "trp_kingbom_sergeant"),
    (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop_max_quantity, quantity_lvl30_39),
   
    (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop_1, "trp_kingbom_longbow"),
    (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop_max_quantity_1, quantity_lvl30_39),
   
    (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop_2, "trp_kingbom_knight"),
    (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop_max_quantity_2, quantity_lvl30_39),
   
    (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop_3, "trp_caballero_bohemio"),
    (troop_set_slot, "trp_kingdom_1_lord", slot_lord_unique_troop_max_quantity_3, quantity_lvl30_39),
 
Last edited by a moderator:
Back
Top Bottom