Mercenary and Building improvement problem

正在查看此主题的用户

sepanol

Recruit
I have two problems i couldnt figure out,

I wanna create mercenaries unique for each faction, that can be used,hired by only members of that faction or the main player (me).  In the troops.py, i set each mercenary faction to whoever  (example , Cataphract for Sarranids, fac_kingdom_6)

but i see cataphracts in any town regardless the faction i put. I just want him to appear in Sarranid towns and used by sarranid lords. Is there a way to achieve what i want ?

And second thing is,

I wanna put a new building improvement to Towns, Chapel. And i want my troops to get morale and fully healed whenever my party visit the town (or better if i stay overnight_). I am trying to figure out how, on simple triggers, script and constant. But i didnt get the commands

# Checking center upgrades
  (12,
  [(try_for_range, ":center_no", centers_begin, centers_end),
      (party_get_slot, ":cur_improvement", ":center_no", slot_center_current_improvement),
      (gt, ":cur_improvement", 0),
      (party_get_slot, ":cur_improvement_end_time", ":center_no", slot_center_improvement_end_hour),
      (store_current_hours, ":cur_hours"),
      (ge, ":cur_hours", ":cur_improvement_end_time"),
      (party_set_slot, ":center_no", ":cur_improvement", 1),
      (party_set_slot, ":center_no", slot_center_current_improvement, 0),
      (call_script, "script_get_improvement_details", ":cur_improvement"),
      (try_begin),
        (party_slot_eq, ":center_no", slot_town_lord, "trp_player"),
        (str_store_party_name, s4, ":center_no"),
        (display_log_message, "@Building of {s0} in {s4} has been completed."),
      (try_end),
      (try_begin),
        (is_between, ":center_no", villages_begin, villages_end),
        (eq, ":cur_improvement", slot_center_has_fish_pond),
        (call_script, "script_change_center_prosperity", ":center_no", 5),
      (try_end),
      (try_begin),
        (is_between, ":center_no", villages_begin, villages_end),
        (eq, ":cur_improvement", slot_center_has_chapel),
        (call_script, "script_change_center_prosperity", ":center_no", 5),
      (try_end),

    (try_end),
    ]),

as i understood, to this part in simple triggers, i have to put some command under the part i created , slot_center_has_chapel

it should be somethin related to party morale ,
i think first  should come:
      (call_script, "script_get_player_party_morale_values"),
   
but then , i dont know what im supposed to add.

Anyone could help?
 
for the mercenaries, check module_game_menus and search for "town" and then "visit_tavern"(or something like it) then just add some code to change the merc if it is a faction especific merc in another faction town.
 
# Checking center upgrades
Is a simple trigger to check when building is completed. The bonus listed there is a one-time upon finishing bonus. If you want presistence bonus, you have to script it.

To add new improvements, you will also have to:
- Add them to the improvement info list in module_scripts
- Add the build option in module_game_menus.
- Script its effect.

For faction specific mercenary, check the update mercenary script in module_scripts. You can use condition block to check for town faction then pick from the correct mercenary range. If you plan it right, this is the least amount modification/code you have to do.
 
I was going to post a three-liner for #1, but I'll let you figure it out yourself.
For #2, go into module_simple_triggers and put your code under "@You pay for accommodation.". Use script_change_player_party_morale and the operation heal_party.
 
i wrote this:
(try begin),
        (is_between, ":center_no", towns_begin, towns_end),
        (eq, ":cur_improvement", slot_center_has_chapel),
        (call_script, "script_change_player_party_morale", ":morale_gain"),
        (neg|party_is_in_town, "$g_player_party"),
        (ge, "$current_town", 0),
        (val_mul, ":party_morale_change", 2), #2x bonus (more than normal)
  (try end)

when i click build bat, itgives 3 usage of unassigned global variables;

g_player_party
morale_gain
party_morale_change

I want permanent bonus, each time i visit town, i get healed and improved morale, so should i write it in the place i wrote above? or somewhere else?
i would appreciate if u or someone else give a little more detail how to do it.

And about mercenary,

i will use proper mercenaries, (hired blade, merc cavalry etc.) to be eligible for hire in towns. But i will create 7 more mercenaries for each faction,

i found the place u wrote,

#script_update_mercenary_units_of_towns
  # INPUT: none
  # OUTPUT: none
  ("update_mercenary_units_of_towns",
    [(try_for_range, ":town_no", towns_begin, towns_end),
      (store_random_in_range, ":troop_no", mercenary_troops_begin, mercenary_troops_end),
      (party_set_slot, ":town_no", slot_center_mercenary_troop_type, ":troop_no"),
      (store_random_in_range, ":amount", 3, :cool:,
      (party_set_slot, ":town_no", slot_center_mercenary_troop_amount, ":amount"),
    (try_end),
    ]),

but i didnt really get the part about condition block.
actually, i wanted to ask also, is it possible, if i get my classical warband mercenaries(hired blade, merc cavalry...) from town and the mercs i created, from each training field, (like in fire and sword)

thanks for ur time anyway
 
Somebody 说:
I was going to post a three-liner for #1, but I'll let you figure it out yourself.
For #2, go into module_simple_triggers and put your code under "@You pay for accommodation.". Use script_change_player_party_morale and the operation heal_party.


i would appreciate if u post the three liner unless it will take too much time for u, i didnt get the mercenary thing well
 
插入代码块:
             (try_begin),
               (gt, ":mercenary_troop", 0),
               (gt, ":mercenary_amount", 0),
               (store_faction_of_troop, ":faction", ":mercenary_troop"), #fetch faction
               (this_or_next|eq, ":faction", "fac_commoners"), #regular mercs
               (eq, ":faction", "$g_encountered_party_faction"), #faction mercs
               (set_visitor, ":cur_entry", ":mercenary_troop"),
               (val_add, ":cur_entry", 1),
             (try_end),
This prevents them from showing up in taverns of a different faction.
As for your other question, make a new loop over the training groups and use party_add_members instead of setting them in slots, and add the following
插入代码块:
   [anyone|plyr,"trainer_talk", [],
    "I want to hire some mercs", "trainer_pretalk",[
     (set_mercenary_source_party, "$g_encountered_party"),
     (change_screen_buy_mercenaries),
    ]],
 
thanks a lot
i will try it now,

but with the other question, i just added this

      (try_begin),
        (is_between, ":center_no", towns_begin, towns_end),
        (eq, ":cur_improvement", slot_center_has_chapel),
        ("@You pay for accommodation"),
        (heal_party, "main_party"),       
        (call_script, "script_change_player_party_morale", ":center_no", 5),
      (try_end),
    (try_end),
    ]),


and i think i messed up something. i think i should add something before, you pay for accomodation,
and im not sure if only call script, change player party morale enough? should i add, player gain morale or such commands under?

what do u think?
 
(eq, ":cur_improvement", slot_center_has_chapel),
this is what you messed up


hey, should this work?
插入代码块:
  ("build_inventory",0,
   "Building a {s0} will take {reg1} {reg1?hour:hours}.",
   "none",
   [(try_begin),
      (eq, "$build", 1),
	  (assign, reg1, 7),
	  (str_store_string, s0, "@Dual Ox Wagon"),
	(else_try),
      (eq, "$build", 2),
	  (assign, reg1, 1),
	  (str_store_string, s0, "@Single horse Wagon"),
	(else_try),
      (eq, "$build", 3),
	  (assign, reg1, 3),
	  (str_store_string, s0, "@Double horse Wagon"),
	(else_try),
      (eq, "$build", 4),
	  (assign, reg1, 5),
	  (str_store_string, s0, "@Four Horses Wagon"),
	(else_try),
      (ge, "$build", 5),
	  (assign, reg1, 1),
	  (str_store_string, s0, "@Double wheled Cart"),
	(try_end),
	(assign, reg3, "pt_dual_ox_wagon"),
	(val_add, reg3, "$build"),
	(val_sub, reg3, 1),
	(val_clamp, reg3, "pt_dual_ox_wagon", "pt_double_wheled_cart"),
	(set_spawn_radius,1),
	(spawn_around_party,"p_main_party",reg3),
	(assign, reg4, "trp_dual_ox_wagon"),
	(val_add, reg4, "$build"),
	(val_sub, reg4, 1),
	(troop_clear_inventory,reg4),
	(set_conversation_speaker_troop, reg4),
	(set_encountered_party,reg0),
	(try_begin),
	  (troop_slot_ge, reg4, slot_inventory_used, 1),
	  (assign, reg2, 1),
	  (str_store_string, s13, "@You already have a {s0}"),
	(try_end),],
    [
      ("build",[(neq, reg2, 1),],"Give the necessary items.",
       [(troop_set_slot, reg4, slot_inventory_used, 1),
		(call_script, "script_copy_inventory", "$g_player_troop", "trp_temp_array_a"),
		(call_script, "script_copy_inventory", reg4, "trp_temp_array_b"),
		(troop_get_inventory_capacity,":capacity",reg4),
		(try_for_range, ":i_slot", 0, ":capacity"),
			(troop_get_inventory_slot, ":item", "trp_temp_array_b", ":i_slot"),
			(gt, ":item", -1),
			(troop_get_inventory_slot_modifier, ":imod", "trp_temp_array_b", ":i_slot"),
			(troop_add_item,"trp_temp_array_b", ":item", ":imod"),
			(troop_set_inventory_slot, "trp_temp_array_b", ":i_slot", -1),
		(try_end),
		(change_screen_loot, "trp_temp_array_b"),]),
      ("build",[(neq, reg2, 1),
	            (ge, "$build", 5),],"Give the prisioners.",
		   [#(party_get_num_prisoners,":slaves","p_main_party"),
			#(try_begin),
			#  (eq, "$build", 5),
			#  (assign, reg6, 1),
			#(else_try),
			#  (eq, "$build", 6),
			#  (assign, reg6, 2),
			#(else_try),
			#  (eq, "$build", 7),
			#  (assign, reg6, 4),
			#(try_end),
			#(try_begin),
			#  (ge, ":slaves", reg6),
			#  (try_for_range, ":prisioner", 1, "trp_troop_end"),
			#	(party_count_prisoners_of_type,":count","p_main_party",":prisioner"),
			#	(val_min, ":count", reg6),
			#	(party_remove_prisoners,"p_main_party",":prisioner",":count"),
			#	(party_force_add_prisoners,reg0,":prisioner",":count"),
			#	(val_sub, reg6, ":count"),
			#  (try_end),
			#(else_try),
			#  (disable_menu_option),
			#  (display_message,"@You don't have enought prisioners"),
			#(try_end),
			(change_screen_trade_prisoners),
	   ]),
      ("build",[(neq, reg2, 1),
				(assign, ":horses", 0),
				(assign, ":bulls", 0),
				(assign, ":l_wagons", 0),
				(assign, ":m_wagons", 0),
				(assign, ":h_wagons", 0),
				(assign, ":carts", 0),
				(store_num_regular_prisoners,":slaves",reg0),
				(troop_get_inventory_capacity,":capacity",reg4),
				(try_for_range,":slot",0,":capacity"),
				  (troop_get_inventory_slot,":cur_item",reg4,":slot"),
				  (try_begin),
				    (is_between, ":cur_item", "itm_sumpter_horse", "itm_charger"),
				    (val_add,":horses",1),
				  (else_try),
				    (this_or_next|eq, ":cur_item", "itm_bull"),
				    (eq, ":cur_item", "itm_ox"),
				    (val_add,":bulls",1),
				  (else_try),
				    (eq, ":cur_item", "itm_light_wagon"),
				    (val_add,":l_wagons",1),
				  (else_try),
				    (eq, ":cur_item", "itm_wagon"),
				    (val_add,":m_wagons",1),
				  (else_try),
				    (eq, ":cur_item", "itm_heavy_wagon"),
				    (val_add,":h_wagons",1),
				  (else_try),
				    (eq, ":cur_item", "itm_2wheeled_cart"),
					(val_add,":carts", 1),
				  (try_end),
				(try_end),
				(try_begin),
				  (eq, "$build", 1),
				  (ge, ":bulls", 2),
				  (ge, ":h_wagons", 1),
				(else_try),
				  (eq, "$build", 2),
				  (ge, ":horses", 2),
				  (ge, ":l_wagons", 1),
				(else_try),
				  (eq, "$build", 3),
				  (ge, ":horses", 2),
				  (ge, ":m_wagons", 1),
				(else_try),
				  (eq, "$build", 4),
				  (ge, ":horses", 2),
				  (ge, ":h_wagons", 1),
				(else_try),
				  (eq, "$build", 5),
				  (ge, ":slaves", 1),
				  (ge, ":carts", 1),
				(else_try),
				  (eq, "$build", 6),
				  (ge, ":slaves", 2),
				  (troop_raise_skill,reg4,"skl_inventory_management",1),
				  (ge, ":carts", 1),
				(else_try),
				  (eq, "$build", 7),
				  (ge, ":slaves", 4),
				  (ge, ":carts", 1),
				  (troop_raise_skill,reg4,"skl_inventory_management",2),
				(else_try),
				  (disable_menu_option),
				(try_end),
                  ],"Start building.",
       [(rest_for_hours_interactive, reg1, 5, 1), #rest while attackable
        (assign,"$next_menu","mnu_builded_inventory"),
        (assign, "$rest_time", reg1),
        (change_screen_return),
        ]),
      ("back",[],"Back.",
       [(troop_get_inventory_capacity,":capacity",reg4),
		(assign, ":continue", 1),
		(try_for_range,":slot",0,":capacity"),
		  (troop_get_inventory_slot,":cur_item",reg4,":slot"),
		  (gt, ":cur_item", 0),
		  (assign, ":continue", 0),
		(try_end),
		(try_begin),
		  (eq, ":continue", 1),
		  (try_for_range, ":prisioner", 1, "trp_troop_end"),
				(party_count_prisoners_of_type,":count","p_main_party",":prisioner"),
				(party_remove_prisoners,reg0,":prisioner",":count"),
				(party_force_add_prisoners,"p_main_party",":prisioner",":count"),
		  (try_end),
		  (remove_party,reg0),
		  (assign, "$brc_camp_inv", 1),
		  (troop_set_slot, reg4, slot_inventory_used, 0),
		  (jump_to_menu, "mnu_camp_inventory"),
		(else_try),
		  (display_message,"@Please, retrieve your items before leaving"),
		(try_end),]),
      ]),
  
  ("builded_inventory",0,
   "You have builded a {s0} in {reg1} {reg1?hour:hours}.",
   "none",
   [],
    [
      ("back",[],"Back.",
       [(assign, "$brc_camp_inv", 1),
	    (jump_to_menu, "mnu_camp_inventory"),]),
      ]),

I'm talking about the

(set_conversation_speaker_troop, reg4),
(set_encountered_party,reg0),
and the
(change_screen_trade_prisoners),
 
Ikaguia 说:
(eq, ":cur_improvement", slot_center_has_chapel),
this is what you messed up


hey, should this work?
插入代码块:
  ("build_inventory",0,
   "Building a {s0} will take {reg1} {reg1?hour:hours}.",
   "none",
   [(try_begin),
      (eq, "$build", 1),
	  (assign, reg1, 7),
	  (str_store_string, s0, "@Dual Ox Wagon"),
	(else_try),
      (eq, "$build", 2),
	  (assign, reg1, 1),
	  (str_store_string, s0, "@Single horse Wagon"),
	(else_try),
      (eq, "$build", 3),
	  (assign, reg1, 3),
	  (str_store_string, s0, "@Double horse Wagon"),
	(else_try),
      (eq, "$build", 4),
	  (assign, reg1, 5),
	  (str_store_string, s0, "@Four Horses Wagon"),
	(else_try),
      (ge, "$build", 5),
	  (assign, reg1, 1),
	  (str_store_string, s0, "@Double wheled Cart"),
	(try_end),
	(assign, reg3, "pt_dual_ox_wagon"),
	(val_add, reg3, "$build"),
	(val_sub, reg3, 1),
	(val_clamp, reg3, "pt_dual_ox_wagon", "pt_double_wheled_cart"),
	(set_spawn_radius,1),
	(spawn_around_party,"p_main_party",reg3),
	(assign, reg4, "trp_dual_ox_wagon"),
	(val_add, reg4, "$build"),
	(val_sub, reg4, 1),
	(troop_clear_inventory,reg4),
	(set_conversation_speaker_troop, reg4),
	(set_encountered_party,reg0),
	(try_begin),
	  (troop_slot_ge, reg4, slot_inventory_used, 1),
	  (assign, reg2, 1),
	  (str_store_string, s13, "@You already have a {s0}"),
	(try_end),],
    [
      ("build",[(neq, reg2, 1),],"Give the necessary items.",
       [(troop_set_slot, reg4, slot_inventory_used, 1),
		(call_script, "script_copy_inventory", "$g_player_troop", "trp_temp_array_a"),
		(call_script, "script_copy_inventory", reg4, "trp_temp_array_b"),
		(troop_get_inventory_capacity,":capacity",reg4),
		(try_for_range, ":i_slot", 0, ":capacity"),
			(troop_get_inventory_slot, ":item", "trp_temp_array_b", ":i_slot"),
			(gt, ":item", -1),
			(troop_get_inventory_slot_modifier, ":imod", "trp_temp_array_b", ":i_slot"),
			(troop_add_item,"trp_temp_array_b", ":item", ":imod"),
			(troop_set_inventory_slot, "trp_temp_array_b", ":i_slot", -1),
		(try_end),
		(change_screen_loot, "trp_temp_array_b"),]),
      ("build",[(neq, reg2, 1),
	            (ge, "$build", 5),],"Give the prisioners.",
		   [#(party_get_num_prisoners,":slaves","p_main_party"),
			#(try_begin),
			#  (eq, "$build", 5),
			#  (assign, reg6, 1),
			#(else_try),
			#  (eq, "$build", 6),
			#  (assign, reg6, 2),
			#(else_try),
			#  (eq, "$build", 7),
			#  (assign, reg6, 4),
			#(try_end),
			#(try_begin),
			#  (ge, ":slaves", reg6),
			#  (try_for_range, ":prisioner", 1, "trp_troop_end"),
			#	(party_count_prisoners_of_type,":count","p_main_party",":prisioner"),
			#	(val_min, ":count", reg6),
			#	(party_remove_prisoners,"p_main_party",":prisioner",":count"),
			#	(party_force_add_prisoners,reg0,":prisioner",":count"),
			#	(val_sub, reg6, ":count"),
			#  (try_end),
			#(else_try),
			#  (disable_menu_option),
			#  (display_message,"@You don't have enought prisioners"),
			#(try_end),
			(change_screen_trade_prisoners),
	   ]),
      ("build",[(neq, reg2, 1),
				(assign, ":horses", 0),
				(assign, ":bulls", 0),
				(assign, ":l_wagons", 0),
				(assign, ":m_wagons", 0),
				(assign, ":h_wagons", 0),
				(assign, ":carts", 0),
				(store_num_regular_prisoners,":slaves",reg0),
				(troop_get_inventory_capacity,":capacity",reg4),
				(try_for_range,":slot",0,":capacity"),
				  (troop_get_inventory_slot,":cur_item",reg4,":slot"),
				  (try_begin),
				    (is_between, ":cur_item", "itm_sumpter_horse", "itm_charger"),
				    (val_add,":horses",1),
				  (else_try),
				    (this_or_next|eq, ":cur_item", "itm_bull"),
				    (eq, ":cur_item", "itm_ox"),
				    (val_add,":bulls",1),
				  (else_try),
				    (eq, ":cur_item", "itm_light_wagon"),
				    (val_add,":l_wagons",1),
				  (else_try),
				    (eq, ":cur_item", "itm_wagon"),
				    (val_add,":m_wagons",1),
				  (else_try),
				    (eq, ":cur_item", "itm_heavy_wagon"),
				    (val_add,":h_wagons",1),
				  (else_try),
				    (eq, ":cur_item", "itm_2wheeled_cart"),
					(val_add,":carts", 1),
				  (try_end),
				(try_end),
				(try_begin),
				  (eq, "$build", 1),
				  (ge, ":bulls", 2),
				  (ge, ":h_wagons", 1),
				(else_try),
				  (eq, "$build", 2),
				  (ge, ":horses", 2),
				  (ge, ":l_wagons", 1),
				(else_try),
				  (eq, "$build", 3),
				  (ge, ":horses", 2),
				  (ge, ":m_wagons", 1),
				(else_try),
				  (eq, "$build", 4),
				  (ge, ":horses", 2),
				  (ge, ":h_wagons", 1),
				(else_try),
				  (eq, "$build", 5),
				  (ge, ":slaves", 1),
				  (ge, ":carts", 1),
				(else_try),
				  (eq, "$build", 6),
				  (ge, ":slaves", 2),
				  (troop_raise_skill,reg4,"skl_inventory_management",1),
				  (ge, ":carts", 1),
				(else_try),
				  (eq, "$build", 7),
				  (ge, ":slaves", 4),
				  (ge, ":carts", 1),
				  (troop_raise_skill,reg4,"skl_inventory_management",2),
				(else_try),
				  (disable_menu_option),
				(try_end),
                  ],"Start building.",
       [(rest_for_hours_interactive, reg1, 5, 1), #rest while attackable
        (assign,"$next_menu","mnu_builded_inventory"),
        (assign, "$rest_time", reg1),
        (change_screen_return),
        ]),
      ("back",[],"Back.",
       [(troop_get_inventory_capacity,":capacity",reg4),
		(assign, ":continue", 1),
		(try_for_range,":slot",0,":capacity"),
		  (troop_get_inventory_slot,":cur_item",reg4,":slot"),
		  (gt, ":cur_item", 0),
		  (assign, ":continue", 0),
		(try_end),
		(try_begin),
		  (eq, ":continue", 1),
		  (try_for_range, ":prisioner", 1, "trp_troop_end"),
				(party_count_prisoners_of_type,":count","p_main_party",":prisioner"),
				(party_remove_prisoners,reg0,":prisioner",":count"),
				(party_force_add_prisoners,"p_main_party",":prisioner",":count"),
		  (try_end),
		  (remove_party,reg0),
		  (assign, "$brc_camp_inv", 1),
		  (troop_set_slot, reg4, slot_inventory_used, 0),
		  (jump_to_menu, "mnu_camp_inventory"),
		(else_try),
		  (display_message,"@Please, retrieve your items before leaving"),
		(try_end),]),
      ]),
  
  ("builded_inventory",0,
   "You have builded a {s0} in {reg1} {reg1?hour:hours}.",
   "none",
   [],
    [
      ("back",[],"Back.",
       [(assign, "$brc_camp_inv", 1),
	    (jump_to_menu, "mnu_camp_inventory"),]),
      ]),

I'm talking about the

(set_conversation_speaker_troop, reg4),
(set_encountered_party,reg0),
and the
(change_screen_trade_prisoners),


im not sure if i have seen those scripts before, is it warband or fire n sword?

 
warband and the scripts are from my mod


set_conversation_speaker_troop  = 2197  # (set_conversation_speaker_troop, <troop_id>),
set_encountered_party          = 2205 # (set_encountered_party,<destination>),
these are from WB header_operations
 
sepanol 说:
and i think i messed up something. i think i should add something before, you pay for accomodation,
and im not sure if only call script, change player party morale enough? should i add, player gain morale or such commands under?

what do u think?
When you reference a party directly, you must append the p_ prefix. There is already a simple trigger which fires every time you rest at a center, so search for it and place your code in a conditional block beneath that. Use $g_last_rest_center instead of :center_no, and if you look in module_scripts you'll see that script_change_player_party_morale only takes in one parameter, the morale to change.

Ikaguia 说:
I'm talking about the

(set_conversation_speaker_troop, reg4),
(set_encountered_party,reg0),
and the
(change_screen_trade_prisoners),
(change_screen_trade_prisoners) is only used from module_dialogs in Native. Use start_encounter with a party to trigger script_game_event_party_encounter. Try not to hijack threads next time.
 
Ikaguia 说:
warband and the scripts are from my mod


set_conversation_speaker_troop  = 2197  # (set_conversation_speaker_troop, <troop_id>),
set_encountered_party          = 2205 # (set_encountered_party,<destination>),
these are from WB header_operations

im not sure if it will work, im not good at modding yet, i tried to figure out everythng by myself but its complicated, now thanks god i got some help from here
whats ur  mod about?

im working on warband expansion, new faction and some more features  , also hoping to add new mercenaries, im not sure if i can work it out though
 
Somebody 说:
sepanol 说:
and i think i messed up something. i think i should add something before, you pay for accomodation,
and im not sure if only call script, change player party morale enough? should i add, player gain morale or such commands under?

what do u think?
When you reference a party directly, you must append the p_ prefix. There is already a simple trigger which fires every time you rest at a center, so search for it and place your code in a conditional block beneath that. Use $g_last_rest_center instead of :center_no, and if you look in module_scripts you'll see that script_change_player_party_morale only takes in one parameter, the morale to change.

Ikaguia 说:
I'm talking about the

(set_conversation_speaker_troop, reg4),
(set_encountered_party,reg0),
and the
(change_screen_trade_prisoners),
(change_screen_trade_prisoners) is only used from module_dialogs in Native. Use start_encounter with a party to trigger script_game_event_party_encounter. Try not to hijack threads next time.


Sorry for taking ur time, but i wannted to inform what happened,

i wrote something like this to simple triggers

(try_begin),
        (is_between, ":center_no", towns_begin, towns_end),
        (eq, ":cur_improvement", slot_center_has_chapel),
        (ge, "$g_last_rest_center", 0),
        (is_between, "$g_last_rest_center", towns_begin, towns_end),
        (neg|party_slot_eq, "$g_last_rest_center", slot_town_lord, "trp_player"),
        (heal_party, "p_main_party"),       
        (call_script, "script_change_player_party_morale", "$g_last_rest_center"),
      (try_end),

and healng worked fine, but the morale doesnt really change, why do  u think it didnt work?
 
Where did you place the trigger? :center_no is a local variable, and could be any value if you haven't initialized it. As I told you, look in module_scripts to see what is actually expected as the parameter.
 
i placed it under, checking center upgrades, under this loop

(try_begin),
        (is_between, ":center_no", villages_begin, villages_end),
        (eq, ":cur_improvement", slot_center_has_fish_pond),
        (call_script, "script_change_center_prosperity", ":center_no", 5),
      (try_end),
 
how can i initialize center no? but if its about the center no, why did healing work then? are u sure about call script player change morale part? mabe it should be add morale, or morale gain?
i dont know, u know it better
 
now i changed it to this:

only modifiying the "$g_last_rest_center" part to ":morale_gain"

(try_begin),
        (is_between, ":center_no", towns_begin, towns_end),
        (eq, ":cur_improvement", slot_center_has_chapel),
        (ge, "$g_last_rest_center", 0),
        (is_between, "$g_last_rest_center", towns_begin, towns_end),
        (neg|party_slot_eq, "$g_last_rest_center", slot_town_lord, "trp_player"),
        (heal_party, "p_main_party"),       
        (call_script, "script_change_player_party_morale", ":morale_gain"),
      (try_end),
    (try_end),

now module bat gave, unusued variable error, so i m trying to find out how to define, morale gain
 
damn it, i still couldnt find anythng, its so frustrating

there is a part in script, here it is

   
    #Add morale
    (assign, ":morale_gain", ":total_gain"),
    (val_div, ":morale_gain", ":num_player_party_shares"),#if there are lots of soldiers in my party there will be less morale increase.
   
    (try_begin),
      (eq, "$cheat_mode", 1),
      (assign, reg0, ":num_player_party_shares"),
      (assign, reg1, ":total_gain"),
      (display_message, "@{!}DEBUGS3 : num_player_party_shares:{reg0}, total_gain:{reg1}"),
    (try_end), 
   
    (call_script, "script_change_player_party_morale", ":morale_gain"),
   
    (store_mul, ":killed_enemies_by_our_soldiers", ":died_enemy_population", "$g_strength_contribution_of_player"),
    (store_div, ":faction_morale_change", ":killed_enemies_by_our_soldiers", :cool:, #each 8 killed agent with any faction decreases morale of troops belong to that faction in our party by 1.
    (try_begin),
      (gt, ":faction_morale_change", 2000),
      (assign, ":faction_morale_change", 2000),
    (try_end),   
   
    (try_begin), #here we give positive morale to our troops of with same faction of ally party with 2/3x multipication.
      (ge, "$g_ally_party", 0),

      (store_div, ":ally_faction_morale_change", ":faction_morale_change", 3), #2/3x multipication (less than normal)
      (val_mul, ":ally_faction_morale_change", 2),
      (store_faction_of_party, ":ally_faction", "$g_ally_party"),
      (faction_get_slot, ":faction_morale", ":ally_faction",  slot_faction_morale_of_player_troops),
      (val_add, ":faction_morale", ":ally_faction_morale_change"),
      (faction_set_slot, ":ally_faction",  slot_faction_morale_of_player_troops, ":faction_morale"),
    (try_end),
   
    (try_begin), #here we give positive morale to our troops of owner of rescued village's faction after saving village from bandits by x3 bonus.
      (neg|party_is_active, "$g_enemy_party"),
      (ge, "$current_town", 0),
     
      (val_mul, ":faction_morale_change", 2), #2x bonus (more than normal)
      (store_faction_of_party, ":ally_faction", "$current_town"),
      (faction_get_slot, ":faction_morale", ":ally_faction",  slot_faction_morale_of_player_troops),
      (val_add, ":faction_morale", ":faction_morale_change"),
      (faction_set_slot, ":ally_faction",  slot_faction_morale_of_player_troops, ":faction_morale"),
    (else_try),
      (party_is_active, "$g_enemy_party"),
      (assign, ":currently_in_rebellion", 0),   
      (try_begin),
        (eq, "$players_kingdom", "fac_player_supporters_faction"),
        (neg|faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
        (assign, ":currently_in_rebellion", 1),
      (try_end),   
      (eq, ":currently_in_rebellion", 0),

      (store_div, ":faction_morale_change", ":faction_morale_change", 3), #2/3x multipication (less than normal)
      (val_mul, ":faction_morale_change", 2),
      (store_faction_of_party, ":enemy_faction", "$g_enemy_party"),
      (faction_get_slot, ":faction_morale", ":enemy_faction",  slot_faction_morale_of_player_troops),
      (val_sub, ":faction_morale", ":faction_morale_change"),
      (faction_set_slot, ":enemy_faction",  slot_faction_morale_of_player_troops, ":faction_morale"),
    (try_end),
       
  ]),


i think i should write something similar to one of those,

its ok if i just add morale by a certain number, lets say , 10

but how to do it ?
 
Just use a number in place of a variable. Unless the variable begins with $ instead of :, it won't be shared across scripts.
Here's how I would do it
插入代码块:
    (try_begin),
      (ge, ":gold", ":total_cost"),
      (display_message, "@You pay for accommodation."),
      (troop_remove_gold, "trp_player", ":total_cost"),
      (try_begin),
        (party_slot_eq, "$g_last_rest_center", slot_center_has_chapel, 1),
        (heal_party, "p_main_party"),
        (call_script, "script_change_player_party_morale", 1),
      (try_end),
...
 
后退
顶部 底部