Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Thanks for the advice :smile: Got my sleep & coffee, and now was able to get it all to work, except for one thing (where I'm using the script).

My original code for a condition block of a menu is the below:

Code:
             (store_faction_of_party, ":faction_no", "$g_encountered_party"),
	     (faction_get_slot, ":faction_strength", ":faction_no", slot_faction_strength), #Check Faction Strength
	 	 
	     (party_get_slot, ":siegable", "$g_encountered_party", slot_center_siegability), #Check if we can siege
	     
	     (neq, ":siegable", tld_siegable_never), #some places are never siegable
	     (neq, ":siegable", tld_siegable_capital), #We won't allow players to siege capitals
	     
	     (this_or_next|eq, "$tld_option_siege_reqs", 2), # No siege reqs
	     (this_or_next|eq, ":siegable", tld_siegable_always), # camps and such can always be sieged
	     (lt, ":faction_strength", "$g_fac_str_siegable"), # otherwise, defenders need to be weak

I want to change one line there (neq, ":siegable", tld_siegable_capital) to check that if the center is a capital, check first if there are any other centers left. If only one is left (i.e the capital), then condition passes. So I wrote this instead:

Code:
             (party_get_slot, ":siegable", "$g_encountered_party", slot_center_siegability), #Check if we can siege

	     (assign, ":continue", 0),
	     
	     (try_begin),
	     	(eq, ":siegable", tld_siegable_capital), #If it is the capital, check if there are other centers left
	     	(call_script, "script_cf_check_if_only_capital_left", "$g_encountered_party"), #fails when there is more than 1 center left.
	     	(assign, ":continue", 1),
	      (else_try),    
		 (neq, ":siegable", tld_siegable_never), #some places are never siegable
		 (assign, ":continue", 0),
	      (else_try),
		 (this_or_next|eq, "$tld_option_siege_reqs", 2), # No siege reqs
	     	 (this_or_next|eq, ":siegable", tld_siegable_always), # camps and such can always be sieged
	     	 (lt, ":faction_strength", "$g_fac_str_siegable"), # otherwise, defenders need to be weak
	     	 (assign, ":continue", 1),
	      (try_end),

	      (eq, ":continue", 1),

Doesnt seem to work properly... It never gets past the (eq, ":continue", 1) line. Am I doing this right?
 
Khamukkamu said:
Doesnt seem to work properly... It never gets past the (eq, ":continue", 1) line. Am I doing this right?

review you cf_ script. It is a [can fail script], so it will return TRUE or FALSE.

then review your block conditions, you have a few issues there.

you could add logging to help with the test too.

the use of the ":continue" is OK
 
Khamukkamu said:
Thanks, for a cf script, if it fails, does the code continue to the next 'else' block? or it ends the whole 'try' block?

the cf_ script is just like another operation, so it works the same way. What happens inside a try_block when a line fails? It goes to the next else_try, until it doesn't find any.
 
         
Code:
  (party_get_slot, ":siegable", "$g_encountered_party", slot_center_siegability), #Check if we can siege


##Insert log messages like this
             (assign, reg33, ":siegable"),
             (display_log_message, "@{reg33} is siegable"),

	     (assign, ":continue", 0),
	     
	     (try_begin),
	     	(eq, ":siegable", tld_siegable_capital), #If it is the capital, check if there are other centers left
	     	(call_script, "script_cf_check_if_only_capital_left", "$g_encountered_party"), #fails when there is more than 1 center left.
	     	(assign, ":continue", 1),
	      (else_try),    
		 (neq, ":siegable", tld_siegable_never), #some places are never siegable
		 (assign, ":continue", 0),
	      (else_try),
		 (this_or_next|eq, "$tld_option_siege_reqs", 2), # No siege reqs
	     	 (this_or_next|eq, ":siegable", tld_siegable_always), # camps and such can always be sieged
	     	 (lt, ":faction_strength", "$g_fac_str_siegable"), # otherwise, defenders need to be weak
	     	 (assign, ":continue", 1),
	      (try_end),

	      (eq, ":continue", 1),
 
Hi,
https://i.hizliresim.com/7yEpBY.jpg
I added item. But giving that error same as troops. Codes of item are these:
["iberian_kiyafet_a", "Iberian Cloth", [("iberian_kiyafet_a",0)], itp_merchandise| itp_type_body_armor  |itp_covers_legs ,0,
863 , weight(1:cool:|abundance(100)|head_armor(0)|body_armor(24)|leg_armor(2)|difficulty(6) ,imodbits_armor ],
What should I do?
 
Thanks JuJu70, I've never used that operation for log messages before. Good to know!

I've fixed my errors and it works as designed now :smile: Now, we allow players to siege capitals only if there are no other centers left (I've also moved things around, as I forgot that order matters):

Code:
             (assign, ":continue", 0),
	     
	     (try_begin),
	     	(eq, ":siegable", tld_siegable_never), #some places are never siegable
		#(display_message, "@Passed 1st"),
		(assign, ":continue", 0),
	     (else_try),    
	     	(neq, ":siegable", tld_siegable_capital), #not a capital (we have a separate condition below)
		(this_or_next|eq, "$tld_option_siege_reqs", 2), # No siege reqs
	     	(this_or_next|eq, ":siegable", tld_siegable_always), # camps and such can always be sieged
	     	(lt, ":faction_strength", "$g_fac_str_siegable"), # otherwise, defenders need to be weak
	     	#(display_message, "@Passed 2nd"),
	     	(assign, ":continue", 1),
	     (else_try),
		(eq, ":siegable", tld_siegable_capital), #If it is the capital, we will check below if there are other centers left
	     	(this_or_next|eq, "$tld_option_siege_reqs", 2), # No siege reqs
	     	(lt, ":faction_strength", "$g_fac_str_siegable"), #and fac str is low enough to siege
	     	(call_script, "script_cf_check_if_only_capital_left", "$g_encountered_party"), #and there are no other centers left (script fails when there is more than 1 center left.)
	     	#(display_message, "@Passed 3rd"),
	     	(assign, ":continue", 1),
	     (try_end),

	     (eq, ":continue", 1),

Im sure it could be more elegant... but Im just happy it works! :razz:
 
do any one know how to fix this :

name error : name solt_troop_freelancer_start_xp is not defined

this appears when i compile mod
 
Kortlcha said:
Hi,
https://i.hizliresim.com/7yEpBY.jpg
I added item. But giving that error same as troops. Codes of item are these:
["iberian_kiyafet_a", "Iberian Cloth", [("iberian_kiyafet_a",0)], itp_merchandise| itp_type_body_armor  |itp_covers_legs ,0,
863 , weight(1:cool:|abundance(100)|head_armor(0)|body_armor(24)|leg_armor(2)|difficulty(6) ,imodbits_armor ],
What should I do?
 
kalarhan said:
zidozido said:
do any one know how to fix this :

name error : name solt_troop_freelancer_start_xp is not defined

this appears when i compile mod

shows us the code where that variable/name is used

Traceback (most recent call last):
  File "process_init.py", line 2, in <module>
    from process_operations import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
Traceback (most recent call last):
  File "process_global_variables.py", line 12, in <module>
    from process_operations import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
  File "process_map_icons.py", line 6, in <module>
    from process_operations import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 66, in <module>
    from process_operations import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_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 "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_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 "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_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 "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
  File "process_scripts.py", line 4, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
Traceback (most recent call last):
  File "process_game_menus.py", line 8, in <module>
    from process_operations import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\process_operations.py", line 20, in <module>
    from module_scripts import *
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\module_scripts.py", line 55069, in <module>
    modmerge(var_set)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 297, in modmerge
    modmerge__(modcomp_name,var_dict)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\modmerger.py", line 237, in modmerge__
    _temp = __import__( src_module_name ,{} , {}, [mergefn_name],-1)
  File "F:\Mount and Blade - Warband\Modules\Alpujarras Wars  freelancer trials\
Code\freelancer_scripts.py", line 56, in <module>
    (troop_set_slot, "trp_player", slot_troop_freelancer_start_xp, ":mad:p"),
NameError: name 'slot_troop_freelancer_start_xp' is not defined
 
zidozido said:
compiler log stuff

code as in the stuff inside your module_scripts.py, etc, whatever script/etc is using that variable

and remember to use the CODE tag

Code:
code here



slot_troop_freelancer_start_xp -> you forgot to add it to module_constants.py
 
I'm getting a CTD on NW whenever I load in a game with something in particular. The common theme seems to be that one faction is Prussia. Is there any way of finding out why the game crashed, so I can figure out where my mod has gone wrong?
 
Status
Not open for further replies.
Back
Top Bottom