Add more people in towns?

Users who are viewing this thread

Mysterius

Regular
Hello,

I was messing around with the scene editor ingame and i tried to figure out how to add more townsfolk and guards than currently possible. I find the towns empty and i would like to add life in them!

I searched on the forum here and there, found some references about things in module_troops and module_mission_templates but, as i'm a complete noob, i don't really understand everything in those files.

Does someone have a simple way to do that? Well, if there is a simple way  :razz:.

Thanks!
 
Just things you have to do;
-Get module system
-Open module_constants.py
-Find "#Walker types:"line
-In there "num_town_walkers = 20"
-Change the number whatever u want...
-Load module system to your module
-Run M&B
,but give it a try...
 
Nope it doesn't work. I don't think it is that straightforward.
You have to place entrypoints to spawn NPC's in town. And i guess i would need to "add" new entry points with new townsfolk attached to them. But i have no clue how to do that :sad:.

Seriously, entry points... what a damn system  ^^
 
have you any more details about that?
I took a look at the mission_templates file but it's quite a mess. I'm new to this and really want to add some townwalkers...

thanks
 
It's fairly easy to script this.

First part:  getting more people into the towns.  This part's easy- a one line change.  Find script_init_town_walkers in module_scripts.

Remove the line that reads:  (set_visitor, ":entry_no", ":walker_troop_id"), and replace it with this:  (set_visitors,":entry_no", ":walker_troop_id",5),

Here's an example, if you're confused.

Code:
          # script_init_town_walkers
          # Input: none
          # Output: none
          ("init_town_walkers",
            [
              (try_begin),
                (eq, "$town_nighttime", 0),
                (try_for_range, ":walker_no", 0, num_town_walkers),
                  (store_add, ":troop_slot", slot_center_walker_0_troop, ":walker_no"),
                  (party_get_slot, ":walker_troop_id", "$current_town", ":troop_slot"),
                  (gt, ":walker_troop_id", 0),
                  (store_add, ":entry_no", town_walker_entries_start, ":walker_no"),
		   (set_visitors,":entry_no", ":walker_troop_id",5),
                (try_end),
              (try_end),
          ]),

Now for the "hard" part:  getting those additional people to move around and look vaguely like a crowd.  Replace the entire script_set_town_walker_destination with this code.  That's it.  Now you have a lot more people, and they'll wander around randomly.

Code:
          # script_set_town_walker_destination
          # Input: arg1 = agent_no
          # Output: none
          ("set_town_walker_destination",
            [(store_script_param_1, ":agent_no"),	  
			(store_random_in_range, ":rand_dest", 1 ,12),
			
            (try_begin),
				(eq, ":rand_dest", 1),
				(assign, ":target_entry_point", 9),
			(else_try),	
				(eq, ":rand_dest", 2),
				(assign, ":target_entry_point", 10),
			(else_try),	
				(eq, ":rand_dest", 3),
				(assign, ":target_entry_point", 12),	
			(else_try),	
				(eq, ":rand_dest", 4),
				(assign, ":target_entry_point", 32),	
			(else_try),	
				(eq, ":rand_dest", 2),
				(assign, ":target_entry_point", 33),	
			(else_try),	
				(eq, ":rand_dest", 5),
				(assign, ":target_entry_point", 34),	
			(else_try),	
				(eq, ":rand_dest", 6),
				(assign, ":target_entry_point", 35),	
			(else_try),	
				(eq, ":rand_dest", 7),
				(assign, ":target_entry_point", 36),	
			(else_try),	
				(eq, ":rand_dest", 8),
				(assign, ":target_entry_point", 37),	
			(else_try),	
				(eq, ":rand_dest", 9),
				(assign, ":target_entry_point", 38),	
			(else_try),	
				(eq, ":rand_dest", 10),
				(assign, ":target_entry_point", 39),	
			(else_try),	
				(assign, ":target_entry_point", 10),					
			(try_end),
			  
              (try_begin),
                (agent_set_slot, ":agent_no", 0, ":target_entry_point"),
                (entry_point_get_position, pos1, ":target_entry_point"),
                (try_begin),
                  (init_position, pos2),
                  (position_set_y, pos2, 250),
                  (position_transform_position_to_parent, pos1, pos1, pos2),
                (try_end),
                (agent_set_scripted_destination, ":agent_no", pos1, 0),
                (agent_set_speed_limit, ":agent_no", 5),
              (try_end),
          ]),
 
xenoargh said:
Oh, and the tick function could also be used to add crowd ambience, but I'm too lazy to code that atm.
That's eough for the moment, i'll play with thay and get you back on it.

The thing is that i need the Module System fo the mod im currently working on, which i dont have atm.
thanks again for your time!

*EDIT Will this be applied to every town?

@Said : ok will keep that in mind

**EDIT Tested it and worked fine, many thanks!!

@Xenoargh : hope you dont mind if i put what you wrote here into that thread:
http://forums.taleworlds.com/index.php/topic,163368.0.html
it could help others
 
xenoargh said:
Remove the line that reads:  (set_visitor, ":entry_no", ":walker_troop_id"), and replace it with this:  (set_visitors,":entry_no", ":walker_troop_id",5),

5 is the number of walkers that will spawn on each entry point, you can put whatever you want there. but take care about performances


 
Is it possible add more town_walker types? I was thinking add childs (tf_child), but I cant figure like spawn them in towns and villages.
Absolutely, yes.  Here's a simple example, using a 1 in 3 chance of children being spawned, instead of adults, at any given point.  The only catch to adding a lot of detail this way is that set_visitors will only use one troop ID, and it reserves an entry point. 

If you get some kids written up, please share it back, I'd love to see some kids in towns :smile:

Code:
(set_visitors,":entry_no", ":walker_troop_id",5),
(store_random_in_range, ":is_child", 1, 4),
(try_begin),
(eq, ":is_child", 1),
(store_random_in_range, ":child_type", 1, 3),
(try_begin),
(eq, ":child_type", 1),
(set_visitors,":entry_no", "trp_male_child",5),
(else_try),
(set_visitors,":entry_no", "trp_female_child",5),
(try_end),
(try_end),
 
So exactly how many people can I add to towns? Can I have 100 or 200?
Yeah I know. Souns crazy and awesome at the same time.
 
Idibil said:
Thanks Xenoargh

Is it possible add more town_walker types? I was thinking add childs (tf_child), but I cant figure like spawn them in towns and villages.

I had the same (nice) idea for my mod :grin: adding childs and thieves ..etc
 
So exactly how many people can I add to towns? Can I have 100 or 200?
Yeah I know. Souns crazy and awesome at the same time.
Simple answer is that it depends, but I'd keep it under 100.  Towns are pretty resource-intensive, moreso than most battlefields, and the streets are narrow enough that the AI has trouble enough figuring out how to get places that if you get the number high enough, neither they nor players will be able to navigate very well.
 
mb14v.jpg



mb17c.jpg


Done. Thanks!!!

Code for child I am using is do a man body small, and create troop with younger face code, where I add tf_child.
I have posted this here for tall/short men (it is same, but most small)

http://forums.taleworlds.com/index.php/topic,168513.0.html

For child I use:


  (
    "nino", 0,
    "man_body", "man_calf_l", "m_handL",
    "male_head", nino_face_keys,
    ["man_hair_s","man_hair_m","man_hair_n","man_hair_o", "man_hair_y10", "man_hair_y12","man_hair_p","man_hair_r","man_hair_q","man_hair_v","man_hair_t","shortlayer","shoulderhair","man_hair_y7","man_hair_y9","man_hair_y11","man_hair_u","man_hair_y","man_hair_y2","man_hair_y4", "hairmessy","slickedback","shortbob","straightshoulder", "longshoulder", "longstraight","ponytail","courthair","shortcut"], #man_hair_meshes ,"man_hair_y5","man_hair_y8",
    [], #beard meshes ,"beard_q"
    ["hair_blonde", "hair_red", "hair_brunette", "hair_black", "hair_white"], #hair textures
    [], #beard_materials
    [("manface_young_2",0xffcbe0e0,["hair_blonde"],[0xffffffff, 0xffb04717, 0xff632e18, 0xff502a19, 0xff19100c]),
    ("manface_young",0xffd0e0e0,["hair_blonde"],[0xffffffff, 0xffb04717, 0xff632e18, 0xff502a19, 0xff19100c]),   
#    ("manface_old",0xffd0d0d0,["hair_white","hair_brunette","hair_red","hair_blonde"],[0xffffcded, 0xffbbcded, 0xff99eebb]),
    ("manface_young_3",0xffdceded,["hair_blonde"],[0xff2f180e, 0xff171313, 0xff007080c]),
#    ("manface_young_4",0xffe0e8e8,["hair_blonde"],[0xff2f180e, 0xff171313, 0xff007080c]),
#chief skins man
    ("manface_young_21",0xffcbe0e0,["hair_blonde"],[0xffffffff, 0xffb04717, 0xff632e18, 0xff502a19, 0xff19100c]),
    #chief acaba
#    ("manface_old_2",0xffd5d5c5,["hair_white"],[0xffffcded, 0xffbbcded, 0xff99eebb]),
    ], #man_face_textures,
    [(voice_die,"snd_man_die"),(voice_hit,"snd_man_hit"),(voice_grunt,"snd_man_grunt"),(voice_grunt_long,"snd_man_grunt_long"),(voice_yell,"snd_man_yell"),(voice_stun,"snd_man_stun"),(voice_victory,"snd_man_victory")], #voice sounds
    "skel_human", 0.7,
    psys_game_blood,psys_game_blood_2,
    [[1.7, comp_greater_than, (1.0,face_width), (1.0,temple_width)], #constraints: ex: 1.7 > (face_width + temple_width)
    [0.3, comp_less_than, (1.0,face_width), (1.0,temple_width)],
    [1.7, comp_greater_than, (1.0,face_width), (1.0,face_depth)],
    [0.3, comp_less_than, (1.0,eyebrow_height), (1.0,eyebrow_position)],
    [1.7, comp_greater_than, (1.0,eyebrow_height), (1.0,eyebrow_position)],
    [-0.7, comp_less_than, (1.0,nose_size), (-1.0,nose_shape)],
    [0.7, comp_greater_than, (1.0,nose_size), (-1.0,nose_shape)],
    [2.7, comp_greater_than, (1.0,chin_size), (1.0,mouth_nose_distance), (1.0,nose_height), (-1.0,face_width)],
    ]
  ),


And in header_troops.py

tf_nino = 3
 
xenoargh said:
Is it possible add more town_walker types? I was thinking add childs (tf_child), but I cant figure like spawn them in towns and villages.
Absolutely, yes.  Here's a simple example, using a 1 in 3 chance of children being spawned, instead of adults, at any given point.  The only catch to adding a lot of detail this way is that set_visitors will only use one troop ID, and it reserves an entry point. 

If you get some kids written up, please share it back, I'd love to see some kids in towns :smile:

Code:
(set_visitors,":entry_no", ":walker_troop_id",5),
(store_random_in_range, ":is_child", 1, 4),
(try_begin),
(eq, ":is_child", 1),
(store_random_in_range, ":child_type", 1, 3),
(try_begin),
(eq, ":child_type", 1),
(set_visitors,":entry_no", "trp_male_child",5),
(else_try),
(set_visitors,":entry_no", "trp_female_child",5),
(try_end),
(try_end),
Very Very Very Very Very Very Very Much Thank You Sir! I add a walking babies in town  :mrgreen:
 
Ok question about this, when you add more ppl to the towns can you also make some of them like the rich class? as in some wear the normal town clothes and some wear the rich robes, also is there a part in this script that can make it to where this town has ppl wearing nice clothes and this town were eveyone id wearing rags?
 
Lato said:
Ok question about this, when you add more ppl to the towns can you also make some of them like the rich class? as in some wear the normal town clothes and some wear the rich robes, also is there a part in this script that can make it to where this town has ppl wearing nice clothes and this town were eveyone id wearing rags?
Make your Troops/Unit, and make like Xenoargh made but change the troop types
 
Back
Top Bottom