Help with personal mod -- Force Peace

Users who are viewing this thread

Helton

Recruit
***Is anyone savvy enough and familiar with Silverstag to give me a relatively simple code (or instructions to make the code myself) that has the enemy king offer terms if I request peace?***

Problem:
When I ask a king for peace in Silverstag he does a computation and tells me yes or no. The trouble for me is with the 'no'. Last game I ended up in a war with three factions and it basically ruined the enjoyment. Seems they also become much less likely to make peace once they dogpile.

Proposed Solution:
(I think Diplomacy works this way) While kings may occasionally outright refuse peace, it should be rare. Instead he should offer me terms. If he is in a winning position the terms can be harsh.

I think this would be a major improvement to the mod overall but it seems development has slowed a lot without Windy and it may not have been high priority anyways. So just for me I would like either:

a) Code that has an enemy king offer terms when I ask for peace. Seems a number of some kind is computed here: "script_npc_decision_checklist_peace_or_war", and maybe some constant multiple of that number would be a reasonable price (max(5000x, 0)).

b) Failing that, a simple cheat dialogue option that forces peace.

What I've tried so far: I have some of the source files for Silverstag and Diplomacy open side-by-side in WinMerge and am trying to isolate relevant scripts, dialogues and variables. Its very slow going though. I'll keep trying to figure something out myself but I think this is complicated enough to ask for help and simple enough that someone here might be able to help.

Thanks for reading and I've got my fingers crossed. :smile:
 
Made some progress on this since yesterday. In the module_dialogs.py file at line 10752, right below the comment #If the player factions is active:

Code:
[anyone,"lord_ask_pardon",
   [
	(faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
   
    (assign, ":has_center", 0),
    (try_for_range, ":cur_center", centers_begin, centers_end),
       (store_faction_of_party, ":cur_center_faction", ":cur_center"),
       (eq, ":cur_center_faction", "fac_player_supporters_faction"),
       (assign, ":has_center", 1),
    (try_end),
    (eq, ":has_center", 1),
	 
        (call_script, "script_npc_decision_checklist_peace_or_war", "$g_talk_troop_faction", "fac_player_supporters_faction", "trp_player"), ## 1.152 ## 
	(lt, reg0, 0),
    ], #Helton_begin
   "I do not see it as being in my current interest to make peace, unless you can sweeten the deal. For -20000*{reg0} crowns I would consider a truce.", "lord_truce_terms",[]],

  [anyone|plyr,"lord_truce_terms",
   [(store_troop_gold, ":gold","trp_player"),(ge, ":gold", -20000*reg0)],
    "I accept. Let us stop making war upon each other, for the time being anyway", "lord_truce_terms_accept",[]], 
 
   [anyone|plyr,"lord_truce_terms",
   [], "On second thought, such an accord would not be in my interests.", "lord_pretalk",[]],

  [anyone,"lord_truce_terms_accept", [], "Excellent, {playername}.", "close_window",
   [
   (troop_remove_gold, "trp_player", -20000*reg0),
   (call_script, "script_diplomacy_start_peace_between_kingdoms", "$g_talk_troop_faction", "$players_kingdom", 1), ## 1.152 ## 
     ]],
  
   #Helton_end

The peace part of this seems to be working (I'm testing it on my old save which motivated this post). I talk to Sanjar and where he used to refuse peace he makes the above dialogue.

A couple issues still:

1) When he asks for money it prints exactly what you see, -20000*-1. I want this computation done and the result printed. I tried moving the computation inside the bracket {-20000*reg0} but this caused it not to recognize the variable. I just have to figure out the python syntax better but if someone throws me a bone in the meantime, much obliged. :smile:

2) This one is more serious, money is not actually being subtracted from the player's inventory. I ripped this: (troop_remove_gold, "trp_player", -20000*reg0), from other dialogue options, but the multiplying by -20000 is obviously new. Is that what's breaking it?

If you scroll down a bit, here is the call in action:

Code:
[anyone,"lord_ask_pardon_tribue_accept", [
  (faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
  ], "Excellent, {playername}.\
 I will use this to make amends to those you have wronged, and I will let it be known that you are no longer an enemy of the {s4}.", "close_window",
   [
      (troop_remove_gold, "trp_player", reg16),
	 (store_relation, ":players_kingdom_relation", "$g_talk_troop_faction", "$players_kingdom"),
	 
     (try_begin),
       (this_or_next|eq, "$players_kingdom", 0),
		(ge, ":players_kingdom_relation", 0),
       (call_script, "script_set_player_relation_with_faction", "$g_talk_troop_faction", 0),
     (try_end),
     (assign,"$g_leave_town_outside",1),
     (assign, "$g_leave_encounter", 1),
     ]],

Anyways, I'll keep dinking around and will hopefully figure it out. Thanks for any advice. :smile:
 
At line 10764, this seems to work:

Code:
        (call_script, "script_npc_decision_checklist_peace_or_war", "$g_talk_troop_faction", "fac_player_supporters_faction", "trp_player"), ## 1.152 ## 
	(lt, reg0, 0), #Helton_begin
    (store_mul, reg16, reg0, -20000),],
   "I do not see it as being in my current interest to make peace, unless you can sweeten the deal. For {reg16} crowns I would consider a truce.", "lord_truce_terms",[]],
  [anyone|plyr,"lord_truce_terms",
   [(store_troop_gold, ":gold","trp_player"),(ge, ":gold", reg16)],
    "I accept. Let us stop making war upon each other, for the time being anyway", "lord_truce_terms_accept",[]], 
 
   [anyone|plyr,"lord_truce_terms",
   [], "On second thought, such an accord would not be in my interests.", "lord_pretalk",[]],

  [anyone,"lord_truce_terms_accept", [], "Excellent, {playername}.", "close_window",
   [
   (troop_remove_gold, "trp_player", reg16),
   (call_script, "script_diplomacy_start_peace_between_kingdoms", "$g_talk_troop_faction", "$players_kingdom", 1), ## 1.152 ## 
     ]],
  
   #Helton_end

Hopefully doesn't cause anything to blow up elsewhere. I doubt it would. Going to start a new game soon so I'll update if I run into issues.
 
Back
Top Bottom