Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
hey guys, i made a new companion for my WIP mod, i want him to be on a specific scene, i did it by adding scn_castle_49_thoneroom|entry(2) to his module_troop entry, it worked fine, but if i recruit him, when i come back on that scene again with him on party he gets duplicated and i have 2 indentical companions following me around , how i can prevent this? also, i still find him on taverns, even with a scene specified, how to prevent this too?



also a third question, where are the troops that companions recruit being vassal controlled? ,coz i set him to be fac_player_faction and he doesn't recruit my troops (custom tree i made and integrated into recruit system) but if i set him to fac_kingdom_1 he gets swadian guys. i can't find it anywhere, maybe im blind

(troop_set_slot, "trp_npc17", slot_troop_original_faction, "fac_player_faction"), <--- talking about this line in
module_scripts.

:smile:

thanks in advance
 
asierus said:
hey guys, i made a new companion for my WIP mod, i want him to be on a specific scene, i did it by adding scn_castle_49_thoneroom|entry(2) to his module_troop entry, it worked fine, but if i recruit him, when i come back on that scene again with him on party he gets duplicated and i have 2 indentical companions following me around , how i can prevent this?

You can use the operation remove_troop_from_site, but I don't know if this works on the latest versions of the Module System.

Code:
remove_troop_from_site                       = 1251  # (remove_troop_from_site, <troop_id>, <scene_id>),
                                                     # Removes the troop from the specified scene. No longer used in Native.
 
Hernanxd16 said:
asierus said:
hey guys, i made a new companion for my WIP mod, i want him to be on a specific scene, i did it by adding scn_castle_49_thoneroom|entry(2) to his module_troop entry, it worked fine, but if i recruit him, when i come back on that scene again with him on party he gets duplicated and i have 2 indentical companions following me around , how i can prevent this?

You can use the operation remove_troop_from_site, but I don't know if this works on the latest versions of the Module System.

Code:
remove_troop_from_site                       = 1251  # (remove_troop_from_site, <troop_id>, <scene_id>),
                                                     # Removes the troop from the specified scene. No longer used in Native.

the problem here its that  remove_troop_from_site seems to not work on module_strings, wheret the recruit dialog seems to be. maybe im missing something?
 
asierus said:
the problem here its that  remove_troop_from_site seems to not work on module_strings, wheret the recruit dialog seems to be. maybe im missing something?

Create a trigger to check when the NPC is on the party of the player and then, use the operation remove_troop_from_site.
 
Hernanxd16 said:
Create a trigger to check when the NPC is on the party of the player and then, use the operation remove_troop_from_site.

a alternative is to update the script that spawn recruitable companions on scenes and add your new rules (companion X only shows on scene Y if not in my party).



asierus said:
(troop_set_slot, "trp_npc17", slot_troop_original_faction, "fac_player_faction"), <--- talking about this line in

not sure what you changed on the recruiting process, but you need to check if you are using that or "fac_player_supporters_faction" instead. Your vassals, towns, etc, belong to that one.



Bustah said:
Do you see my issue? The game decides prisoners

when you don't know how something works, you can start from the end and walk your way back. Find the code responsible for after battle stuff (a game menu), locate the code responsible for tracking wounded and prisoners, see how you can adapt/modify it, and hook that up with your mission template logic. Remember you can override engine behavior with your own custom code.
 
Hernanxd16 said:
asierus said:
the problem here its that  remove_troop_from_site seems to not work on module_strings, wheret the recruit dialog seems to be. maybe im missing something?

Create a trigger to check when the NPC is on the party of the player and then, use the operation remove_troop_from_site.

yep it did the trick thanks :smile:

 
kalarhan said:
asierus said:
(troop_set_slot, "trp_npc17", slot_troop_original_faction, "fac_player_faction"), <--- talking about this line in

not sure what you changed on the recruiting process, but you need to check if you are using that or "fac_player_supporters_faction" instead. Your vassals, towns, etc, belong to that one.
i just edited it to allow diplomacy recruiter be able to recruit player kingdom troops, wich work just fine, i don't know why vassals dont want to pick them what they do fine its reinforce their castles garrisons,with the player kingdom troops but not their party.
 
Does anyone know how to add/remove a troop from the wounded stacks?

I think I find the number of wounded by running through the defeated agent's party stacks until I find the one that matches his troop type, but I don't know how I would edit this number. There's nothing in header_operations that allows the setting of these stacks, only getting.
 
Now, a text overlay doesn't appear. Codes are these:
Code:
("diplomacy_agree_comes", 0, mesh_load_window, [
    (ti_on_presentation_load,
     [
      (presentation_set_duration, 999999),
      (set_fixed_point_multiplier, 1000),#create_text_overlay

      (assign, "$reason_box", -1),
      (assign, "$reason_attack_other_country", -1),
      (assign, "$reason_defend_other_country", -1),
      (assign, "$reason_trade", -1),
      (assign, "$reason_political_intrigue", -1),
      (assign, "$reason_trust_us", -1),
      (assign, "$reason_trust_other_country", -1),
      (assign, "$reason_become_ally_with_us", -1),
      (assign, "$reason_be_our_client_state", -1),
      (assign, "$cik_su_prnstdan_test", -1),

      (str_clear, s1),
      (str_clear, s2),
      (str_clear, s3),
      (str_clear, s4),

      (try_begin),
      (eq, "$diplomacy_reason_1", slot_diplomacy_reason_defend_us),
      (try_begin),
      (eq, "$diplomacy_with_faction", "fac_xelosas"),
      (str_store_string, s1, "@Defend us.(Xelosas)"),
      (else_try),
      (eq, "$diplomacy_with_faction", "fac_velcsoris"),
      (str_store_string, s1, "@Defend us.(Velcsoris)"),
      (try_end),
      (else_try),
      (eq, "$diplomacy_reason_1", slot_diplomacy_reason_trade),
      (try_begin),
      (eq, "$diplomacy_with_faction", "fac_xelosas"),
      (str_store_string, s1, "@Trade.(Xelosas)"),
      (else_try),
      (eq, "$diplomacy_with_faction", "fac_velcsoris"),
      (str_store_string, s1, "@Trade.(Velcsoris)"),
      (try_end),
      (try_end),
      
      (try_begin),
      (eq, "$diplomacy_reason_2", slot_diplomacy_reason_defend_us),
      (try_begin),
      (eq, "$diplomacy_with_faction", "fac_xelosas"),
      (str_store_string, s2, "@Defend Us 2.(Xelosas)"),
      (else_try),
      (eq, "$diplomacy_with_faction", "fac_velcsoris"),
      (str_store_string, s2, "@Defend Us 2. (Velcsoris)"),
      (try_end),
      (else_try),
      (eq, "$diplomacy_reason_2", slot_diplomacy_reason_trade),
      (try_begin),
      (eq, "$diplomacy_with_faction", "fac_xelosas"),
      (str_store_string, s2, "@Trade 2.(Xelosas)"),
      (else_try),
      (eq, "$diplomacy_with_faction", "fac_velcsoris"),
      (str_store_string, s2, "@Trade 2. (Velcsoris)"),
      (try_end),
      (try_end),

#      (assign, "$reason_box", -1),
#      (assign, "$reason_attack_other_country", -1),
#      (assign, "$reason_defend_other_country", -1),
#      (assign, "$reason_trade", -1),
#      (assign, "$reason_political_intrigue", -1),
#      (assign, "$reason_trust_us", -1),
#      (assign, "$reason_trust_other_country", -1),
#      (assign, "$reason_become_ally_with_us", -1),
#      (assign, "$reason_be_our_client_state", -1),
       

      (create_text_overlay, "$reason_box", "@{s1}^^{s2}", tf_scrollable),

      (create_in_game_button_overlay, "$reason_attack_other_country", "@Attack Another Country"),
      (create_in_game_button_overlay, "$reason_defend_other_country", "@Defend Each Other"),
      (create_in_game_button_overlay, "$reason_trade", "@Trade Each Other"),
      (create_in_game_button_overlay, "$reason_political_intrigue", "@Political Intrigue"),
      (create_in_game_button_overlay, "$reason_trust_other_country", "@Trust Other Country"),
      (create_in_game_button_overlay, "$reason_become_ally_with_us", "@Become Ally With Us"),
      (create_in_game_button_overlay, "$reason_be_our_client_state", "@Be our Client State"),
      (create_in_game_button_overlay, "$cik_su_prnstdan_test", "@Exit"),
      (position_set_x, pos1, 250),
      (position_set_y, pos1, 250),
      (overlay_set_size, "$reason_attack_other_country", pos1),
      (overlay_set_size, "$reason_defend_other_country", pos1),
      (overlay_set_size, "$reason_trade", pos1),
      (overlay_set_size, "$reason_political_intrigue", pos1),
      (overlay_set_size, "$reason_trust_other_country", pos1),
      (overlay_set_size, "$reason_become_ally_with_us", pos1),
      (overlay_set_size, "$reason_be_our_client_state", pos1),
      (overlay_set_size, "$cik_su_prnstdan_test", pos1),

      (position_set_x, pos1, 500),
      (position_set_y, pos1, 650),
      (overlay_set_position, "$reason_box", pos1),
      
      (position_set_x, pos1, 250),
      (position_set_y, pos1, 600),
      (overlay_set_position, "$reason_attack_other_country", pos1),

      (position_set_x, pos1, 250),
      (position_set_y, pos1, 550),
      (overlay_set_position, "$reason_defend_other_country", pos1),

      (position_set_x, pos1, 250),
      (position_set_y, pos1, 500),
      (overlay_set_position, "$reason_trade", pos1),

      (position_set_x, pos1, 250),
      (position_set_y, pos1, 450),
      (overlay_set_position, "$reason_political_intrigue", pos1),

      (position_set_x, pos1, 250),
      (position_set_y, pos1, 400),
      (overlay_set_position, "$reason_trust_other_country", pos1),

      (position_set_x, pos1, 250),
      (position_set_y, pos1, 350),
      (overlay_set_position, "$reason_become_ally_with_us", pos1),

      (position_set_x, pos1, 250),
      (position_set_y, pos1, 300),
      (overlay_set_position, "$reason_be_our_client_state", pos1),

      (position_set_x, pos1, 850),
      (position_set_y, pos1, 850),
      (overlay_set_size, "$reason_box", pos1),
      
#      (position_set_x, pos1, 320),
#      (position_set_y, pos1, 560),
#      (overlay_set_position, reg0, pos1),
      
      (position_set_x, pos1, 660),
      (position_set_y, pos1, 330),
      (overlay_set_area_size, "$reason_box", pos1),
      ]),

    (ti_on_presentation_event_state_change,
     [
      (store_trigger_param_1, ":object"),
      (store_trigger_param_2, ":val"),

      (try_begin),
      (eq, ":object", "$cik_su_prnstdan_test"),
      (presentation_set_duration, 0),
      (try_end),
      ]),
    ]),
And when I add n game button, the game is choosing 2-3 overlay at a time. Why this is happening?
 
kalarhan said:
asierus said:
diplomacy recruiter

are you talking about Diplomacy mod features? Which version? And what did you change (show your code). That way someone that plays that mod can help you with your issue.

yea my mod its build on diplomacy source, latest version, i just changed the recruiter dialoge to let you select the player faction from the faction troops list and the recruiter moves to player owned cities an take them. i don't think it has to do with player vassals as they seems to instant get units by templates wich i have and they seem to use just fine for garrisons.

my templates:
Code:
 ("player_supporters_faction_lord_reinf_a", "{!}player_supporters_faction_lord_reinf_a", 0, 0, fac_commoners, 0, [(trp_wops_militia,3,8),(trp_wops_recruit,3,5)]),
  ("player_supporters_faction_lord_reinf_b", "{!}player_supporters_faction_lord_reinf_b", 0, 0, fac_commoners, 0, [(trp_wops_infantry,2,4),(trp_wops_skirmisher,2,5)]),
  ("player_supporters_faction_lord_reinf_c", "{!}player_supporters_faction_lord_reinf_c", 0, 0, fac_commoners, 0, [(trp_wops_man_at_arms,1,2),(trp_wops_sharpshooter,2,3)]),

and

Code:
  ("player_supporters_faction_reinforcements_a", "{!}player_supporters_faction_reinforcements_a", 0, 0, fac_commoners, 0, [(trp_wops_recruit,5,10),(trp_wops_militia,2,4)]),
  ("player_supporters_faction_reinforcements_b", "{!}player_supporters_faction_reinforcements_b", 0, 0, fac_commoners, 0, [(trp_wops_infantry,3,6),(trp_wops_skirmisher,2,4)]),
  ("player_supporters_faction_reinforcements_c", "{!}player_supporters_faction_reinforcements_c", 0, 0, fac_commoners, 0, [(trp_wops_man_at_arms,2,4),(trp_wops_sharpshooter,1,2)]),
 
Having another weird issue.

Code:
#forage for food begin
	#forage_for_food script to search for food on the map
	("forage_for_food",
	[
	  (store_script_param, ":num_men", 1),
	  (assign, ":max_foraging_level", 0),
	  (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
	  (try_for_range, ":curr_stack", 1, ":num_stacks"),
	    (party_stack_get_troop_id,":stack_troop","p_main_party",":curr_stack"),
	    (troop_is_hero, ":stack_troop"),
	    (store_skill_level, ":foraging_skill", skl_agriculture, ":stack_troop"),
	    (gt, ":foraging_skill", ":max_foraging_level"),
	    (assign, ":max_foraging_level", ":foraging_skill"),
		(try_begin),
		  (eq, "trp_player", ":stack_troop"),
		  (str_store_string, s2, "@You"),
		  (str_store_string, s8, "@your"),
		(else_try),
		  (str_store_troop_name, s2),
		  (str_store_string, s8, "@{s2}'s"),
		(try_end),
	  (try_end),
	  (assign, reg7, 0),
	  (party_get_current_terrain, ":cur_terrain", "p_main_party"),
      (try_begin),
        (is_between, ":cur_terrain", rt_bridge, rt_snow_forest),
        (val_add, reg7, 4),
		(str_store_string, s9, "@, gathering fish from rivers, picking berries in the shrubs, and hunting a bit of game in the woods"),
      (else_try),
        (is_between, ":cur_terrain", rt_steppe, rt_plain),
        (val_add, reg7, 2),
		(str_store_string, s9, "@, collecting wild fruits and grains from the open plains, while also hunting and trapping some of the game in the area"),
      (try_end),
	  (assign, ":num_tribute_settlements", 0),
	  (str_store_string, s3, "@"),
	  (str_store_string, s4, "@"),
	  (str_store_string, s5, "@"),
	  (try_for_parties,":nearby_settlement"),
        (this_or_next|party_slot_eq, ":nearby_settlement", slot_party_type, spt_town),
                     (party_slot_eq, ":nearby_settlement", slot_party_type, spt_village),
        (neg|party_slot_eq, ":nearby_settlement", slot_village_state, svs_looted),
        (store_distance_to_party_from_party, ":distance", ":nearby_settlement", "p_main_party"),
		(try_begin),
		  (gt, ":max_foraging_level", ":distance"),
		  (le, ":num_tribute_settlements", 3),
		  (assign, ":tribute_chance", 19),
		  (try_begin),
		    (this_or_next|ge, "$player_honor", 20),
		                 (le, "$player_honor", 20),
			(val_sub, ":tribute_chance", 4),
		  (else_try),
		    (this_or_next|ge, "$player_honor", 40),
		                 (le, "$player_honor", 40),
			(val_sub, ":tribute_chance", 8),
		  (else_try),
		    (this_or_next|ge, "$player_honor", 60),
		                 (le, "$player_honor", 60),
			(val_sub, ":tribute_chance", 12),
		  (try_end),
		  (val_sub, ":tribute_chance", ":max_foraging_level"),
		  (try_for_range, ":curr_try", 0, 3),
		    (store_random_in_range, ":rand", 0, ":tribute_chance"),
			(eq, ":rand", 1),
			(try_begin),
			  (this_or_next|eq, ":curr_try", 0),
			               (eq, ":curr_try", 1),
			  (val_add, reg7, 2),
			(else_try),
			  (this_or_next|eq, ":curr_try", 2),
			               (eq, ":curr_try", 3),
			  (val_add, reg7, 1),
			(try_end),
			(val_add, ":num_tribute_settlements", 1),
			(str_store_party_name, s7, ":nearby_settlement"),
			(try_begin),
			  (eq, ":num_tribute_settlements", 1),
			  (str_store_string, s3, "@The people of {s7}"),
			(else_try),
			  (eq, ":num_tribute_settlements", 2),
			  (str_store_string, s4, "@ and {s7}"),
			(else_try),
			  (eq, ":num_tribute_settlements", 3),
			  (str_store_string, s5, "@, along with the people of {s7}"),
			(try_end),
		  (try_end),
		(try_end),
	  (try_end),
	  (val_mul, reg7, ":num_men"),
	  (val_add, ":max_foraging_level", 5),
	  (val_mul, reg7, ":max_foraging_level"),
	  (val_div, reg7, 5),
	  (val_div, reg7, 15),
	  (try_begin),
	    (eq, ":num_tribute_settlements", 0),
		(str_store_string, s6, "@No nearby villages or towns offer you any food, meaning {s8} foraging party gathered {reg7} units of food in total."),
	  (else_try),
	    (str_store_string, s6, "@{s3}{s4}{s5} offer you some of their food stocks, meaning {s8} foraging party gathered {reg7} units of food in total."),
	  (try_end),
	  (try_begin),
	    (eq, ":max_foraging_level", 0),
		(display_message, "@Despite the lack of a good forager in your party your soldiers wander in their free time and manage to gather {reg7} units of food for themselves."),
	  (else_try),
	    (display_message, "@{s2} and a group of men roam the surrounding area in search of food{s9}. {s6}"),
	  (try_end),
	]),

For some reason, this code is causing no change to food consumed (reg7 is subtracted in the food consumption trigger) and is printing out "You got keys of dungeon." What the hell? I don't even see how this is possible, as the only place in the game that "You got keys of dungeon" is in mission templates jailbreak... how even? What?

My other issue is still unsolved, so if anyone knows anything about adding/removing troops from the wounded stack please enlighten me.
 
Kortlcha said:
Do anybody know why overlay doesn't appears?

you need to play a bit with how widgets work on a presentation. What a container is. How to keep the elements ID and use them on different triggers. How to display/hide a element. Using keyboard shortcuts. Using scrollable elements. Playing with colors. Playing with background images. Mixing textures. Using NPC bodies and/or faces. And so on.

--> most of that is done by experimenting with it, as you won`t find a complete tutorial with easy 1-2-3 steps.

See this code as a example of utility scripts that should help you understand the steps to create each type

Code:
   # This script is taken from Companions Overseer, remove it if you are already using Companions Overseer in your mod.
    ("lco_create_mesh",
        [
            (store_script_param, ":mesh", 1),
            (store_script_param, ":x", 2),
            (store_script_param, ":y", 3),
            (store_script_param, ":x_ratio", 4),
            (store_script_param, ":y_ratio", 5),
            (set_fixed_point_multiplier, 1000),
            (create_mesh_overlay, reg0, ":mesh"),
            (position_set_x, pos60, ":x"),
            (position_set_y, pos60, ":y"),
            (overlay_set_position, reg0, pos60),
            (position_set_x, pos61, ":x_ratio"),
            (position_set_y, pos61, ":y_ratio"),
            (overlay_set_size, reg0, pos61),
        ]
    ),

    # This script is taken from Companions Overseer, remove it if you are already using Companions Overseer in your mod.
    ("lco_create_button",
        [
            (store_script_param, ":caption", 1),
            (store_script_param, ":x", 2),
            (store_script_param, ":y", 3),
            (store_script_param, ":x_size", 4),
            (store_script_param, ":y_size", 5),
            (set_fixed_point_multiplier, 1000),
            (create_game_button_overlay, reg0, ":caption"),
            (position_set_x, pos60, ":x"),
            (position_set_y, pos60, ":y"),
            (overlay_set_position, reg0, pos60),
            (position_set_x, pos61, ":x_size"),
            (position_set_y, pos61, ":y_size"),
            (overlay_set_size, reg0, pos61),
        ]
    ),

    # This script is taken from Companions Overseer, remove it if you are already using Companions Overseer in your mod.
    ("lco_create_label",
        [
            (store_script_param, ":caption", 1),
            (store_script_param, ":x", 2),
            (store_script_param, ":y", 3),
            (store_script_param, ":scale", 4),
            (store_script_param, ":alignment", 5),
            (set_fixed_point_multiplier, 1000),
            (create_text_overlay, reg0, ":caption", ":alignment"),
            (position_set_x, pos60, ":x"),
            (position_set_y, pos60, ":y"),
            (overlay_set_position, reg0, pos60),
            (position_set_x, pos62, ":scale"),
            (position_set_y, pos62, ":scale"),
            (overlay_set_size, reg0, pos62),
        ]
    ),

    # This script is taken from Companions Overseer, remove it if you are already using Companions Overseer in your mod.
    ("lco_create_container",
        [
            (store_script_param, ":x", 1),
            (store_script_param, ":y", 2),
            (store_script_param, ":width", 3),
            (store_script_param, ":height", 4),
            (store_script_param, ":auto_start", 5),
            (set_fixed_point_multiplier, 1000),
            (str_clear, s40),
            (create_text_overlay, reg0, s40, 0x00002000),
            (position_set_x, pos60, ":x"),
            (position_set_y, pos60, ":y"),
            (overlay_set_position, reg0, pos60),
            (position_set_x, pos61, ":width"),
            (position_set_y, pos61, ":height"),
            (overlay_set_area_size, reg0, pos61),
            (try_begin),
                (neq, ":auto_start", 0),
                (set_container_overlay, reg0),
            (try_end),
        ]
    ),

    ("lco_create_troop_portrait",
        [
            (store_script_param, ":troop_id", 1),
            (store_script_param, ":x", 2),
            (store_script_param, ":y", 3),
            (store_script_param, ":x_scale", 4),
            (store_script_param, ":y_scale", 5),
            (create_mesh_overlay_with_tableau_material, reg0, -1, "tableau_troop_note_mesh", ":troop_id"),
            (set_fixed_point_multiplier, 1000),
            (position_set_x, pos60, ":x"),
            (position_set_y, pos60, ":y"),
            (overlay_set_position, reg0, pos60),
            (position_set_x, pos61, ":x_scale"),
            (position_set_y, pos61, ":y_scale"),
            (overlay_set_size, reg0, pos61),
        ]
    ),

    ("lco_create_textbox",
        [
            (store_script_param, ":x", 1),
            (store_script_param, ":y", 2),
            (store_script_param, ":width", 3),
            (store_script_param, ":height", 4),
            (set_fixed_point_multiplier, 1000),
            (create_simple_text_box_overlay, reg0),
            (position_set_x, pos60, ":x"),
            (position_set_y, pos60, ":y"),
            (overlay_set_position, reg0, pos60),
            (position_set_x, pos61, ":width"),
            (position_set_y, pos61, ":height"),
            (overlay_set_size, reg0, pos61),
        ]
    ),

 
My all presentations has at least 1 problem. And often, the problem is  about not displaying overlays. I changed my codes 2 times, but nothing changed. Even there is no problem seen, in the game is presentation has a lot of prolems. I copy pasted a code and it didn't worked. Is there no fix for my problems?
 
Kortlcha said:
Is there no fix for my problems?

1) identify the problem
2) understand the problem
3) fix the problem

I posted a few suggestions this week (like adding logging, using the mouse tracker for coordinates, test one element at time, stuyding how presentations work) and a few fixes for some earlier issues. If you need further help (after you try to fix your issues yourself), remember to post them in full here (as modders are not mind readers neither can see inside your computer)  :grin:
 
Status
Not open for further replies.
Back
Top Bottom