Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Antonis said:
Hello, guys, one question. I am getting this error when I compile:
Code:
ERROR: Usage of unassigned local variable: :town_merchant
But this is already declared in module constants quite clearly, like this: slot_town_merchant      = 23

you are using a variable (":town_merchant") inside a loop/if-then-else (try_begin/try_end) without first giving it a value. Its a warning telling you this could be bad.

Example correct usage:
Code:
(assign, ":town_merchant", 0),
(try_begin),
   ....
   (val_add, ":town_merchant", 10),
   ....
(try_end),

This can lead to a series of problems. Unexpected bugs (logic error) is the most common.
However if you (or any player) is using a Mac/Linux the engine handles those in a different way and can assign to it a negative max integer value. Thats how, as a example, those players can have a budget of -6 billions coins :XD
 
First, When you're camping and a party attacks you, how do you detect that you were camping so that you can then direct the battle to a particular mission template?
I've seen this in mods where you have a camp.

NVM
Just look for
Code:
          (eq, "$g_encounter_type", enctype_catched_during_village_raid),
          (assign, "$g_village_raid_evil", 0),
          (set_jump_mission,"mt_village_raid"),
          (party_get_slot, ":scene_to_use", "$g_encounter_is_in_village", slot_castle_exterior),
          (jump_to_scene, ":scene_to_use"),
and under it have another else try block with
Code:
(eq, "$g_player_icon_state", pis_camping), #camp normal
and that's how


Secondly, I read that to have a castle you must have a village. However, I also saw another mod "A wedding dance" in which the castle was stand alone without a village. How can this be done?
 
_Sebastian_ said:
Seek n Destroy said:
Can someone point me on how to load the lods using the new cur_item_add_mesh operation?
Code:
cur_item_add_mesh                   = 1964  # (cur_item_add_mesh, <mesh_name_string>, [<lod_begin>], [<lod_end>]),
                                            # Version 1.161+. Only call inside ti_on_init_item trigger. Adds another mesh to item, allowing the creation of combined items. Parameter <mesh_name_string> should contain mesh name itself, NOT a mesh reference. LOD values are optional. If <lod_end> is used, it will not be loaded.

#edit, it seems to require an int value, is (cur_item_add_mesh, "@meshname", 1, 4), a valid way to have the operation add the meshname and its lods?
#edit 2, Nope, doesn't seem to be it.
Either get rid of the lod arguments or set both to 0 in order to load all regular lod's.
A bit late for a reply but I could test this only recently and it seems to work just fine, thanks! However I seem to have some problems using it with leg armor, the meshes show up fine as icons but once equipped only the main mesh shows up.

Not working:
Code:
["b_celtic_pants_white", "Bracca", [("b_celtic_pants_white",0)], itp_type_foot_armor|itp_merchandise|itp_civilian, 0, 90, weight(1.5)|abundance(100)|head_armor(0)|body_armor(0)|leg_armor(10)|difficulty(0), imodbits_cloth, [(ti_on_init_item,[(cur_item_add_mesh, "@b_feet_celt", 0, 0),(cur_item_add_mesh, "@b_celtic_shoes", 0, 0),])], [fac_kingdom_3] ],

Working:
Code:
["a_roman_padded_subarmalis", "Subarmalis", [("a_roman_padded_subarmalis",0)], itp_type_body_armor|itp_merchandise|itp_covers_legs|itp_civilian, 0, 400, weight(4)|abundance(100)|head_armor(0)|body_armor(20)|leg_armor(20)|difficulty(0), imodbits_armor, [(ti_on_init_item,[(cur_item_add_mesh, "@b_arms_long", 0, 0),])], [fac_kingdom_1] ],
["a_celtic_tunic_long_white", "Tunic", [("a_celtic_tunic_long_white",0)], itp_type_body_armor|itp_merchandise|itp_covers_legs|itp_civilian, 0, 60, weight(1)|abundance(100)|head_armor(0)|body_armor(12)|leg_armor(8)|difficulty(0), imodbits_cloth, [(ti_on_init_item,[(cur_item_add_mesh, "@b_arms_tunic_celt", 0, 0),(cur_item_add_mesh, "@o_celtic_belt", 0, 0),(store_random_in_range, ":random_num", 0, 3),(try_begin),(eq, ":random_num", 0),(cur_item_add_mesh, "@torc_plain", 0, 0),(else_try),(eq, ":random_num", 1),(cur_item_add_mesh, "@torc_1", 0, 0),(else_try),(eq, ":random_num", 2),(cur_item_add_mesh, "@torc_2", 0, 0),(try_end),])], [fac_kingdom_3] ],
 
Is there a shader that you can do normal maps/bump maps with AND shiny color effects? Kind of like a mix between dot3 and iron shader

EDIT: Also how do you have a specular and a bump map at the same time? Whats the shader called?
 
Does everyone know how to fix this error

Code:
   ["brit_huzzah1.wav", fac_kingdom_2],["brit_godsave2.wav", fac_kingdom_2],["brit_king2.wav", fac_kingdom_2],["brit_rule1.wav", fac_kingdom_2],["brit_nosey1.wav", fac_kingdom_2],
NameError: name 'fac_kingdom_2' is not defined
Exporting postfx_params...

i have checked in my faction module but i wonder why it still said fac_kingdom_2 is not defined , am i missing something pls tell me how to fix it  :???:
 
HarryPham123 said:
Does everyone know how to fix this error

Code:
   ["brit_huzzah1.wav", fac_kingdom_2],["brit_godsave2.wav", fac_kingdom_2],["brit_king2.wav", fac_kingdom_2],["brit_rule1.wav", fac_kingdom_2],["brit_nosey1.wav", fac_kingdom_2],
NameError: name 'fac_kingdom_2' is not defined
Exporting postfx_params...

i have checked in my faction module but i wonder why it still said fac_kingdom_2 is not defined , am i missing something pls tell me how to fix it  :???:

From the looks of it, you are trying to mod using the NW module system. In the NW module system factions are defined as [britain, france, russia, prussia, austria] rather than [kingdom_1, kingdom_2 etc], so you might want to check on that.

Now if you have already defined a faction as kingdom_2 then check again if you have defined it correctly.
 
What is "unexpected indent"?

BPQQBL.png
 
What is wrong with the bump map on this shield by Mandible?

Untitled4.jpg


without bump map it seems ok

Untitled5.jpg


this is the material.

Untitled6.jpg

 
Balgy said:
An indentation error in python is raised when there is a problem with code "spacing",

Meaning, you have hit the spacebar somewhere that you shouldn't.

Is "]" symbol become a problem? Because I have a problem from "]" in module_troops before upgrades. (Not different error)
I cannot open computer now for take screen shot because I will go to school
 
Balgy said:
HarryPham123 said:
Does everyone know how to fix this error

Code:
   ["brit_huzzah1.wav", fac_kingdom_2],["brit_godsave2.wav", fac_kingdom_2],["brit_king2.wav", fac_kingdom_2],["brit_rule1.wav", fac_kingdom_2],["brit_nosey1.wav", fac_kingdom_2],
NameError: name 'fac_kingdom_2' is not defined
Exporting postfx_params...

i have checked in my faction module but i wonder why it still said fac_kingdom_2 is not defined , am i missing something pls tell me how to fix it  :???:

From the looks of it, you are trying to mod using the NW module system. In the NW module system factions are defined as [britain, france, russia, prussia, austria] rather than [kingdom_1, kingdom_2 etc], so you might want to check on that.

Now if you have already defined a faction as kingdom_2 then check again if you have defined it correctly.

oh thank you my friend  :wink:
 
TRCY_Maresal said:
Balgy said:
An indentation error in python is raised when there is a problem with code "spacing",

Meaning, you have hit the spacebar somewhere that you shouldn't.

Is "]" symbol become a problem? Because I have a problem from "]" in module_troops before upgrades. (Not different error)
I cannot open computer now for take screen shot because I will go to school

??
 
TRCY_Maresal said:
TRCY_Maresal said:
Balgy said:
An indentation error in python is raised when there is a problem with code "spacing",

Meaning, you have hit the spacebar somewhere that you shouldn't.

Is "]" symbol become a problem? Because I have a problem from "]" in module_troops before upgrades. (Not different error)
I cannot open computer now for take screen shot because I will go to school

??
no, that ] shouldnt be a problem, your file should look like this:
Code:
#from *** import *
#from *** import *
#from *** import *
#################
##     MANY THINGS      ##
#################

troops = [
    ["troop",...],
    ["another_troop",...],
    ...
    ["yet_another_troop",...],
]

upgrades

but you probably have an exta ] somewhere in the code(probably the line just before the one the compiler is complaining about)
 
Ikaguia said:
TRCY_Maresal said:
TRCY_Maresal said:
Balgy said:
An indentation error in python is raised when there is a problem with code "spacing",

Meaning, you have hit the spacebar somewhere that you shouldn't.

Is "]" symbol become a problem? Because I have a problem from "]" in module_troops before upgrades. (Not different error)
I cannot open computer now for take screen shot because I will go to school

??
no, that ] shouldnt be a problem, your file should look like this:
Code:
#from *** import *
#from *** import *
#from *** import *
#################
##     MANY THINGS      ##
#################

troops = [
    ["troop",...],
    ["another_troop",...],
    ...
    ["yet_another_troop",...],
]

upgrades

but you probably have an exta ] somewhere in the code(probably the line just before the one the compiler is complaining about)

Well, brackets out of place usually raise Syntax Errors...

The only thing I can think of that would cause you an indentation error in if one of your "upgrade" in the upgrade section has a space before it. Noone of them should have one.
 
Status
Not open for further replies.
Back
Top Bottom