How increase ransom_brokers?

Users who are viewing this thread

gdwitt

Knight at Arms
Playing Brytenwalda, there are an average of 12-15 ransom brokers on a 44 town map.
I want to increase this to 15-18.
There are 20 different ransom_brokers in module_troops and I increased it to 21.
I then went to game menus and decreased the 9 below to 7, which I thought would fix it.
In-game, it appears there appears to be no difference and there might be even fewer brokers in the taverns.
Any advice would be appreciated.
Code:
(try_begin), #this doubles the incidence of ransom brokers and (below) minstrels
               (party_get_slot, ":ransom_broker", "$current_town", slot_center_ransom_broker),
               (gt, ":ransom_broker", 0),
               
               (assign, reg0, ":ransom_broker"),
               (assign, reg1, "$current_town"),
			   
               (set_visitor, ":cur_entry", ":ransom_broker"),
               (val_add, ":cur_entry", 1),
			 (else_try),
			   (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
			   (store_add, ":alternative_town", "$current_town", 9),
			   
			   (try_begin),
				(ge, ":alternative_town", towns_end),
				(val_sub, ":alternative_town", 22),
			   (try_end),
			   (try_begin),
				(eq, "$cheat_mode", 1),
			    (str_store_party_name, s3, "$current_town"),
			    (str_store_party_name, s4, ":alternative_town"),
			    (display_message, "@{!}DEBUG - Current town is {s3}, but also checking {s4}"),
			   (try_end),	
			   
               (party_get_slot, ":ransom_broker", ":alternative_town", slot_center_ransom_broker),
               (gt, ":ransom_broker", 0),
			   
               (set_visitor, ":cur_entry", ":ransom_broker"),
               (val_add, ":cur_entry", 1),
             (try_end),
 
Yes, I added 1 NPC ransom_broker to the 20 that were there.
However, only 13-16 show up in the traveller dialog screen at each random shuffle.
How can I increase this?
I tried raising the 22 number above to 43 to match the number of towns.
I tried raising the 9 to 11 and down to 7.
I couldn't quite tell if they worked.
I would be happy if they acted like bards and booksellers and were always present somewhere.
 
I do not know about Brytenwalda's module system but just an advice,  check these lines that should be in module_constans :
Code:
slot_ransom_brokers_begin  =  ....? 
slot_ransom_brokers_end  = ....?
 
Code:
  #script_update_ransom_brokers
  # INPUT: none
  # OUTPUT: none
  ("update_ransom_brokers",
    [(try_for_range, ":town_no", towns_begin, towns_end),
       (party_set_slot, ":town_no", slot_center_ransom_broker, 0),
     (try_end),
     
     (try_for_range, ":troop_no", ransom_brokers_begin, ransom_brokers_end),
       (store_random_in_range, ":town_no", towns_begin, towns_end),
       (party_set_slot, ":town_no", slot_center_ransom_broker, ":troop_no"),
     (try_end),

     (party_set_slot,"p_town_2",slot_center_ransom_broker,"trp_ramun_the_slave_trader"),
     ]),

Change this script (and the ones for travellers, etc).

First: do a try_for_range for all towns and set the slot to -1 (empty)
Second: do a try_for_range on the npcs with a random town. Check if its -1 then use that town. If it is not, skip and try again.

What seems to be happening now: it puts npcs on random cities over and over. If you have 20 npcs and 50 towns you will end up with 1 to 20 towns with a npc, it is random luck (20 npcs could be set to the same town)
 
I'm not sure I understand what you're saying.
Here is what I did in module_scripts:

Code:
  ("update_ransom_brokers",
    [(try_for_range, ":town_no", towns_begin, towns_end),
       (party_set_slot, ":town_no", slot_center_ransom_broker, -1),
     (try_end),
     
     (try_for_range, ":troop_no", ransom_brokers_begin, ransom_brokers_end),
       (store_random_in_range, ":town_no", towns_begin, towns_end),
       (party_set_slot, ":town_no", slot_center_ransom_broker, ":troop_no"),
     (try_end),

     (party_set_slot,"p_town_2",slot_center_ransom_broker,"trp_ramun_the_slave_trader"),
     ]),
Notice that there are several ransom_broker scripts in module_game_menu:

Code:
       (try_begin), #this doubles the incidence of ransom brokers and (below) minstrels
               (party_get_slot, ":ransom_broker", "$current_town", slot_center_ransom_broker),
               (gt, ":ransom_broker", 0),
               
               (assign, reg0, ":ransom_broker"),
               (assign, reg1, "$current_town"),
			   
               (set_visitor, ":cur_entry", ":ransom_broker"),
               (val_add, ":cur_entry", 1),
			 (else_try),
			   (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
			   (store_add, ":alternative_town", "$current_town", 3),#gdw more brokers?14
			   
			   (try_begin),
				(ge, ":alternative_town", towns_end),
				(val_sub, ":alternative_town", 43),#gdw there are 44 towns
			   (try_end),
			   (try_begin),
				(eq, "$cheat_mode", 1),
			    (str_store_party_name, s3, "$current_town"),
			    (str_store_party_name, s4, ":alternative_town"),
			    (display_message, "@{!}DEBUG - Current town is {s3}, but also checking {s4}"),
			   (try_end),	
			   
               (party_get_slot, ":ransom_broker", ":alternative_town", slot_center_ransom_broker),
               (gt, ":ransom_broker", 0),
			   
               (set_visitor, ":cur_entry", ":ransom_broker"),
               (val_add, ":cur_entry", 1),
             (try_end),
"First: do a try_for_range for all towns and set the slot to -1 (empty)" I think I did this above?
"Second: do a try_for_range on the npcs with a random town. Check if its -1 then use that town. If it is not, skip and try again." I don't understand this.

What is happening now: There is never more than 1 ransom broker per town. In one build, there can be 12-15 on taverns according to reports from travellers.
Is there a way I can get a more accurate assessment in
 
gdwitt said:
"Second: do a try_for_range on the npcs with a random town. Check if its -1 then use that town. If it is not, skip and try again." I don't understand this.

50 towns (town_1, town_2, etc)
20 npcs (npc_1, npc_2, etc)

For each NPC set a TOWN:

Step 1: select a random town
Step 2: give it to the NPC

Execute:

npc_1 => random town = town_10 => npc_1 is on town_10
npc_2 => random town = town_10 => npc_2 is on town_10  (and now npc_1 is nowhere to be found)
npc_3 => random town = town_40 => npc_3 is on town_40  (and now you have 2 in the world)
....
 
Also, doesn't the trybegin and try end logic look fault there.
I edited the chain and there seems to be try_ends missing.
Why didn't WRECK catch these?
Code:
 (try_begin), #this doubles the incidence of ransom brokers and (below) minstrels
           (party_get_slot, ":ransom_broker", "$current_town", slot_center_ransom_broker),
            (gt, ":ransom_broker", 0),
               
            (assign, reg0, ":ransom_broker"),
            (assign, reg1, "$current_town"),
			   
            (set_visitor, ":cur_entry", ":ransom_broker"),
            (val_add, ":cur_entry", 1),
			  (else_try),
			    (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
			    (store_add, ":alternative_town", "$current_town", 9),#gdw more brokers?9
			 
			  		(try_begin),
				     	(ge, ":alternative_town", towns_end),
				     	(val_sub, ":alternative_town", 22),#gdw there are 44 towns was at22
			       	(try_end),
			   		(try_begin),
							(eq, "$cheat_mode", 1),
			    		(str_store_party_name, s3, "$current_town"),
			    		(str_store_party_name, s4, ":alternative_town"),
			    		(display_message, "@{!}DEBUG - Current town is {s3}, but also checking {s4}"),
			   		(try_end),	
			   #gdwadded:		(try_begin),
               (party_get_slot, ":ransom_broker", ":alternative_town", slot_center_ransom_broker),
               (gt, ":ransom_broker", 0),
			   
               (set_visitor, ":cur_entry", ":ransom_broker"),
               (val_add, ":cur_entry", 1),
               #gdw	(try_end),
        (try_end),
This is the code used in Floris above; it's the same as in BW except for my two commented sections near the bottom where I suggest adding a try_begin and end
 
Litdum: This has already been fixed.

How do I get process_line_correction to act on module_dialogs?
It's just a text python file.

"First: do a try_for_range for all towns and set the slot to -1 (empty)
Second: do a try_for_range on the npcs with a random town. Check if its -1 then use that town. If it is not, skip and try again."

How would you implement this in code?
Is the comment "first" meant for the script in module_scripts? It doesn't seem to be helping.
("update_ransom_brokers",
Code:
    [(try_for_range, ":town_no", towns_begin, towns_end),
       (party_set_slot, ":town_no", slot_center_ransom_broker, -1),
     (try_end),
     
     (try_for_range, ":troop_no", ransom_brokers_begin, ransom_brokers_end),
       (store_random_in_range, ":town_no", towns_begin, towns_end),
       (party_set_slot, ":town_no", slot_center_ransom_broker, ":troop_no"),
     (try_end),

     (party_set_slot,"p_town_2",slot_center_ransom_broker,"trp_ramun_the_slave_trader"),
     ]),
 
:shock:

When I change the values to be like this:
Code:
(else_try),
			    (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end),
			    (store_add, ":alternative_town", "$current_town", 2),#gdw more brokers?9
			 
			  		(try_begin),
				     	(ge, ":alternative_town", towns_end),
				     	(val_sub, ":alternative_town", 43),#gdw there are 44 towns was at22
			       	(try_end),
			   		(try_begin),
							(eq, "$cheat_mode", 1),
			    		(str_store_party_name, s3, "$current_town"),
			    		(str_store_party_name, s4, ":alternative_town"),
			    		(display_message, "@{!}DEBUG - Current town is {s3}, but also checking {s4}"),
			   		(try_end),
I got 41 ransom_brokers for 44 towns.
I would like it to be more like 20.

(Scripts.py was like this:
("update_ransom_brokers",
    [(try_for_range, ":town_no", towns_begin, towns_end),
      (party_set_slot, ":town_no", slot_center_ransom_broker, -1)
I could keep tweaking these numbers if we can't figure out a code here.
I think this is near a sufficient resolution compared to my other bugs in-game.
 
I could do that in Java, but not Python.
Can you point out an example of a counter and condition when you have some time?

(You should all come see my new script for the Relic quest)
Thanks Kalarhan
 
Back
Top Bottom