Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I hope it's okay if I cross-post this here, as the sub-forum of the Diplomacy mod is quite deserted. So this is about a bug in Diplomacy for 1.173. I hope someone can offer a fix for this for me. Also as far as I know many mods use Diplomacy as their base so this bug report might be important to some other modders as well.

Thorkel said:
Hello! Started up Warband again after a very long time and decided to use the Diplomacy mod for the first campaign. I've run into a minor, quite hidden bug that breaks the game in a significant way. Luckily I developed a habit of saving very often so I can submit a very precise bug report.

The bug is with the 'Capture Prisoners' quest that lords give you when you are a mercenary for their faction. More precisely with the alternative solution to it introduced by Diplomacy. You can ask a lord in a castle to sell you the prisoners instead of capturing them yourself but there must be some error in the code there, because as soon as you click that dialog the 'Recruit prisoners' game menu gets broken and you can't recruit prisoners into your party any more.

https://imgur.com/HL7rAIT

When I click 'I need some X as prisoner', the prisoner recruiting menu breaks even if I don't take the lord's offer in the end and back out with 'Never mind.' on the next screen. Afterwards funny stuff like these happen:
https://imgur.com/vMzzeps
https://imgur.com/KqAGTPD

I can't mod at all but took a look into the module system and my guess is that probably some code with this quest mishandles the s18 variable(?). I found this line in module_game_menus.py:
("camp_recruit_prisoners",0,
  "You offer your prisoners freedom if they agree to join you as soldiers. {s18}",

I checked where s18 is also used and it's used in the scouting missions of companions to show the name of the kingdom they can gather intel on; it's also used to show text when recruiting volunteers in villages and for some dialog where lords name their rivals.  After this bug rears its head I can't recruit from prisoners any more as instead of showing the number and type of troops willing to join me it shows a lord's name, a kingdom's name or the villager recruiting text depending on where s18 was used latest. For the example images above I recruited villagers / spoke to Artimenner about gathering intel in Durquba right before entering the 'Recruit prisoners' page through the Camp menu.

Can this be fixed mid game by editing some .py file or do I have to go back to the latest uncorrupted save and avoid this quest (or at least this option inside it) for the rest of my current playthrough?

The source for the Diplomacy mod is available here at the end of the opening post if someone wants to take a look into this:
https://forums.taleworlds.com/index.php/topic,324014.0.html
 
Thorkel said:
I checked where s18 is also used

I didnt check the code to see what the issue is (your description is not clear), but on the text problem all you need to do is add a command to clear the string

Code:
(str_clear, s18),

sXX are just text labels. They dont impact gameplay calculations, effects. It is just a text. But as strings are usually concatened if you forget to clear it first, you can get some weird texts. These variables sXX are global, so they keep the value between differente executions.

somewhere -> s18 = "hello world"
another script -> s18 = s18 + "killed 18 villagers"
                          s18 = "hello worldkilled 18 villagers"

if [another script] has a clear command, then
                        s18 = ""
                        s18 = s18 + "killed 18 villagers"
                        s18 = "killed 18 villagers"

MBScript uses this "{s18}" to represent concatenation, as in this example
Code:
(str_store_string, s18, "@{s18}killed 18 villagers"),
 
kalarhan said:
imado552 said:
Did I do something wrong? messed up something?

yeap. But first review the operations you used on header_operations.py, as you have a few bugs in there that should be easy to spot once you read the documentation.
I checked, found some mistakes, fixed them= got more problems-->abondoned the idea of using mission_templates, checked how the guards in town_castle scene spawn, read the scripts, messed with it, managed to spawn my men \^.^/
a5ZMIyN.jpg
but the problem is they don't equipe their equipments, I don't know why, tried to use "troop_equip_items" but nothing happen here is the code I messed with to my liking!
Code:
...
  ("enter_court",
    [
      (store_script_param_1, ":center_no"),
      
      (assign, "$talk_context", tc_court_talk),

      (set_jump_mission,"mt_visit_town_castle"),
         
      (mission_tpl_entry_clear_override_items, "mt_visit_town_castle", 0),
      #(mission_tpl_entry_set_override_flags, "mt_visit_town_castle", 0, af_override_all),
      
      (party_get_slot, ":castle_scene", ":center_no", slot_town_castle),
      (modify_visitors_at_site,":castle_scene"),
      (reset_visitors),
      #Adding guards
      (store_faction_of_party, ":center_faction", ":center_no"),
      # (faction_get_slot, ":guard_troop", ":center_faction", slot_faction_guard_troop),
    
      (try_begin),
	   (assign,":guard_troop","trp_castle_guard"),
       (troop_equip_items,"trp_castle_guard"),
      (try_end),
      (set_visitor, 6, ":guard_troop"),
      (set_visitor, 7, ":guard_troop"),
	  (set_visitor, 32, ":guard_troop"),
      (set_visitor, 33, ":guard_troop"),
      (set_visitor, 34, ":guard_troop"),
      (set_visitor, 35, ":guard_troop"),
      (set_visitor, 36, ":guard_troop"),
      (set_visitor, 37, ":guard_troop"),
      (set_visitor, 38, ":guard_troop"),
      (set_visitor, 39, ":guard_troop"),
      (set_visitor, 40, ":guard_troop"),
      (set_visitor, 41, ":guard_troop"),
      (set_visitor, 42, ":guard_troop"),
      (set_visitor, 43, ":guard_troop"),
      (set_visitor, 44, ":guard_troop"),
      (set_visitor, 45, ":guard_troop"),
      (set_visitor, 46, ":guard_troop"),
      (set_visitor, 47, ":guard_troop"),
      (set_visitor, 48, ":guard_troop"),
      (set_visitor, 49, ":guard_troop"),
      (set_visitor, 50, ":guard_troop"), 
....
Did I miss something?again? What did I do wrong here, I'm drugged with cofee O.O because of this! so help me out
 
imado552 said:
but the problem is they don't equipe their equipments

first check your mission template, did you include the spawn records for the new entry points? Then check your override flags.

remember that spawn record ID is not the same as entry point ID
 
managed to make it using only "module_mission_templates"
Code:
#imad_agent_spawn begin
imad_agent_spawn = (
	ti_on_agent_spawn,1,0,[
		(eq, "$talk_context", tc_court_talk),
		(store_trigger_param_1,":agent"),
		(agent_get_troop_id,":troop",":agent"),
          (le, ":troop", 0),
          (assign, ":troop", "trp_castle_guard"),
	 	 (try_begin),
			(try_begin),
				(agent_set_stand_animation, ":agent", "anim_stand_man"),
				(agent_set_animation, ":agent", "anim_stand_man"),
			(try_end),
		 (try_end),
      (set_visitor, 32, ":troop"),
      (set_visitor, 33, ":troop"),
      (set_visitor, 34, ":troop"),
      (set_visitor, 35, ":troop"),
      (set_visitor, 36, ":troop"),
      (set_visitor, 37, ":troop"),
      (set_visitor, 38, ":troop"),
      (set_visitor, 39, ":troop"),
      (set_visitor, 40, ":troop"),
      (set_visitor, 41, ":troop"),
      (set_visitor, 42, ":troop"),
      (set_visitor, 43, ":troop"),
      (set_visitor, 44, ":troop"),
      (set_visitor, 45, ":troop"),
      (set_visitor, 46, ":troop"),
      (set_visitor, 47, ":troop"),
      (set_visitor, 48, ":troop"),
      (set_visitor, 49, ":troop"),
      (set_visitor, 50, ":troop"),
	],[])
#imad_agent_spawn end
They wear their equipments without any error,
in the same time I removed the spawning option from module_script so no entry 6 and 7 reserved for factions guards since it will not look good for me,
now all I'm left with is to make them depend on the faction ruling that place
HNK16yw.jpg

yJbsCsp.jpg
kalarhan said:
first check your mission template, did you include the spawn records for the new entry points?

remember that spawn record ID is not the same as entry point ID
What do you mean by that ?
kalarhan said:
Then check your override flags.
I checked and everything is ok.

here is my mission_template code
Code:
		#imad_agent_spawn begin
     # (32,mtef_visitor_source|mtef_team_0,af_override_horse,0,1,[]),#32
     (32,mtef_visitor_source,af_override_horse,0,1,[]),#32
     (33,mtef_visitor_source,af_override_horse,0,1,[]),#33
     (34,mtef_visitor_source,af_override_horse,0,1,[]),#34
     (35,mtef_visitor_source,af_override_horse,0,1,[]),#35
     (36,mtef_visitor_source,af_override_horse,0,1,[]),#36
     (37,mtef_visitor_source,af_override_horse,0,1,[]),#37
     (38,mtef_visitor_source,af_override_horse,0,1,[]),#38
     (39,mtef_visitor_source,af_override_horse,0,1,[]),#39
     (40,mtef_visitor_source,af_override_horse,0,1,[]),#40
     (41,mtef_visitor_source,af_override_horse,0,1,[]),#41
     (42,mtef_visitor_source,af_override_horse,0,1,[]),#42
     (43,mtef_visitor_source,af_override_horse,0,1,[]),#43
     (44,mtef_visitor_source,af_override_horse,0,1,[]),#44
     (45,mtef_visitor_source,af_override_horse,0,1,[]),#45
     (46,mtef_visitor_source,af_override_horse,0,1,[]),#46
     (47,mtef_visitor_source,af_override_horse,0,1,[]),#47
     (48,mtef_visitor_source,af_override_horse,0,1,[]),#48
     (49,mtef_visitor_source,af_override_horse,0,1,[]),#49
     (50,mtef_visitor_source,af_override_horse,0,1,[]),#50
 
Is there any way to check if the player talking with another troop(the dialog window is opened)?
Slawomir's tavern animations begin from the troop's ass, so the distance between troops ass and head is not enough for their head to be visible in the dialog window so i am trying to make the troop stand while the player is speaking with them but How can i check if the player talking with them? Is there any operation or other way?
 
I created a bandit hero, made him a spawn point and all that, and finally managed to make so he don't spawn again if he is in player custody, and it was working until I added a dialog to make so you can trade his freedom for his armor, after that, even after being freed he don't respawn, what give?

here is the code

Code:
   ("spawn_espen_army",
    [
  (try_begin),
    (store_num_parties_of_template, ":num_parties", "pt_free_company"),
    (lt,":num_parties",1),
    (store_random,":spawn_point",num_free_company),
    (val_add,":spawn_point","p_free_company"),
    (set_spawn_radius,1),
    (spawn_around_party,":spawn_point","pt_free_company"),
    (display_message,"@The Free Company, led ny Espen the Ox has arrived in Calradia!",0x6666FF),
  (try_end),
     ]),

Code:
  (48, 0, ti_once,
   [],
   [
    (call_script, "script_spawn_espen_army"),
   ]),
  (5, 0, 48,
   [
    (neg|troop_slot_ge, "trp_espen", slot_troop_prisoner_of_party, 0),
   ],
   [
    (call_script, "script_spawn_espen_army"),
   ]),

Code:
##espen dialog

  [plyr|anyone, "prisoner_chat",
    [
    (store_free_inventory_capacity, "$temp"),
    ],
    "You are my prisoner, do not try running away or trying something stupid. I will be watching you.",
    "prisoner_chat_2",
    []],

  [anyone, "prisoner_chat_2",
    [
      (store_conversation_troop, "$g_talk_troop"),
      (str_store_troop_name, s43, "$g_talk_troop"),
      (is_between, "$g_talk_troop", "trp_leonard", "trp_bandit_heroes_end"),
    ],
    "I am your prisoner,{playername}. What you gonna do with me?",
    "prisoner_chat_trade_freedom",
    []],

  [plyr|anyone, "prisoner_chat_trade_freedom",
    [],
    "You have been defeated{s43}, your fate is in my hands now.",
    "prisoner_chat_trade_freedom_2",
    []],

  [anyone, "prisoner_chat_trade_freedom_2",
    [
      (eq, "$g_talk_troop", "trp_espen"),
    ],
    "Look, I can give you my armor if you let me go free.",
    "prisoner_chat_trade_freedom_3",
    []],

      [plyr|anyone, "prisoner_chat_trade_freedom_3",
    [
      (gt, "$temp", 0),
    ],
    "Very well, It seems we have a deal, you are free to go.",
    "prisoner_chat_last_say",
    [
      (party_remove_prisoners, "p_main_party", "$g_talk_troop", 1),
      (troop_add_item, "trp_player", "itm_plate_armor"),

    ]],

  [plyr|anyone, "prisoner_chat_trade_freedom_3",
    [
      (eq, "$temp", 0),
    ],
    "Your armor is a fine crafstmanship, but my inventory is full.",
    "close_window",
    []],

  [plyr|anyone, "prisoner_chat_trade_freedom_3",
    [],
    "I will think upon your offer.",
    "close_window",
    []],

  [anyone, "prisoner_chat_2",
    [],
    "No, I swear I won't.",
    "close_window",
    []],

  [anyone, "prisoner_chat_last_say",
    [],
    "Celebrate while you can{playername}, next time you may be where I am now! ",
    "final_conversation",
    []],
  
  [plyr|anyone, "final_conversation",
    [],
    "I very much doubt that. ",
    "close_window",
    []],

##espen dialog end
 
Totenkopf900 said:
I created a bandit hero, made him a spawn point and all that, and finally managed to make so he don't spawn again if he is in player custody, and it was working until I added a dialog to make so you can trade his freedom for his armor, after that, even after being freed he don't respawn, what give?

here is the code

Code:
   ("spawn_espen_army",
    [
  (try_begin),
    (store_num_parties_of_template, ":num_parties", "pt_free_company"),
    (lt,":num_parties",1),
    (store_random,":spawn_point",num_free_company),
    (val_add,":spawn_point","p_free_company"),
    (set_spawn_radius,1),
    (spawn_around_party,":spawn_point","pt_free_company"),
    (display_message,"@The Free Company, led ny Espen the Ox has arrived in Calradia!",0x6666FF),
  (try_end),
     ]),

Code:
  (48, 0, ti_once,
   [],
   [
    (call_script, "script_spawn_espen_army"),
   ]),
  (5, 0, 48,
   [
    (neg|troop_slot_ge, "trp_espen", slot_troop_prisoner_of_party, 0),
   ],
   [
    (call_script, "script_spawn_espen_army"),
   ]),

Code:
##espen dialog

  [plyr|anyone, "prisoner_chat",
    [
    (store_free_inventory_capacity, "$temp"),
    ],
    "You are my prisoner, do not try running away or trying something stupid. I will be watching you.",
    "prisoner_chat_2",
    []],

  [anyone, "prisoner_chat_2",
    [
      (store_conversation_troop, "$g_talk_troop"),
      (str_store_troop_name, s43, "$g_talk_troop"),
      (is_between, "$g_talk_troop", "trp_leonard", "trp_bandit_heroes_end"),
    ],
    "I am your prisoner,{playername}. What you gonna do with me?",
    "prisoner_chat_trade_freedom",
    []],

  [plyr|anyone, "prisoner_chat_trade_freedom",
    [],
    "You have been defeated{s43}, your fate is in my hands now.",
    "prisoner_chat_trade_freedom_2",
    []],

  [anyone, "prisoner_chat_trade_freedom_2",
    [
      (eq, "$g_talk_troop", "trp_espen"),
    ],
    "Look, I can give you my armor if you let me go free.",
    "prisoner_chat_trade_freedom_3",
    []],

      [plyr|anyone, "prisoner_chat_trade_freedom_3",
    [
      (gt, "$temp", 0),
    ],
    "Very well, It seems we have a deal, you are free to go.",
    "prisoner_chat_last_say",
    [
      (party_remove_prisoners, "p_main_party", "$g_talk_troop", 1),
      (troop_add_item, "trp_player", "itm_plate_armor"),

    ]],

  [plyr|anyone, "prisoner_chat_trade_freedom_3",
    [
      (eq, "$temp", 0),
    ],
    "Your armor is a fine crafstmanship, but my inventory is full.",
    "close_window",
    []],

  [plyr|anyone, "prisoner_chat_trade_freedom_3",
    [],
    "I will think upon your offer.",
    "close_window",
    []],

  [anyone, "prisoner_chat_2",
    [],
    "No, I swear I won't.",
    "close_window",
    []],

  [anyone, "prisoner_chat_last_say",
    [],
    "Celebrate while you can{playername}, next time you may be where I am now! ",
    "final_conversation",
    []],
  
  [plyr|anyone, "final_conversation",
    [],
    "I very much doubt that. ",
    "close_window",
    []],

##espen dialog end
I am not sure and i dont want you to prevent from getting answered by somebody understand the problem better but The problem is most probably about that slot_troop_prisoner_of_party value doesn't change even if you freed him. It should be set to another value(greater or equal(ge) 0) for him after he is freed.
 
Totenkopf900 said:
  (48, 0, ti_once,
  [],
  [
    (call_script, "script_spawn_espen_army"),
  ]),
  (5, 0, 48,
  [
    (neg|troop_slot_ge, "trp_espen", slot_troop_prisoner_of_party, 0),
  ],
  [
    (call_script, "script_spawn_espen_army"),
  ]),
As far as i undertand the blue trigger should make the party respawn. And the bolded line says if the troop's slot value is less than "0"(not ge btw. I was wrong in my previous post.) for slot_troop_prisoner_of_party, the trigger will work. So after the bandit is freed, that slot should be set to another value which is less than "0" for the trigger to work. Btw, it is just my guessing about your problem.
 
litdum said:
Totenkopf900 said:
  (48, 0, ti_once,
  [],
  [
    (call_script, "script_spawn_espen_army"),
  ]),
  (5, 0, 48,
  [
    (neg|troop_slot_ge, "trp_espen", slot_troop_prisoner_of_party, 0),
  ],
  [
    (call_script, "script_spawn_espen_army"),
  ]),
As far as i undertand the blue trigger should make the party respawn. And the bolded line says if the troop's slot value is less than "0"(not ge btw. I was wrong in my previous post.) for slot_troop_prisoner_of_party, the trigger will work. So after the bandit is freed, that slot should be set to another value which is less than "0". Btw, it is just my guessing about your problem.


Ok, I understood now, but how I would go about setting the slot to -1?
 
By judging the dialogs you posted, i think this is the only option you set the bandit free:
      [plyr|anyone, "prisoner_chat_trade_freedom_3",
    [
      (gt, "$temp", 0),
    ],
    "Very well, It seems we have a deal, you are free to go.",
    "prisoner_chat_last_say",
    [
      (party_remove_prisoners, "p_main_party", "$g_talk_troop", 1),
      (troop_add_item, "trp_player", "itm_plate_armor"),
    (troop_set_slot, "trp_espen", slot_troop_prisoner_of_party, -1),

    ]],
It may work to add the line i bolded to here.
 
litdum said:
By judging the dialogs you posted, i think this is the only option you set the bandit free:
      [plyr|anyone, "prisoner_chat_trade_freedom_3",
    [
      (gt, "$temp", 0),
    ],
    "Very well, It seems we have a deal, you are free to go.",
    "prisoner_chat_last_say",
    [
      (party_remove_prisoners, "p_main_party", "$g_talk_troop", 1),
      (troop_add_item, "trp_player", "itm_plate_armor"),
    (troop_set_slot, "trp_espen", slot_troop_prisoner_of_party, -1),

    ]],
It may work to add the line i bolded to here.
Nice
 
litdum said:
Is there any way to check if the player talking with another troop(the dialog window is opened)?

search header_operations.py when you need a new operation.

Code:
conversation_screen_is_active         =   42  # Checks that the player is currently in dialogue with some agent. Can only be used in triggers of module_mission_templates.py file.
 
I've also worked on making Outlaw lords, got it working and all.
But I would like to take it further by adding a new faction of outlaw lords (maybe adding them like a kingdom, I don't know).

I would like them to hold banners just like normal lords, but they should not hold any fiefs.
How can I make this happen without having the faction go in exile at the start of the game?
No fiefs = No kingdom

I have succesfully added a new page of banners to the game, and the hero_troop has the banner on his shield.
Code:
  ("exiled_party_1","Exiled Party",icon_flagbearer_a|carries_goods(2),0,fac_warlords,bandit_personality,[(trp_exiled_1,1,1),(trp_black_knight,19,44]),
I'm guessing the party will not have a banner because I've added them like any other bandit party, and the troop needs to be the party leader for the other troops to use his banner.
Adding troops to this party would probably also be changed to recruiting troops from "fac_kingdom_7", wich I have assigned aswell.
Code:
  ("kingdom_hero_party","War Party",icon_flagbearer_a|pf_show_faction|pf_default_behavior,0,fac_commoners,soldier_personality,[]),
I'm guessing the normal lords use this party_template. But I'm not quite sure how it works.
Guessing this is liked to some other code that assigns each hero_troop as a party_leader and gives them the ability to recruit troops from villages, or does this happen automatically? (no villages/towns needed)

1. Where/how do I set my hero troop as a party_leader?
2. Where do I give this party the ability to recruit faction_kingdom_7 troops? (while not holding any fiefs)
3. How do I stop kingdom_7 from ending at the start of the game? (I need to remove the need for fiefs for this faction to exist)
 
Less Talking More Raiding said:
I've also worked on making Outlaw lords, got it working and all.
But I would like to take it further by adding a new faction of outlaw lords (maybe adding them like a kingdom, I don't know).

I would like them to hold banners just like normal lords, but they should not hold any fiefs.
How can I make this happen without having the faction go in exile at the start of the game?
No fiefs = No kingdom

I have succesfully added a new page of banners to the game, and the hero_troop has the banner on his shield.
Code:
  ("exiled_party_1","Exiled Party",icon_flagbearer_a|carries_goods(2),0,fac_warlords,bandit_personality,[(trp_exiled_1,1,1),(trp_black_knight,19,44]),
I'm guessing the party will not have a banner because I've added them like any other bandit party, and the troop needs to be the party leader for the other troops to use his banner.
Adding troops to this party would probably also be changed to recruiting troops from "fac_kingdom_7", wich I have assigned aswell.
Code:
  ("kingdom_hero_party","War Party",icon_flagbearer_a|pf_show_faction|pf_default_behavior,0,fac_commoners,soldier_personality,[]),
I'm guessing the normal lords use this party_template. But I'm not quite sure how it works.
Guessing this is liked to some other code that assigns each hero_troop as a party_leader and gives them the ability to recruit troops from villages, or does this happen automatically? (no villages/towns needed)

1. Where/how do I set my hero troop as a party_leader?
2. Where do I give this party the ability to recruit faction_kingdom_7 troops? (while not holding any fiefs)
3. How do I stop kingdom_7 from ending at the start of the game? (I need to remove the need for fiefs for this faction to exist)

1- not sure about that,but I think the hero is always the party leader
2-you need to add new reinforcements templates in module_party_templates

You can also use (party_set_banner_icon, "$exiled_party", "icon_banner_90"), to make them have banners.
 
Totenkopf900 said:
1- not sure about that,but I think the hero is always the party leader
2-you need to add new reinforcements templates in module_party_templates

You can also use (party_set_banner_icon, "$exiled_party", "icon_banner_90"), to make them have banners.
Already have this added to the scripts for spawning the party:
Code:
(troop_set_slot, "trp_exiled_1", slot_troop_banner_scene_prop, "spr_banner_h01"),
(party_set_banner_icon, "pt_exiled_party_1", "icon_banner_137"),
This makes the hero have the correct heraldic on his shield, but the rest of the guys still use the default shield heraldics.

And banner is not displayed on icon_flagbearer_a, he's holding nothing.
 
I am playing warband mod: Crusade Against Jihad. I this mod the random villages and especially random forts are a problem. I have downloaded the latest patch too. But is there a way to completely disable this feature of this mod, may be by doing some modding or in any other way possible because apart from this it is a great mod.
 
Status
Not open for further replies.
Back
Top Bottom