Faction troops spawning as mercenaries bug

正在查看此主题的用户

mikeboix

Grandmaster Knight
Hello good fellows. I've having some problems with my module system, and I don't know why this happens now. Some time ago, maybe two months or so, I didn't have this problem.

As the title says, in the tavern spawns faction troops instead of the mercenaries. This only happens when you have played like 4~5 days ingame, the first day the mercenaries spawns are correct.

Note that I have not touched at all the codes related to mercenaries, or so I think. Do anybody know why this is happening? Did anybody experiencied a similar bug before? I think it may be something related with the #script_update_mercenary_units_of_towns in module_scripts, but I have not touched anything here, so...

Cheers and thanks in advance.
 
Yeah, sure, I've added loads of new troops for the different factions, but... they all have different troop ids, so this should no affect to the mercenary troops, should it?
 
If you placed your troops before trp_mercenaries_end or changed the range of mercenary troops:

插入代码块:
mercenary_troops_begin = "trp_watchman"
mercenary_troops_end = "trp_mercenaries_end"

If you didn't modify the script to update the mercenary troops this seems to be the only way that they will appear in the taverns.
 
Seek n Destroy 说:
If you placed your troops before trp_mercenaries_end or changed the range of mercenary troops:

插入代码块:
mercenary_troops_begin = "trp_watchman"
mercenary_troops_end = "trp_mercenaries_end"

If you didn't modify the script to update the mercenary troops this seems to be the only way that they will appear in the taverns.

No :sad: I made some changes for the mercenaries, but just some name changes and items. The range is correct here at troops, and module_constants is not modified at all...

插入代码块:
#soldiers:
#This troop is the troop marked as soldiers_begin
["farmer", "Farmer", "Farmers", tf_guarantee_armor, no_scene, reserved, fac_commoners, [itm_cleaver,itm_knife,itm_pitch_fork,itm_sickle,itm_club,itm_stones,itm_leather_cap,itm_felt_hat,itm_felt_hat,itm_linen_tunic,itm_coarse_tunic,itm_nomad_boots,itm_wrapping_boots], def_attrib|level(4), wp(60), knows_common, man_face_middle_1, man_face_old_2 ],
["townsman", "Townsman", "Townsmen", tf_guarantee_boots|tf_guarantee_armor, no_scene, reserved, fac_commoners, [itm_cleaver,itm_knife,itm_club,itm_quarter_staff,itm_dagger,itm_stones,itm_leather_cap,itm_linen_tunic,itm_coarse_tunic,itm_leather_apron,itm_nomad_boots,itm_wrapping_boots], def_attrib|level(4), wp(60), knows_common, mercenary_face_1, mercenary_face_2 ],
["watchman", "Miliciano mercenario de Geroia", "Milicia mercenaria de Geroia", tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_shield, no_scene, reserved, fac_commoners, [itm_camisa_sur_2,itm_armor_sur_2,itm_sur_tunic,itm_armor_sur_4,itm_armor_sur_3,itm_spear_imperial_1,itm_spear,itm_fighting_pick,itm_military_pick,itm_pickaxe,itm_geroian_shield_1,itm_geroian_shield_3,itm_leather_covered_round_shield,itm_nomad_boots,itm_ankle_boots,itm_skullcap,itm_norman_helmet,itm_imperial_helm_militia,itm_norman_shield_3,itm_norman_shield_4,itm_norman_shield_5,itm_norman_shield_6,itm_norman_shield_7], def_attrib|level(9), wp(85), knows_common|knows_shield_1|knows_ironflesh_1|knows_power_strike_1, mercenary_face_1, mercenary_face_2 ],
["caravan_guard", "Lancero mercenario de Geroia", "Lanceros mercenarios de Geroia", tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_horse|tf_guarantee_shield, no_scene, reserved, fac_commoners, [itm_spear,itm_fighting_pick,itm_sword_medieval_a,itm_leather_jerkin,itm_hide_boots,itm_footman_helmet,itm_camisa_sur_4,itm_camisa_sur_5,itm_camisa_sur_6,itm_geroian_shield_1,itm_geroian_shield_2,itm_geroian_shield_3,itm_imperial_helmet_4,itm_imperial_helmet_5,itm_calradian_skullcap_1,itm_imperial_helm_militia,itm_norman_shield_8,itm_norman_shield_1,itm_norman_shield_2,itm_norman_shield_3,itm_imperial_javelins], def_attrib|level(14), wp(85), knows_common|knows_ironflesh_1|knows_shield_3|knows_power_strike_2, mercenary_face_1, mercenary_face_2 ],
["mercenary_swordsman", "Guerrero mercenario de Geroia", "Guerreros mercenarios de Geroia", tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_shield, no_scene, reserved, fac_commoners, [itm_armor_sur_5,itm_armor_sur_6,itm_armor_sur_7,itm_sur_tunic,itm_armor_sur_leather_1,itm_sur_boots_heavy,itm_leather_boots,itm_nomad_boots,itm_cleaver_new_short,itm_falchion_south_1,itm_imperial_helmet_5,itm_imperial_helmet_4,itm_calradian_skullcap_1,itm_spear_boar_new,itm_spear_imperial_1,itm_spear,itm_south_axe_1,itm_south_hammer_2,itm_norman_shield_5,itm_norman_shield_6,itm_norman_shield_7,itm_norman_shield_8,itm_calradian_javelins,itm_imperial_javelins], def_attrib|level(20), wp(100), knows_common|knows_riding_3|knows_ironflesh_3|knows_shield_2|knows_power_strike_2, mercenary_face_1, mercenary_face_2 ],
["hired_blade", "Espadachin mercenario de Geroia", "Espadachines mercenarios de Geroia", tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_gloves|tf_guarantee_shield, no_scene, reserved, fac_commoners, [itm_bascinet,itm_sur_tunic_heavy_1,itm_sur_tunic_mail,itm_sur_tunic_mail_2,itm_sur_helmet_heavy,itm_imperial_helmet_3,itm_imperial_helmet_2,itm_cleaver_new_short,itm_falchion_south_1,itm_imperial_elite_sword_1,itm_imperial_sword_2,itm_norman_shield_1,itm_norman_shield_2,itm_norman_shield_3,itm_norman_shield_4,itm_norman_shield_5,itm_imperial_javelins,itm_calradian_javelins,itm_sur_boots_heavy,itm_leather_boots], def_attrib|level(25), wp(120), knows_common|knows_athletics_4|knows_shield_4|knows_power_strike_3|knows_ironflesh_4, mercenary_face_1, mercenary_face_2 ],
["mercenary_crossbowman","Mercenary Crossbowman","Mercenary Crossbowmen",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_ranged,no_scene,reserved,fac_commoners,[itm_bolts,itm_spiked_club,itm_fighting_pick,itm_sword_medieval_a,itm_boar_spear,itm_crossbow,itm_tab_shield_pavise_a,itm_tab_shield_round_b,itm_padded_cloth,itm_leather_jerkin,itm_leather_cap,itm_padded_coif,itm_footman_helmet,itm_nomad_boots,itm_wrapping_boots],def_attrib|level(19),wp_one_handed(90)|wp_two_handed(90)|wp_polearm(90)|wp_archery(90)|wp_crossbow(130)|wp_throwing(90),knows_common|knows_athletics_5|knows_shield_1,mercenary_face_1,mercenary_face_2],
["mercenary_horseman","Mercenary Horseman","Mercenary Horsemen",tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_horse|tf_guarantee_shield,no_scene,reserved,fac_commoners,[itm_lance,itm_bastard_sword_a,itm_sword_medieval_b,itm_tab_shield_heater_c,itm_mail_shirt,itm_haubergeon,itm_leather_boots,itm_norman_helmet,itm_mail_coif,itm_helmet_with_neckguard,itm_saddle_horse,itm_courser],def_attrib|level(20),wp(100),knows_common|knows_riding_4|knows_ironflesh_3|knows_shield_2|knows_power_strike_3,mercenary_face_1,mercenary_face_2],
["mercenary_cavalry", "Jinete mercenario de Geroia", "Jinetes mercenarios de Geroia", tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_horse|tf_guarantee_shield, no_scene, reserved, fac_commoners, [itm_south_horse_2,itm_south_horse_elite_1,itm_south_horse_elite_2,itm_imperial_horse_4,itm_imperial_horse_7,itm_imperial_horse_8,itm_imperial_horse_9,itm_war_spear,itm_spear_imperial_2,itm_calradian_mount_boots,itm_sur_boots_heavy,itm_sur_tunic_pesada_1,itm_sur_tunic_pesada_2,itm_imperial_helm_3,itm_imperial_helm_3a,itm_sur_helmet_heavy,itm_imperial_helmet_3,itm_norman_shield_8,itm_norman_shield_7,itm_norman_shield_6,itm_norman_shield_4,itm_norman_shield_3,itm_norman_shield_1,itm_imperial_sword_2,itm_imperial_sword_3,itm_empire_sword_2], def_attrib|level(25), wp(130), knows_common|knows_riding_5|knows_ironflesh_4|knows_shield_5|knows_power_strike_4, mercenary_face_1, mercenary_face_2 ],
["mercenaries_end","mercenaries_end","mercenaries_end",0,no_scene,reserved,fac_commoners,[],def_attrib|level(4),wp(60),knows_common,mercenary_face_1,mercenary_face_2],

So you think the problem has to be at the scripts file? Thank you all.
 
This bug seems very familiar, yes ... it's (or was  ) also  the case in Sayazn ...
perhaps something wrong with update_mercenary_units_of_towns in module_scripts
 
fladin 说:
This bug seems very familiar, yes ... it's (or was  ) also  the case in Sayazn ...
perhaps something wrong with update_mercenary_units_of_towns in module_scripts

I'll take a look at this code, but I'm pretty sure I didn't modify this. Do you think this could something to be with the warband new versions? I read something around there that the new patches around version 1.166 caused some troubles with previous versions' module systems...
 
mike56 说:
i'll take a look at this code, but I'm pretty sure I didn't modify this. Do you think this could something to be with the warband new versions? I read something around there that the new patches around version 1.166 caused some troubles with previous versions' module systems...

nope

are you modding with .txt files or the modules (game source)? Adding new troops on .txt files may break your game in situations like this, and it is not savegame compatible (requires a new fresh game)
 
No no, all the modifications are made by Module System, and I always start new games to see the changes.
 
mike56 说:
No no, all the modifications are made by Module System, and I always start new games to see the changes.

then if your tests/code review didn't reveal any bugs with: script for mercenaries, troops or module_constants.py

you are left with the worst kind of bug in Warband: slot spill  :mrgreen:

Mercenaries, like other stuff, have the data in a slot for that town (a party). There is no mechanism to protect said slot(s), anyone can use them at any time. If you have a bug somewhere that is replacing those values (when it should not), then you have a serious bug somewhere that is breaking your game mechanics, like the mercenaries one (and probably more).

Disable your mercenaries trigger (1), add a logger trigger (2) to print those slots values daily( or each hour) and see when they change (they should never change!) and start to figure out what is going on

 
mike56 说:
Bof, that sounds pretty bad. Thank you very much, I'll try what you say  :neutral:

its is not bad if you are using proper development cycle with constant testing+compiling+backups for your code.

The easiest way to achieve this is using source control like Git, branches, etc. Check github.com if you want to learn more.

Or do it the hard way and suffer hours of boring debugging  :grin:
 
Excuse me, but now I'm trying what you said and I realize that I do not know how to do it  :dead:

kalarhan 说:
Disable your mercenaries trigger (1), add a logger trigger (2) to print those slots values daily( or each hour) and see when they change (they should never change!) and start to figure out what is going on

Where can I find these mercenaries triggers? I do not find any mercenary related line in the module_triggers file. An how should it look that logger trigger you mention, and where should I place it?

Thanks in advance.

kalarhan 说:
its is not bad if you are using proper development cycle with constant testing+compiling+backups for your code.

The easiest way to achieve this is using source control like Git, branches, etc. Check github.com if you want to learn more.

Or do it the hard way and suffer hours of boring debugging  :grin:

Well, what I do is to save different versions of my module system files in my dropbox account to return to the previous versions when I need it. The thing is that I can not find any version that has this bug solved, and that is weird, because I dind't remember to see that before :sad:
 
take a look on :

"# Adding mercenary troops to the towns"  in simple_triggers

and especially
(try_for_range, ":village_no", villages_begin, villages_end),
and not centers_begin, centers_end ...
 
fladin 说:
take a look on :

"# Adding mercenary troops to the towns"  in simple_triggers

and especially
(try_for_range, ":village_no", villages_begin, villages_end),
and not centers_begin, centers_end ...

Yeah, thank you very much!! It seems like the bug was in these lines. Indeed, an old team mate made some modifications in that file and I didn't know, so I have compared this with the native module file, made the changes et... voilá!! Working again.

Thanks a lot  :grin:
 
后退
顶部 底部