• Welcome to the forums on our new hosting setup. Everything should be working the same, but if you run into any problems, please let us know over here.

OSP Code SP [WB] Entertainement skill

Users who are viewing this thread

Ikaguia

Grandmaster Knight
WBWF&SNW
in module_skills, replace one of the reserved skills with this:

Code:
  ("entertain","Entertain",sf_base_att_cha|sf_effects_party,15,"Every hour you are resting, each hero with this skill increases the morale of the party. It also helps you while begging, performing or playing a music. (Personal skill)."),

in module_simple_triggers:
Code:
	(3,	[(ge, "$entertainement_on", 1),
		 (assign, ":hero_count", 0),
		 (assign, ":entertain_bonus", 0),
		 #companions
		 (try_for_range, ":hero", companions_begin, companions_end),
		   (main_party_has_troop,":hero"),
		   (val_add, ":hero_count", 1),
		   (store_skill_level,":skill","skl_entertain",":hero"),
		   (val_add, ":entertain_bonus", ":skill"),
		 (try_end),
		 #player troop
		 (val_add, ":hero_count", 1),
		 (store_skill_level,":skill","skl_entertain",0),
		 (val_add, ":entertain_bonus", ":skill"),
		 #now get the bonus
		 (val_add, ":hero_count", 5),
		 (val_div, ":entertain_bonus", ":hero_count"),
		 (val_mul, ":entertain_bonus", "$entertainement_on"),#normal kind is 1 but if it is an aewsome entertainement it will get a bonus (like playing lordly/royal musics)
		 (party_get_morale, ":morale", "p_main_party"),
		 (val_add, ":morale", ":entertain_bonus"),
		 #and apply it
		 (party_set_morale, "p_main_party", ":morale"),
		 ]),
	(24,[(store_div, ":reputation", "$bardic_reputation", 1000),
		 (val_min, ":reputation", 1),
		 (val_add, ":reputation", 1),
		 (troop_get_slot, ":old_reputation", 0, slot_troop_renown),
		 (store_mul, ":new_reputation", ":old_reputation", ":reputation"),
		 (troop_set_slot, 0, slot_troop_renown, ":new_reputation"),
		 (store_sub, ":reputation_change", ":new_reputation", ":old_reputation"),
         (try_begin),
            (gt, ":reputation_change", 0),
            (display_message, "@You gained {reg12} renown for your bardic reputation.", 0x33ff33),
         (else_try),
            (lt, ":reputation_change", 0),
            (display_message, "@You lose {reg12} renown for your bardic reputation.", 0xff3333),
         (try_end),
		 ]),
	(1,	[(ge, "$entertainement_on", 1),
		 (assign, ":income_rate", "$entertain_income_rate"),
		 (assign, ":income_type", "$entertain_income_type"),
		 (assign, ":income_type2", "$entertain_income_type2"),
		 (store_skill_level,":skill_lvl","skl_entertain",0),
		 (store_mul, ":max", ":income_rate", 1),
		 (store_mul, ":min", ":income_rate", -1),
		 (val_add, ":max", ":skill_lvl"),
		 (val_mul, ":max", "$entertainement_on"),
		 (val_div, ":min", 2),
		 (val_div, ":min", "$entertainement_on"),
		 (store_random_in_range, ":income", ":min", ":max"),
		 (store_div, ":reputation", "$bardic_reputation", 400),
		 (val_min, ":reputation", 1),
		 (val_add, ":reputation", 1),
		 (val_mul, ":income", ":reputation"),
		 (val_sub, ":income", ":reputation"),
		 (call_script, "script_entertain_income", ":income", ":income_type"),
		 (call_script, "script_entertain_income", ":income", ":income_type2"),
		 ]),

in module_scripts:
search for:
Code:
    ("game_get_skill_modifier_for_troop",
      [(store_script_param, ":troop_no", 1),
        (store_script_param, ":skill_no", 2),
        (assign, ":modifier_value", 0),
        (try_begin),
          (eq, ":skill_no", "skl_wound_treatment"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_wound_treatment_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_trainer"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_training_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_surgery"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_surgery_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
          ## CC
        (else_try),
          (eq, ":skill_no", "skl_pathfinding"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_pathfinding_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_spotting"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_spotting_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
obs: may be a little different than mine because I'm using Floris Expanded Mod Pack

add this:
Code:
        (else_try),
          (eq, ":skill_no", "skl_entertain"),
		  (try_for_range, ":instrument", instruments_begin, instruments_end),
            (call_script, "script_get_troop_item_amount", ":troop_no", ":instrument"),
            (gt, reg0, 0),
            (val_add, ":modifier_value", 1),
		  (try_end),

add this new script:
Code:
# script_entertain_income
# input_1 = income
# input_2 = income_type
# used on playing a music or making a speech
  ("entertain_income",
   [(store_script_param, ":income", 1),
	(store_script_param, ":income_type", 2),
	(try_begin),
	######### HONOR #########
	  (eq, ":income_type", income_honor),
	  (val_div, ":income", 30),
	  (val_add, "$player_honor", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$player_honor"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@Your honor has been increased in {reg12} and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@Your honor has been decreased in {reg12} and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### REPUTATION #########
	  (eq, ":income_type", income_reputation),
	  (val_div, ":income", 30),
	  (troop_get_slot, ":old_reputation", 0, slot_troop_renown),
	  (store_add, ":new_reputation", ":old_reputation", ":income"),
	  (troop_set_slot, 0, slot_troop_renown, ":new_reputation"),
	  (assign, reg12, ":income"),
	  (assign, reg13, ":new_reputation"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} renown and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} renown and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### RIGHT TO RULE #########
	  (eq, ":income_type", income_right_to_rule),
	  (val_div, ":income", 30),
	  (val_add, "$player_right_to_rule", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$player_right_to_rule"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} right to rule and you have {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} right to rule and you have {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### BARDIC REPUTATION #########
	  (eq, ":income_type", income_bard_reputation),
	  (val_div, ":income", 2),
	  (val_add, "$bardic_reputation", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$bardic_reputation"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} bardic reputation and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} bardic reputation and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### DENARS #########
	  (troop_add_gold,0,":income"),
	  (store_troop_gold, reg13, 0),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You got {reg12} denars and you have {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} denars and you have {reg13} now.", 0xff3333),
	  (try_end),
	(try_end),
   ]),

in module_game_menus:
search for the "camp" menu and add at the operations block:
Code:
	  (assign, "$entertainement_on", 0),
then in the "camp_wait_here" option, add at the consequences block:
Code:
	  (assign, "$entertainement_on", 1),
search for the "town" menu and add at the operations block:
Code:
	  (assign, "$entertainement_on", 0),
then in the "castle_wait" option, add at the consequences block:
Code:
	  (assign, "$entertainement_on", 1),
add a new option at the "town" menu:
Code:
      ("entertaiment",
       [(party_slot_eq,"$current_town",slot_party_type, spt_town),
        (this_or_next|eq,"$entry_to_town_forbidden",0),
        (eq, "$sneaked_into_town",1),],
       "Attempt to Play/Perform a music.",
       [(jump_to_menu, "mnu_choose_music"),]),

and then add this new menu:
Code:
	("choose_music",0,"What do you wanna do?",
	"none",
		[	
			(assign, "$entertainement_on", 0),
		],
		[
      ("simple",[(str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 7),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} simple music.(1 hour)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 7),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 1, 1, 0), #rest 1 hour while not-attackable                      
           (change_screen_map),]
       ),
      ("medium",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 2),
			   (ge, "$bardic_reputation", 130),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 15),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} medium music.(3 hours)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 15),
           (assign, "$entertain_income_type", income_denars),
           (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 3, 1, 0), #rest 3 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("complex",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 5),
			   (ge, "$bardic_reputation", 470),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 50),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} complex music.(5 hours)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 50),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 5, 3, 0), #rest 5 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("lordly",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 9),
			   (ge, "$bardic_reputation", 1150),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 90),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} Lordly music.(15 hours)",
		  [(assign, "$entertainement_on", 2),
		   (assign, "$entertain_income_rate", 90),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 15, 5, 0), #rest 15 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("royal",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 14),
			   (ge, "$bardic_reputation", 3550),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 170),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} Royal music.(35 hours)",
		  [(assign, "$entertainement_on", 3),
		   (assign, "$entertain_income_rate", 170),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 35, 6, 0), #rest 35 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("speech",[(str_store_string, s1, "@a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 9),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@another"),
			   (try_end),],"I want to make {s1} Speech.(3 hours)",
		  [(assign, "$entertainement_on", 0),
		   (assign, "$entertain_income_rate", 9),
		   (assign, "$entertain_income_type", income_reputation),
		   (assign, "$entertain_income_type2", income_right_to_rule),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 3, 1, 0), #rest 5 hours while not-attackable                      
           (change_screen_map),]
       ),

at module_constants:
Code:
instruments_begin		= "itm_lyre"
instruments_end			= "itm_instruments_end"
income_denars		= 1
income_honor			= 2
income_reputation		= 3
income_right_to_rule	= 4
income_bard_reputation	= 5
slot_agent_already_begg  = 46
obs: change the 46 to the first avaiable agent slot

at module_items:
Code:
 ["lyre", "Lyre", [("lyre",0)], itp_merchandise|itp_type_shield|itp_wooden_parry|itp_civilian, itcf_carry_bow_back,  118 , weight(2.5)|hit_points(480)|body_armor(1)|spd_rtng(82)|weapon_length(90),0 ],
 ["lute", "Lute", [("lute",0)], itp_merchandise|itp_type_shield|itp_wooden_parry|itp_civilian, itcf_carry_bow_back,  118 , weight(2.5)|hit_points(480)|body_armor(1)|spd_rtng(82)|weapon_length(90),0 ],
 ["instruments_end", "Instruments End", [("shield_round_a",0)], 0, 0, 1, 0, 0],
obs: if you don't have this model, download FEMP or use another one

at module dialogs:
Code:
  [anyone|plyr,"town_dweller_talk", [(neg|agent_slot_eq,"$g_talk_agent",slot_agent_already_begg,1),(troop_get_type, ":gender", "$g_talk_troop"),(val_mod, ":gender", 2),(assign, reg1, ":gender"),], "{reg1?My lord:My good lady}, could you give me a few coins?", "town_dweller_begging",[(store_random_in_range, reg2, 1,4),]],
  [anyone,"town_dweller_begging", [(eq, reg2, 1),], "Take this, poor soul.", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(store_random_in_range, ":gold", 0, 1000),(troop_add_gold,0,":gold"),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],
  [anyone,"town_dweller_begging", [(eq, reg2, 2),], "Here you are, now get out of my way!", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(store_random_in_range, ":gold", 0, 1000),(troop_add_gold,0,":gold"),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],
  [anyone,"town_dweller_begging", [(eq, reg2, 3),], "GET OUT OF MY WAY!", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],



Credits to CromCrom/Cernunos for the idea xD

extra code:

in module_mission_templates:
Code:
common_play_instrument = (0, 0, 2, [(game_key_clicked, gk_defend)],
   [
    (get_player_agent_no, ":player"),
    (agent_get_wielded_item, ":shield", ":player", 1),
    (is_between, ":shield", instruments_begin, instruments_end),
    (store_random_in_range, ":music", "snd_<first_music>", "snd_<last_music>"),
    (agent_play_sound, ":player", ":music"),
   ]),
obs: you have to change <first_music> and <last_music> for your musics in the module_sounds file

credits to Caba`drin for the help in that one
 

xenoargh

Grandmaster Knight
I would be interested in this, if you can make the player do a special animation to use the instruments and play some custom music.  It would also be very cool if it caused additional people to spawn in the tavern scene, creating a festive atmosphere.  I'd be more interested in it as a money-making thing, personally- it would be very cool if it made more money the first time you did it at a location (i.e., to make maximum money, you'd want to travel around, just like real musicians have done since practically forever), and then had a cooldown, so that becoming a wandering minstrel could be profitable and interesting.  Add in the possibility of bar-fights and hecklers, and it would almost be an entire adventure!
 

Cernunos

Banned
I am working on the almost exact same feature in Rigale. It actually involves reputation and money making in towns, some very special troops recruitment, bard guild, and also party buffing according to the songs you will sing in camp.
 

Ikaguia

Grandmaster Knight
WBWF&SNW
Cernunos said:
I am working on the almost exact same feature in Rigale. It actually involves reputation and money making in towns, some very special troops recruitment, bard guild, and also party buffing according to the songs you will sing in camp.

I've got the Idea from you xD.
mine will work in a similar way but it will not include troops and bard guild.
King of Scotland said:
Very nice idea, hope there will be an animation and sounds of some sort.
I'm afraid not, It will happen trought menus and dialogs, no custom animations.
Specialist said:
This is GREAT! And it works pretty well. Hopefully a scripter will finish it. :smile:
I plan to finish it, I just didn't finish it before because I had school today and I got to sleep  :grin: :razz:
 

Specialist

Master Knight
WB
Sounds great! Once it is done, I'll be sticking this in my mod.
The troops need something to keep them busy! :grin:
 

Ikaguia

Grandmaster Knight
WBWF&SNW
just a quick question, how does this operation works?

(party_get_skill_level, ":entertain_skill", "p_main_party", "skl_entertain"),

edit:
almost done, just need to add the dialogs and the menus
 

Ikaguia

Grandmaster Knight
WBWF&SNW
90% done, just need to do the begging dialog

edit: Finished, now I'm going to test.
if you are gonna use this, make a backup before.

edit2:
dialog is bugged, anybody coud help me finding the errors?
Code:
  [anyone|plyr,"town_dweller_talk", [(neg|agent_slot_eq,"$g_talk_agent",slot_agent_already_begg,1),(troop_get_type, ":gender", "$g_talk_troop"),(val_mod, ":gender", 2),(assign, reg1, ":gender"),], "{reg1?My lord:My good lady}, could you give me a few coins?", "town_dweller_begging",[(store_random_in_range, reg2, 1,4),]],
  [anyone,"town_dweller_begging", [(eq, reg2, 1),], "Take this, poor soul.", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(store_random_in_range, ":gold", 0, 1000),(troop_add_gold,0,":gold"),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],
  [anyone,"town_dweller_begging", [(eq, reg2, 2),], "Here you are, now get out of my way!", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(store_random_in_range, ":gold", 0, 1000),(troop_add_gold,0,":gold"),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],
  [anyone,"town_dweller_begging", [(eq, reg2, 3),], "GET OUT OF MY WAY!", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1)(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],

Code:
Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
  File "C:\Users\Cristiano\Desktop\Coisas\Jogos\Mount&Blade\Forge\BOTH_Module Sy
stem\WB_1.134_Obsidian Phoenix\module_dialogs.py", line 33659, in <module>
    [anyone,"town_dweller_begging", [(eq, reg2, 3),], "GET OUT OF MY WAY!", "clo
se_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1)(val_sub,
"$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renow
n),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputat
ion"),(val_sub, "$player_honor", 3)]],
TypeError: 'tuple' object is not callable
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
E

edit3: ups, I was missing a comma

edit4: it's compiling fine now, just a simple change in module_simple_triggers


edit5:

extra code:

in module_mission_templates:
Code:
common_play_instrument = (0, 0, 2, [(game_key_clicked, gk_defend)],
   [
    (get_player_agent_no, ":player"),
    (agent_get_wielded_item, ":shield", ":player", 1),
    (is_between, ":shield", instruments_begin, instruments_end),
    (store_random_in_range, ":music", "snd_<last_music>", "snd_<last_music>"),
    (agent_play_sound, ":player", ":music"),
   ]),


edit:

I've tried the play song feature and it's working well.

edit:

It's working perfectly, I've got some CTD's but that was already happening before, it should be from other changes I made
 

Specialist

Master Knight
WB
in module_scripts:
search for:
Code:
    ("game_get_skill_modifier_for_troop",
      [(store_script_param, ":troop_no", 1),
        (store_script_param, ":skill_no", 2),
        (assign, ":modifier_value", 0),
        (try_begin),
          (eq, ":skill_no", "skl_wound_treatment"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_wound_treatment_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_trainer"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_training_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_surgery"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_surgery_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
          ## CC
        (else_try),
          (eq, ":skill_no", "skl_pathfinding"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_pathfinding_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_spotting"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_spotting_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
------> Tried that much. Search for everything before the ##CC and I found it. Using the Native Module System.

add this:
Code:
        (else_try),
          (eq, ":skill_no", "skl_entertain"),
		  (try_for_range, ":instrument", instruments_begin, instruments_end),
            (call_script, "script_get_troop_item_amount", ":troop_no", ":instrument"),
            (gt, reg0, 0),
            (val_add, ":modifier_value", 1),
		  (try_end),

add this new script:
Code:
# script_entertain_income
# input_1 = income
# input_2 = income_type
# used on playing a music or making a speech
  ("entertain_income",
   [(store_script_param, ":income", 1),
	(store_script_param, ":income_type", 2),
	(try_begin),
	######### HONOR #########
	  (eq, ":income_type", income_honor),
	  (val_div, ":income", 30),
	  (val_add, "$player_honor", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$player_honor"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@Your honor has been increased in {reg12} and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@Your honor has been decreased in {reg12} and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### REPUTATION #########
	  (eq, ":income_type", income_reputation),
	  (val_div, ":income", 30),
	  (troop_get_slot, ":old_reputation", 0, slot_troop_renown),
	  (store_add, ":new_reputation", ":old_reputation", ":income"),
	  (troop_set_slot, 0, slot_troop_renown, ":new_reputation"),
	  (assign, reg12, ":income"),
	  (assign, reg13, ":new_reputation"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} renown and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} renown and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### RIGHT TO RULE #########
	  (eq, ":income_type", income_right_to_rule),
	  (val_div, ":income", 30),
	  (val_add, "$player_right_to_rule", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$player_right_to_rule"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} right to rule and you have {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} right to rule and you have {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### BARDIC REPUTATION #########
	  (eq, ":income_type", income_bard_reputation),
	  (val_div, ":income", 2),
	  (val_add, "$bardic_reputation", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$bardic_reputation"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} bardic reputation and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} bardic reputation and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### DENARS #########
	  (troop_add_gold,0,":income"),
	  (store_troop_gold, reg13, 0),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You got {reg12} denars and you have {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} denars and you have {reg13} now.", 0xff3333),
	  (try_end),
	(try_end),
   ]),
---->Where does this go? At the end before the last ] ? Just curious

in module_game_menus:
search for the "camp" menu and add at the operations block:
Code:
	  (assign, "$entertainement_on", 0),
then in the "camp_wait_here" option, add at the consequences block:
Code:
	  (assign, "$entertainement_on", 1),
search for the "town" menu and add at the operations block:
Code:
	  (assign, "$entertainement_on", 0),
then in the "castle_wait" option, add at the consequences block:
Code:
	  (assign, "$entertainement_on", 1),
add a new option at the "town" menu:
Code:
      ("entertaiment",
       [(party_slot_eq,"$current_town",slot_party_type, spt_town),
        (this_or_next|eq,"$entry_to_town_forbidden",0),
        (eq, "$sneaked_into_town",1),],
       "Attempt to Play/Perform a music.",
       [(jump_to_menu, "mnu_choose_music"),]),

and then add this new menu:
Code:
	("choose_music",0,"What do you wanna do?",
	"none",
		[	
			(assign, "$entertainement_on", 0),
		],
		[
      ("simple",[(str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 7),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} simple music.(1 hour)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 7),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 1, 1, 0), #rest 1 hour while not-attackable                      
           (change_screen_map),]
       ),
      ("medium",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 2),
			   (ge, "$bardic_reputation", 130),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 15),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} medium music.(3 hours)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 15),
           (assign, "$entertain_income_type", income_denars),
           (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 3, 1, 0), #rest 3 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("complex",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 5),
			   (ge, "$bardic_reputation", 470),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 50),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} complex music.(5 hours)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 50),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 5, 3, 0), #rest 5 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("lordly",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 9),
			   (ge, "$bardic_reputation", 1150),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 90),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} Lordly music.(15 hours)",
		  [(assign, "$entertainement_on", 2),
		   (assign, "$entertain_income_rate", 90),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 15, 5, 0), #rest 15 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("royal",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 14),
			   (ge, "$bardic_reputation", 3550),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 170),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} Royal music.(35 hours)",
		  [(assign, "$entertainement_on", 3),
		   (assign, "$entertain_income_rate", 170),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 35, 6, 0), #rest 35 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("speech",[(str_store_string, s1, "@a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 9),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@another"),
			   (try_end),],"I want to make {s1} Speech.(3 hours)",
		  [(assign, "$entertainement_on", 0),
		   (assign, "$entertain_income_rate", 9),
		   (assign, "$entertain_income_type", income_reputation),
		   (assign, "$entertain_income_type2", income_right_to_rule),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 3, 1, 0), #rest 5 hours while not-attackable                      
           (change_screen_map),]
       ),
---->Where does this go in Game_menus? Inside the town options?

at module_constants:
Code:
instruments_begin		= "itm_lyre"
instruments_end			= "itm_instruments_end"
income_denars		= 1
income_honor			= 2
income_reputation		= 3
income_right_to_rule	= 4
income_bard_reputation	= 5
slot_agent_already_begg  = 46
-----> Does anyone know what the last available slot is for Native?


at module dialogs:
Code:
  [anyone|plyr,"town_dweller_talk", [(neg|agent_slot_eq,"$g_talk_agent",slot_agent_already_begg,1),(troop_get_type, ":gender", "$g_talk_troop"),(val_mod, ":gender", 2),(assign, reg1, ":gender"),], "{reg1?My lord:My good lady}, could you give me a few coins?", "town_dweller_begging",[(store_random_in_range, reg2, 1,4),]],
  [anyone,"town_dweller_begging", [(eq, reg2, 1),], "Take this, poor soul.", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(store_random_in_range, ":gold", 0, 1000),(troop_add_gold,0,":gold"),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],
  [anyone,"town_dweller_begging", [(eq, reg2, 2),], "Here you are, now get out of my way!", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(store_random_in_range, ":gold", 0, 1000),(troop_add_gold,0,":gold"),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],
  [anyone,"town_dweller_begging", [(eq, reg2, 3),], "GET OUT OF MY WAY!", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],



in module_mission_templates:
Code:
common_play_instrument = (0, 0, 2, [(game_key_clicked, gk_defend)],
   [
    (get_player_agent_no, ":player"),
    (agent_get_wielded_item, ":shield", ":player", 1),
    (is_between, ":shield", instruments_begin, instruments_end),
    (store_random_in_range, ":music", "snd_<first_music>", "snd_<last_music>"),
    (agent_play_sound, ":player", ":music"),
   ]),
----> I suppose at the end of mission_templates, correct?

[/quote]
 

Ikaguia

Grandmaster Knight
WBWF&SNW
Specialist said:
in module_scripts:
search for:
Code:
    ("game_get_skill_modifier_for_troop",
      [(store_script_param, ":troop_no", 1),
        (store_script_param, ":skill_no", 2),
        (assign, ":modifier_value", 0),
        (try_begin),
          (eq, ":skill_no", "skl_wound_treatment"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_wound_treatment_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_trainer"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_training_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_surgery"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_surgery_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
          ## CC
        (else_try),
          (eq, ":skill_no", "skl_pathfinding"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_pathfinding_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
        (else_try),
          (eq, ":skill_no", "skl_spotting"),
          (call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_spotting_reference"),
          (gt, reg0, 0),
          (val_add, ":modifier_value", 1),
------> Tried that much. Search for everything before the ##CC and I found it. Using the Native Module System.

ok,I'll edit the first post

add this:
Code:
        (else_try),
          (eq, ":skill_no", "skl_entertain"),
		  (try_for_range, ":instrument", instruments_begin, instruments_end),
            (call_script, "script_get_troop_item_amount", ":troop_no", ":instrument"),
            (gt, reg0, 0),
            (val_add, ":modifier_value", 1),
		  (try_end),

add this new script:
Code:
# script_entertain_income
# input_1 = income
# input_2 = income_type
# used on playing a music or making a speech
  ("entertain_income",
   [(store_script_param, ":income", 1),
	(store_script_param, ":income_type", 2),
	(try_begin),
	######### HONOR #########
	  (eq, ":income_type", income_honor),
	  (val_div, ":income", 30),
	  (val_add, "$player_honor", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$player_honor"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@Your honor has been increased in {reg12} and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@Your honor has been decreased in {reg12} and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### REPUTATION #########
	  (eq, ":income_type", income_reputation),
	  (val_div, ":income", 30),
	  (troop_get_slot, ":old_reputation", 0, slot_troop_renown),
	  (store_add, ":new_reputation", ":old_reputation", ":income"),
	  (troop_set_slot, 0, slot_troop_renown, ":new_reputation"),
	  (assign, reg12, ":income"),
	  (assign, reg13, ":new_reputation"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} renown and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} renown and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### RIGHT TO RULE #########
	  (eq, ":income_type", income_right_to_rule),
	  (val_div, ":income", 30),
	  (val_add, "$player_right_to_rule", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$player_right_to_rule"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} right to rule and you have {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} right to rule and you have {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### BARDIC REPUTATION #########
	  (eq, ":income_type", income_bard_reputation),
	  (val_div, ":income", 2),
	  (val_add, "$bardic_reputation", ":income"),
	  (assign, reg12, ":income"),
	  (assign, reg13, "$bardic_reputation"),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You gained {reg12} bardic reputation and it is {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} bardic reputation and it is {reg13} now.", 0xff3333),
	  (try_end),
	(else_try),
	######### DENARS #########
	  (troop_add_gold,0,":income"),
	  (store_troop_gold, reg13, 0),
	  (try_begin),
		(gt, ":income", 0),
		(display_message, "@You got {reg12} denars and you have {reg13} now.", 0x33ff33),
	  (else_try),
		(lt, ":income", 0),
		(display_message, "@You lost {reg12} denars and you have {reg13} now.", 0xff3333),
	  (try_end),
	(try_end),
   ]),
---->Where does this go? At the end before the last ] ? Just curious

New Scripts could be added anywhere, but it's better at the end (for save-game compatibility)

in module_game_menus:
search for the "camp" menu and add at the operations block:
Code:
	  (assign, "$entertainement_on", 0),
then in the "camp_wait_here" option, add at the consequences block:
Code:
	  (assign, "$entertainement_on", 1),
search for the "town" menu and add at the operations block:
Code:
	  (assign, "$entertainement_on", 0),
then in the "castle_wait" option, add at the consequences block:
Code:
	  (assign, "$entertainement_on", 1),
add a new option at the "town" menu:
Code:
      ("entertaiment",
       [(party_slot_eq,"$current_town",slot_party_type, spt_town),
        (this_or_next|eq,"$entry_to_town_forbidden",0),
        (eq, "$sneaked_into_town",1),],
       "Attempt to Play/Perform a music.",
       [(jump_to_menu, "mnu_choose_music"),]),

and then add this new menu:
Code:
	("choose_music",0,"What do you wanna do?",
	"none",
		[	
			(assign, "$entertainement_on", 0),
		],
		[
      ("simple",[(str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 7),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} simple music.(1 hour)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 7),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 1, 1, 0), #rest 1 hour while not-attackable                      
           (change_screen_map),]
       ),
      ("medium",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 2),
			   (ge, "$bardic_reputation", 130),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 15),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} medium music.(3 hours)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 15),
           (assign, "$entertain_income_type", income_denars),
           (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 3, 1, 0), #rest 3 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("complex",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 5),
			   (ge, "$bardic_reputation", 470),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 50),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} complex music.(5 hours)",
		  [(assign, "$entertainement_on", 1),
		   (assign, "$entertain_income_rate", 50),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 5, 3, 0), #rest 5 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("lordly",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 9),
			   (ge, "$bardic_reputation", 1150),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 90),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} Lordly music.(15 hours)",
		  [(assign, "$entertainement_on", 2),
		   (assign, "$entertain_income_rate", 90),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 15, 5, 0), #rest 15 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("royal",[(store_skill_level,":skill_lvl","skl_entertain",0),
			   (ge, ":skill_lvl", 14),
			   (ge, "$bardic_reputation", 3550),
			   (str_store_string, s1, "@play a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 170),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@play another"),
			   (try_end),],"I want to {s1} Royal music.(35 hours)",
		  [(assign, "$entertainement_on", 3),
		   (assign, "$entertain_income_rate", 170),
		   (assign, "$entertain_income_type", income_denars),
		   (assign, "$entertain_income_type2", income_bard_reputation),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 35, 6, 0), #rest 35 hours while not-attackable                      
           (change_screen_map),]
       ),
      ("speech",[(str_store_string, s1, "@a"),
			   (try_begin),
				(eq, "$entertain_income_rate", 9),
				(assign, "$entertain_income_rate", 0),
				(str_store_string, s1, "@another"),
			   (try_end),],"I want to make {s1} Speech.(3 hours)",
		  [(assign, "$entertainement_on", 0),
		   (assign, "$entertain_income_rate", 9),
		   (assign, "$entertain_income_type", income_reputation),
		   (assign, "$entertain_income_type2", income_right_to_rule),
           (assign, "$g_infinite_camping", 0),             
           (assign, "$auto_enter_town", "$current_town"),
           (assign, "$g_town_visit_after_rest", 1),
           (assign, "$g_last_rest_center", "$current_town"),
           (rest_for_hours_interactive, 3, 1, 0), #rest 5 hours while not-attackable                      
           (change_screen_map),]
       ),
---->Where does this go in Game_menus? Inside the town options?
"town" is a menu, this is a new one, should be added outside it.
New Menus could be added anywhere, but it's better at the end of the file(for save-game compatibility)


at module_constants:
Code:
instruments_begin		= "itm_lyre"
instruments_end			= "itm_instruments_end"
income_denars		= 1
income_honor			= 2
income_reputation		= 3
income_right_to_rule	= 4
income_bard_reputation	= 5
slot_agent_already_begg  = 46
-----> Does anyone know what the last available slot is for Native?
just search for "slot_agent" and see the last one


at module dialogs:
Code:
  [anyone|plyr,"town_dweller_talk", [(neg|agent_slot_eq,"$g_talk_agent",slot_agent_already_begg,1),(troop_get_type, ":gender", "$g_talk_troop"),(val_mod, ":gender", 2),(assign, reg1, ":gender"),], "{reg1?My lord:My good lady}, could you give me a few coins?", "town_dweller_begging",[(store_random_in_range, reg2, 1,4),]],
  [anyone,"town_dweller_begging", [(eq, reg2, 1),], "Take this, poor soul.", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(store_random_in_range, ":gold", 0, 1000),(troop_add_gold,0,":gold"),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],
  [anyone,"town_dweller_begging", [(eq, reg2, 2),], "Here you are, now get out of my way!", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(store_random_in_range, ":gold", 0, 1000),(troop_add_gold,0,":gold"),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],
  [anyone,"town_dweller_begging", [(eq, reg2, 3),], "GET OUT OF MY WAY!", "close_window",[(agent_set_slot,"$g_talk_agent",slot_agent_already_begg,1),(val_sub, "$player_right_to_rule", 30),(troop_get_slot, ":reputation", 0, slot_troop_renown),(val_add, ":reputation", 30),(troop_set_slot, 0, slot_troop_renown, ":reputation"),(val_sub, "$player_honor", 3)]],



in module_mission_templates:
Code:
common_play_instrument = (0, 0, 2, [(game_key_clicked, gk_defend)],
   [
    (get_player_agent_no, ":player"),
    (agent_get_wielded_item, ":shield", ":player", 1),
    (is_between, ":shield", instruments_begin, instruments_end),
    (store_random_in_range, ":music", "snd_<first_music>", "snd_<last_music>"),
    (agent_play_sound, ":player", ":music"),
   ]),
----> I suppose at the end of mission_templates, correct?
wrong, this should be added in the beggining, just like the other common_X
then You'll have to add "common_play_instrument" at the templates you want to be able to play musics (just comsmetics)

obs: I haven't explained the last one in the first post because it is an extra and is purely comsmetic
 

SonKidd

Knight
Added to modding wiki.

Edit wherever you see necessary.

http://mbmodwiki.ollclan.eu/Entertainement_skill
 

Idibil

Grandmaster Knight
Ikaguia, I was looking this for add.
You have forget code of header_skills  :wink:


Code:
skl_entertain = 3 #ikaguia code
#skl_reserved_1 = 3


#brytenwalda skill de Ikaguia
knows_entertain_1 = 4096
knows_entertain_2 = 8192
knows_entertain_3 = 12288
knows_entertain_4 = 16384
knows_entertain_5 = 20480
knows_entertain_6 = 24576
knows_entertain_7 = 28672
knows_entertain_8 = 32768
knows_entertain_9 = 36864
knows_entertain_10 = 40960
##knows_reserved_1_1 = 4096
##knows_reserved_1_2 = 8192
##knows_reserved_1_3 = 12288
##knows_reserved_1_4 = 16384
##knows_reserved_1_5 = 20480
##knows_reserved_1_6 = 24576
##knows_reserved_1_7 = 28672
##knows_reserved_1_8 = 32768
##knows_reserved_1_9 = 36864
##knows_reserved_1_10 = 40960

And here:

common_play_instrument = (0, 0, 2, [(game_key_clicked, gk_defend)],
  [
    (get_player_agent_no, ":player"),
    (agent_get_wielded_item, ":shield", ":player", 1),
    (is_between, ":shield", instruments_begin, instruments_end),
    (store_random_in_range, ":music", "snd_<first_music>", "snd_<last_music>"),
    (agent_play_sound, ":player", ":music"),
  ]),

Delete last ,

common_play_instrument = (0, 0, 2, [(game_key_clicked, gk_defend)],
  [
    (get_player_agent_no, ":player"),
    (agent_get_wielded_item, ":shield", ":player", 1),
    (is_between, ":shield", instruments_begin, instruments_end),
    (store_random_in_range, ":music", "snd_<first_music>", "snd_<last_music>"),
    (agent_play_sound, ":player", ":music"),
  ])

and add brks end of:

      ("speech",[(str_store_string, s1, "@a"),
  (try_begin),
(eq, "$entertain_income_rate", 9),
(assign, "$entertain_income_rate", 0),
(str_store_string, s1, "@another"),
  (try_end),],"I want to make {s1} Speech.(3 hours)",
  [(assign, "$entertainement_on", 0),
  (assign, "$entertain_income_rate", 9),
  (assign, "$entertain_income_type", income_reputation),
  (assign, "$entertain_income_type2", income_right_to_rule),
          (assign, "$g_infinite_camping", 0),           
          (assign, "$auto_enter_town", "$current_town"),
          (assign, "$g_town_visit_after_rest", 1),
          (assign, "$g_last_rest_center", "$current_town"),
          (rest_for_hours_interactive, 3, 1, 0), #rest 5 hours while not-attackable                     
          (change_screen_map),]
      ),

]),


Rest, I think that all is right.


 

motomataru

Squire
M&BWBVC
Ran across this in Idibil's mod and didn't like how it worked. Flags weren't working right, a couple bugs, and the design of having a trigger reap the consequences of the menus was mysterious (see http://dl.dropbox.com/u/8432316/Screenies/Strange%20Expenses.bmp). The player could exploit simply by breaking out of rest_for_hours_interactive (five royal performances in as many hours, anyone?). So I redid it; main change is to use automenu instead of that 1-hour trigger. So now it's like this:

1. If the player breaks out of performance, no (new) benefits are given, reported IMMEDIATELY by the automenu. Nice feature in mod system, BTW, turns out autos fire when player breaks out of rest (mapfree() op).
2. If the player completes the performance, the automenu IMMEDIATELY reports results.
3. The player is prevented from a consecutive performance in the same town.
4. The $entertainement_on is reinit ONLY by the morale trigger (so it doesn't zero out before the trigger fires), and resting does not reduce it (overwriting a royal performance, for example).

I can post if you like, with caveat that Idibil lengthened the timing on the triggers...
 

Ikaguia

Grandmaster Knight
WBWF&SNW
well, that is how it was suposed to be, but I did some mistakes, I am still learning how to code some things...
 
Top Bottom