Modding Q&A [For Quick Questions and Answers]

Status
Not open for further replies.

Artam

Sergeant at Arms
M&BWBWF&SNWVC
Best answers
0
Hello everyone,

I changed bandit parties a bit for my own mod according to this tutorial. In addition to mountain and forest bandits, I assigned faction to other bandit parties (sea raider etc.). I also added 2 new troops to all bandit parties. I manually updated "ID_troop.py" and "ID_faction.py" in accordance with the "module_troop.py" and "module_faction.py" order.

Successfully compiled the module.

The colors of bandit parties and the new troops look the way I want. But all merchants (Merchant of Praven etc.) appearance has changed. (Unintentionally) I started the game with "edit option" enabled and looked at the names and looks of all the troops, and there seems to be no problem except the merchants. Also all of them flaged with "tf_randomize_face" But until now they have always generated with same face code. Please see code and screenshots below.

Code:
.
.
.
  ["taiga_bandit","Taiga Bandit","Taiga Bandits",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_ranged,0,0,fac_outlaws,
   [itm_arrows,itm_sword_khergit_1,itm_winged_mace,itm_spear, itm_light_lance,itm_nomad_bow,itm_nomad_bow,itm_short_bow,itm_jarid,itm_javelin,itm_vaegir_fur_cap,itm_leather_steppe_cap_c,itm_nomad_armor,itm_leather_jerkin,itm_hide_boots,itm_nomad_boots,itm_leather_covered_round_shield,itm_leather_covered_round_shield],
   def_attrib|level(15),wp(110),knows_common|knows_power_draw_4|knows_power_throw_3,vaegir_face_young_1, vaegir_face_old_2],
  ["trained_taiga_bandit","Trained Taiga Bandit","Trained Taiga Bandits",tf_guarantee_ranged|tf_guarantee_all_armors_wo_shield,0,0,fac_outlaws,
   [itm_barbed_arrows,itm_arrows,itm_sword_khergit_2,itm_spiked_mace,itm_boar_spear, itm_lance,itm_nomad_bow,itm_long_bow,itm_long_bow,itm_jarid,itm_vaegir_fur_helmet,itm_vaegir_spiked_helmet,itm_tribal_warrior_outfit,itm_studded_leather_coat,itm_leather_boots,itm_nomad_boots,itm_tab_shield_kite_b,itm_tab_shield_round_b],
   def_attrib|level(19),wp(143),knows_common|knows_power_strike_2|knows_power_draw_4|knows_power_throw_4,vaegir_face_young_1, vaegir_face_old_2],
  ["veteran_taiga_bandit","Veteran Taiga Bandit","Veteran Taiga Bandits",tf_guarantee_ranged|tf_guarantee_all_armors_wo_shield,0,0,fac_outlaws,
   [itm_barbed_arrows,itm_barbed_arrows,itm_strong_bow,itm_strong_bow,itm_jarid,itm_sword_khergit_3,itm_spiked_mace,itm_long_hafted_knobbed_mace,
   itm_vaegir_spiked_helmet,itm_vaegir_spiked_helmet,itm_studded_leather_coat,itm_studded_leather_coat,itm_leather_boots,itm_leather_boots,itm_tab_shield_kite_b,itm_tab_shield_round_b],
   def_attrib|level(23),wp(175),knows_common|knows_power_strike_3|knows_power_draw_5|knows_power_throw_5,vaegir_face_young_1, vaegir_face_old_2],
  ["desert_bandit","Desert Bandit","Desert Bandits",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_horse|tf_mounted,0,0,fac_outlaws,
.
.
.
Code:
trp_player = 0
trp_multiplayer_profile_troop_male = 1
trp_multiplayer_profile_troop_female = 2
trp_temp_troop = 3
.
.
.
trp_mountain_bandit = 116
trp_trained_mountain_bandit = 117
trp_veteran_mountain_bandit = 118
trp_forest_bandit = 119
trp_trained_forest_bandit = 120
trp_veteran_forest_bandit = 121
trp_sea_raider = 122
trp_trained_sea_raider = 123
trp_veteran_sea_raider = 124
trp_steppe_bandit = 125
trp_trained_steppe_bandit = 126
trp_veteran_steppe_bandit = 127
trp_taiga_bandit = 128
trp_trained_taiga_bandit = 129
trp_veteran_taiga_bandit = 130
trp_desert_bandit = 131
.
.
.
trp_coop_companion_equipment_sets_end = 1083
trp_musican_male = 1084
trp_musican_female = 1085
trp_musicans_end = 1086
trp_globals_troop = 1087
Code:
.
.
.
fac_deserters = 26
fac_mountain_bandits = 27
fac_forest_bandits = 28
fac_sea_raiders = 29
fac_taiga_bandit = 30
fac_steppe_bandits = 31
fac_desert_bandits = 32
fac_undeads = 33
fac_slavers = 34
fac_peasant_rebels = 35
fac_noble_refugees = 36
.
.
.
Code:
  ("mountain_bandits","Mountain Bandits", 0, 0.5,[("commoners",-0.2),("merchants",-0.5),("manhunters",-0.6),("player_faction",-0.15)], [], 0x3F8000),
  ("forest_bandits","Forest Bandits", 0, 0.5,[("commoners",-0.2),("merchants",-0.5),("manhunters",-0.6),("player_faction",-0.15)], [], 0xCE4900),
  ("sea_raiders","Sea Raiders", 0, 0.5,[("commoners",-0.2),("merchants",-0.5),("manhunters",-0.6),("player_faction",-0.15)], [], 0x0CC7EC),
  ("taiga_bandit","Taiga Bandits", 0, 0.5,[("commoners",-0.2),("merchants",-0.5),("manhunters",-0.6),("player_faction",-0.15)], [], 0x9696FF),
  ("steppe_bandits","Steppe Bandits", 0, 0.5,[("commoners",-0.2),("merchants",-0.5),("manhunters",-0.6),("player_faction",-0.15)], [], 0x9431F1),
  ("desert_bandits","Desert Bandits", 0, 0.5,[("commoners",-0.2),("merchants",-0.5),("manhunters",-0.6),("player_faction",-0.15)], [], 0xBB9D36),

Where did I messed up?

Kind regards,
 

Turban

Veteran
Best answers
0
Hi guys,

Thought I'd try over here as I've had no response on the sub-forum. I'm trying to run Swyters cartographer program for a mod, but having problems. By default it runs fine, but when I switch it to use the modules_parties.py in the mod I'm getting this error when I start up:

Code:
@--start parsing parties
luajit: .\mab-parties.lua:66: attempt to perform arithmetic on a nil value
stack traceback:
        .\mab-parties.lua:66: in function 'load'
        cartographer.lua:58: in main chunk
        [C]: ?
Now I looked on the forum and might have found this solution:
This specific error is being caused because Cartographer has incorrectly identified a line in module_parties.py as a valid tuple when it isn't.
This is probably cause by someone trying to organize their python when tuples get really long.
Like the party in Viking conquest: party id ="aescesdun"  which has a really long troop list so the coder hit return every now and then to make it easier to read. Python doesn't care but Cartographer does. It thinks each return is a new tuple and trys to process the co-ordinance. Go to your module_parties.py and make sure there aren't any multi line tuples. Make sure each tuple is on its own line and only one line.
Problem is I have novice/limited knowledge of coding and don't really understand tuples. If someone could guide me I could attempt to fix it myself. What am I looking for that the program doesn't like?
 

Eärendil the Mariner

Subforum Moderator
WBWF&SM&B
Best answers
48
Anglolord said:
Hi guys,

Thought I'd try over here as I've had no response on the sub-forum. I'm trying to run Swyters cartographer program for a mod, but having problems. By default it runs fine, but when I switch it to use the modules_parties.py in the mod I'm getting this error when I start up:

Code:
@--start parsing parties
luajit: .\mab-parties.lua:66: attempt to perform arithmetic on a nil value
stack traceback:
        .\mab-parties.lua:66: in function 'load'
        cartographer.lua:58: in main chunk
        [C]: ?
Now I looked on the forum and might have found this solution:
This specific error is being caused because Cartographer has incorrectly identified a line in module_parties.py as a valid tuple when it isn't.
This is probably cause by someone trying to organize their python when tuples get really long.
Like the party in Viking conquest: party id ="aescesdun"  which has a really long troop list so the coder hit return every now and then to make it easier to read. Python doesn't care but Cartographer does. It thinks each return is a new tuple and trys to process the co-ordinance. Go to your module_parties.py and make sure there aren't any multi line tuples. Make sure each tuple is on its own line and only one line.
Problem is I have novice/limited knowledge of coding and don't really understand tuples. If someone could guide me I could attempt to fix it myself. What am I looking for that the program doesn't like?
If you look into module_troops you find for examples this line here:
Code:
 ["village_walker_1","Villager","Villagers",tf_guarantee_boots|tf_guarantee_armor,0,0,fac_commoners,
   [itm_short_tunic, itm_linen_tunic, itm_coarse_tunic, itm_leather_vest, itm_leather_apron, itm_shirt, itm_woolen_hose, itm_nomad_boots, itm_blue_hose, itm_hide_boots, itm_ankle_boots, itm_leather_boots, itm_fur_hat, itm_leather_cap, itm_straw_hat, itm_felt_hat],
   def_attrib|level(4),wp(60),knows_common,man_face_younger_1, man_face_older_2],
It's distributed across three lines to make it easier to read for the ones who are coding the troops into. Most here I think prefer to have the faction as the last thing in the first line, the whole equipment in the second line and the rest in the last line.
For the cartographer you however need to have it all in one line as I have understood it here, so it should look like:
Code:
 ["village_walker_1","Villager","Villagers",tf_guarantee_boots|tf_guarantee_armor,0,0,fac_commoners, [itm_short_tunic, itm_linen_tunic, itm_coarse_tunic, itm_leather_vest, itm_leather_apron, itm_shirt, itm_woolen_hose, itm_nomad_boots, itm_blue_hose, itm_hide_boots, itm_ankle_boots, itm_leather_boots, itm_fur_hat, itm_leather_cap, itm_straw_hat, itm_felt_hat], def_attrib|level(4),wp(60),knows_common,man_face_younger_1, man_face_older_2],
so that the cartographer can read it properly since he might try to read each line as an own troop. Have your try with this.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
[Bcw]Btm_Earendil said:
so that the cartographer can read it properly since he might try to read each line as an own troop. Have your try with this.
the explanation is correct (use of line separator/{ENTER}), but the file is wrong. Its module_parties.py and not module_troops.py.



Artam said:
I changed bandit parties a bit
1) why are you talking about manually editing the ID_XXX files? Those are automatic.

2) why didnt you add the new troops to the party templates?

3) did you update the spawn system for bandits to include the new party type?

I am not sure if you are using Native as a base (you didnt mention it?), and you pointed to a tutorial used for full factions, not bandits, so not sure what you did / didnt do here. Bandits are not like a kingdom faction, they have they own special code.
 

Eärendil the Mariner

Subforum Moderator
WBWF&SM&B
Best answers
48
kalarhan said:
[Bcw]Btm_Earendil said:
so that the cartographer can read it properly since he might try to read each line as an own troop. Have your try with this.
the explanation is correct (use of line separator/{ENTER}), but the file is wrong. Its module_parties.py and not module_troops.py.
Ah, I only got that in mind in module_troops and forgot that he has to look up the same in module_parties :facepalm:
 

Artam

Sergeant at Arms
M&BWBWF&SNWVC
Best answers
0
Hello kalarhan,

Thank you for reply.

kalarhan said:
1) why are you talking about manually editing the ID_XXX files? Those are automatic.

2) why didnt you add the new troops to the party templates?

3) did you update the spawn system for bandits to include the new party type?

I am not sure if you are using Native as a base (you didnt mention it?), and you pointed to a tutorial used for full factions, not bandits, so not sure what you did / didnt do here. Bandits are not like a kingdom faction, they have they own special code.
I am using native as base. Sorry I forgot to mention. And I admit the tutorial didn't help me much. :oops:

1) Because when I try to compile module, WRECK gave error, I don't remember exactly,  something like "trp_*insert new bandit type* not defined.  But after I manually edited ID_troops.py complied succesfully.
Edit: I must say, I never thought the error could be related to ID files, then I found your message*. Maybe I didn't understand you right.
kalarhan said:
*--> if you forgot to do it... open file ID_factions.py and include it there manually (this once). Increase the number (ID), it must be a increment of 1 in each line
2) I added new troops to the party templates. But I somehow forgot to copy sample codes here. I noticed after reading your message. Please see pary templates below.
Code:
  ("steppe_bandits","Steppe Bandits",icon_khergit|carries_goods(2),0,fac_steppe_bandits,bandit_personality,[(trp_veteran_steppe_bandit,3,7),(trp_trained_steppe_bandit,3,9), (trp_steppe_bandit,7,15)]),
  ("taiga_bandits","Tundra Bandits",icon_axeman|carries_goods(2),0,fac_taiga_bandit,bandit_personality,[(trp_veteran_taiga_bandit,4,9),(trp_trained_taiga_bandit,5,12), (trp_taiga_bandit,9,20)]),
  ("desert_bandits","Desert Bandits",icon_vaegir_knight|carries_goods(2),0,fac_desert_bandits,bandit_personality,[(trp_veteran_desert_bandit,3,7),(trp_trained_desert_bandit,3,9), (trp_desert_bandit,7,15)]),
  ("forest_bandits","Forest Bandits",icon_axeman|carries_goods(2),0,fac_forest_bandits,bandit_personality,[(trp_veteran_forest_bandit,4,11),(trp_trained_forest_bandit,5,14), (trp_forest_bandit,10,25)]),
  ("mountain_bandits","Mountain Bandits",icon_axeman|carries_goods(2),0,fac_mountain_bandits,bandit_personality,[(trp_veteran_mountain_bandit,4,11),(trp_trained_mountain_bandit,5,14), (trp_mountain_bandit,10,25)]),
  ("sea_raiders","Sea Raiders",icon_axeman|carries_goods(2),0,fac_sea_raiders,bandit_personality,[(trp_veteran_sea_raider,4,9),(trp_trained_sea_raider,5,12), (trp_sea_raider,9,20)]),
3) If you're talking about bandit lair by mentioning spawn sytem I didn't add new bandit troops. Because trp_steppe_bandit,15,58 (min:15 max: 58?) steppe bandit is enough. :smile: I didn't want to add trained or veteran version of steppe/taiga etc. bandits.
("steppe_bandit_lair" ,"Steppe Bandit Lair",icon_bandit_lair|carries_goods(2)|pf_is_static|pf_hide_defenders,0,fac_neutral,bandit_personality, [(trp_steppe_bandit,15,5:cool:]),
I hope I gave all answers you need.

Kind regards,
 

SupaNinjaMan

Baron
M&BWBWF&SNWVC
Best answers
7
When you compile, IDs are automagically updated. That error is because it looks towards ID_ files to see what you're talking about, so you either have to do your hacky hand tweak, or compile, before referring to a new entry. Best practice is to add the entry, compile, then move on to adding the references where you need them
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
Artam said:
1) Because when I try to compile module, WRECK gave error, I don't remember exactly,  something like "trp_*insert new bandit type* not defined.
well WRECK works differently from Native compiler. You can even disable the ID_XXX.py files if you want to (optional). The normal workflow is this:

1) add a entity (new troop, new party, new item, ...)
2) save and compile
3) ID_XXX files are autogenerated and updated with new entries
4) use the new entity (like using a new troop inside a script)

the comment you quoted is a hack for people that forgot about (2). So you can do it manually to trick the compiler. But you dont need to do that every time. Just when you make a mistake.

So make sure you compile it at least twice now (to clear any mistakes with IDs). And start a new fresh game (cant load a old save). Test your game and report the issues you are having.

 

Artam

Sergeant at Arms
M&BWBWF&SNWVC
Best answers
0
SupaNinjaMan said:
Best practice is to add the entry, compile, then move on to adding the references where you need them
Thank you SupaNinjaMan for advice.

I noticed in Diplomacy mod quest merchants face also diffrent than vanilla. I checked Diplomacy source and found they didn't touch mentioned merchants at all. Please see module_troops.py for vanilla and diplomacy below.

vanilla said:
  ["swadian_merchant", "Merchant of Praven", "{!}Prominent", tf_hero|tf_randomize_face, 0, reserved, fac_kingdom_4, [itm_sword_two_handed_a, itm_courtly_outfit, itm_leather_boots], def_attrib|level(2),wp(20),knows_common, man_face_middle_1, mercenary_face_2],
diplomacy said:
  ["swadian_merchant", "Merchant of Praven", "{!}Prominent", tf_hero|tf_randomize_face, 0, reserved, fac_kingdom_4, [itm_sword_two_handed_a, itm_courtly_outfit, itm_leather_boots], def_attrib|level(2),wp(20),knows_common, man_face_middle_1, mercenary_face_2],
Should I assume that after adding new troops, "Merchant of X" face code gonna change?

kalarhan said:
So make sure you compile it at least twice now (to clear any mistakes with IDs). And start a new fresh game (cant load a old save). Test your game and report the issues you are having.
kalarhan, If I understood you correctly, I hope I didn't, do you want me to revert all changes I made and start from the beginning. :smile: Because as I mentioned in my first post every other troop except merchant of swadia etc. looks fine. [Their; (factions, names, face codes)]

But WRECK failed at "save and compile" step so that means I did something wrong.  And I didn't even touch module_script.py etc.

And to be honest, if my assumption is right, I don't want to take your time for this matter. Because I couldn't care less for these merchants. :smile: But again I'll check other troops. If I found anything wrong I'll carry out the process again.

Kind regards,
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
Artam said:
Should I assume that after adding new troops, "Merchant of X" face code gonna change?
if you give two face codes to a troop (non hero) it will use them as seed to create a face using them as reference, so you can have things like a young random face or a old random face.

for a static face - on a hero type troop - you can use the character creator to design it, then copy that face code and give it to the troop (keep the second face code empty). Example

Code:
 ["trainer_1","Trainer","Trainer",tf_hero, scn_training_ground_ranged_melee_1|entry(6),reserved,  fac_commoners,[itm_leather_jerkin,itm_hide_boots],def_attrib|level(2),wp(20),knows_common,

0x0000000d0d1030c74ae8d661b651c6840000000000000e220000000000000000
],
^ only one face code (not both). Same thingy is done for companions, etc.
 

Artam

Sergeant at Arms
M&BWBWF&SNWVC
Best answers
0
kalarhan, thank you for your time and trying to help me it's really appreciated.

As I mentioned here I will check other troops more carefully.

kalarhan said:
if you give two face codes to a troop (non hero) it will use them as seed to create a face using them as reference, so you can have things like a young random face or a old random face.
for a static face - on a hero type troop - you can use the character creator to design it, then copy that face code and give it to the troop (keep the second face code empty). Example
I already know that. If you try it yourself, you will see that the "merchant of X city" in the game are always the same, not randomly generated at the start of each new game. At least for me, that's always been the case.

Maybe in near future I will ask help again.  :cool:
Currently, I am trying to reduce enemy lord escape chance after defeat by 5% depending on each point given for prison management ability.
 

kalarhan

Python Saint
Count
WBNWVCWF&S
Best answers
31
Artam said:
I am trying to reduce enemy lord escape chance after defeat
Code:
  # script_cf_check_hero_can_escape_from_player
  # Input: arg1 = troop_no
  # Output: none (can fail)
  ("cf_check_hero_can_escape_from_player",
Code:
script_randomly_make_prisoner_heroes_escape_from_party
when looking for code a good place to start is the ID_XXX files. Like ID_scripts.py. Search for keywords like "escape" and you may quickly find what you are looking for.
 

forevernoob

Recruit
Best answers
0

Hi I was just hanging around with OpenBrf so that I could import some things from other games and make items from them and got this square shaped part hanging in the middle of the mesh. How do I fix it?
 

Corbul

Sergeant at Arms
WBWF&SVC
Best answers
1
Noobmaster69 said:
Oh my.. I'm a noob with simple brain  :cry: now what's this alpha thingy... :cry: :cry: :cry: :cry:
Alpha texture, it's required for your standard textures to work in-game, for whatever reason. If you have openbrf, you can see it's one of the options in the side-bar. You'll need to add an alpha texture to the .brf in question, then assign it in the side-bar. Depending on what you're trying to do, you can either make a "blank" alpha texture, or recycle one of the native ones. But you'll need an expert to tell you more precisely.
 

SupaNinjaMan

Baron
M&BWBWF&SNWVC
Best answers
7
Corbul said:
Noobmaster69 said:
Oh my.. I'm a noob with simple brain  :cry: now what's this alpha thingy... :cry: :cry: :cry: :cry:
Alpha texture, it's required for your standard textures to work in-game, for whatever reason. If you have openbrf, you can see it's one of the options in the side-bar. You'll need to add an alpha texture to the .brf in question, then assign it in the side-bar. Depending on what you're trying to do, you can either make a "blank" alpha texture, or recycle one of the native ones. But you'll need an expert to tell you more precisely.
Not to be rude or curt. . . this is not right in the slightest. An alpha is a channel inside the texture files that basically tells the material shader what NOT to draw, giving it transparency. The reason there is a black square is because either 1) you didn't set your alpha settings in OpenBRF correctly, or 2) the process of converting the texture erased the alpha channel.

Here's a video of me explaining how to check and enable alphas because I didn't feel like typing a whole bunch.  I'm also prone to going on rants so you can almost certainly safely ignore my self-discussion about where magenta or black is 1 or 256.
 

Turban

Veteran
Best answers
0
If you look into module_troops you find for examples this line here:
Code:
 ["village_walker_1","Villager","Villagers",tf_guarantee_boots|tf_guarantee_armor,0,0,fac_commoners,
   [itm_short_tunic, itm_linen_tunic, itm_coarse_tunic, itm_leather_vest, itm_leather_apron, itm_shirt, itm_woolen_hose, itm_nomad_boots, itm_blue_hose, itm_hide_boots, itm_ankle_boots, itm_leather_boots, itm_fur_hat, itm_leather_cap, itm_straw_hat, itm_felt_hat],
   def_attrib|level(4),wp(60),knows_common,man_face_younger_1, man_face_older_2],
It's distributed across three lines to make it easier to read for the ones who are coding the troops into. Most here I think prefer to have the faction as the last thing in the first line, the whole equipment in the second line and the rest in the last line.
For the cartographer you however need to have it all in one line as I have understood it here, so it should look like:
Code:
 ["village_walker_1","Villager","Villagers",tf_guarantee_boots|tf_guarantee_armor,0,0,fac_commoners, [itm_short_tunic, itm_linen_tunic, itm_coarse_tunic, itm_leather_vest, itm_leather_apron, itm_shirt, itm_woolen_hose, itm_nomad_boots, itm_blue_hose, itm_hide_boots, itm_ankle_boots, itm_leather_boots, itm_fur_hat, itm_leather_cap, itm_straw_hat, itm_felt_hat], def_attrib|level(4),wp(60),knows_common,man_face_younger_1, man_face_older_2],
so that the cartographer can read it properly since he might try to read each line as an own troop. Have your try with this.
Thanks for help guys, but still getting this error:
Code:
@--start parsing parties
luajit: .\mab-parties.lua:66: attempt to perform arithmetic on a nil value
stack traceback:
        .\mab-parties.lua:66: in function 'load'
        cartographer.lua:58: in main chunk
        [C]: ?
I've posted the module_parties file at pastebin (https://pastebin.com/TEbzYjQx) I still can't work out what is preventing Swyters cartographer from reading it. Checked the tuples in Sublime Text and none of the lines appear to run over, I'm not sure it's even that causing it. Anything else I should look for?

Full cartographer log: https://imgur.com/a/DgaetV3
 
Status
Not open for further replies.