For the ladies here is a script version of what you're looking for.Bayard-X said:Thanks!
Could you also point out, which lines of that code I need to copy? Would I also need other parts of the code?
# script_tpe_rep_gain_ladies
# This section implements the "Lady Reactions" feature.
# Inputs: None
# Output: None
("tpe_rep_gain_ladies",
[
# Raises relation with Ladies that are (present). More so if in courtship.
(try_for_range, ":troop_npc", kingdom_ladies_begin, kingdom_ladies_end),
(troop_slot_eq, ":troop_npc", slot_troop_cur_center, "$current_town"), # For the Ladies.
(assign, ":lady_rep", 1),
(try_begin),
(troop_slot_ge, ":troop_npc", slot_troop_courtship_state, 2),
(val_add, ":lady_rep", 2),
(try_end),
(call_script, "script_change_player_relation_with_troop", ":troop_npc", ":lady_rep"),
(try_end),
]),
# Determines relation gain based on repeated wins in the same town.
(str_store_party_name, s3, "$current_town"),
(party_get_slot, ":total_wins", "$current_town", slot_center_tournament_wins),
(val_add, ":total_wins", 1),
(party_set_slot, "$current_town", slot_center_tournament_wins, ":total_wins"),
(call_script, "script_change_player_relation_with_center", "$current_town", ":total_wins"),
# script_tpe_rep_gain_lords
# This section implements the "Lord Reactions" feature.
# Inputs: None
# Output: None
("tpe_rep_gain_lords",
[
# Raises relation with Lords that are (present) AND (friendly). Enemies gain nothing.
(party_collect_attachments_to_party, "$current_town", "p_temp_party"),
(party_get_num_companion_stacks,":party_stacks","p_temp_party"),
(try_for_range, ":stack_no", 0, ":party_stacks"),
(party_stack_get_troop_id,":troop_in_party","p_temp_party",":stack_no"),
(troop_is_hero, ":troop_in_party"),
(neg|is_between, ":troop_in_party", companions_begin, companions_end), # Removed companions from this benefit.
(call_script, "script_troop_get_player_relation", ":troop_in_party"),
(assign, ":relation", reg0),
(assign, ":relation_gain", 0),
(try_begin),
(ge, ":relation", 10),
(val_add, ":relation_gain", 1),
(else_try),
(le, ":relation", -5),
(val_sub, ":relation_gain", -1),
(try_end),
(call_script, "script_change_player_relation_with_troop", ":troop_in_party", ":relation_gain"),
(try_end),
]),
Shouldn't cause any issues at all. Good luck with your mod.Bayard-X said:However, I implemented not as a script but directly in the menu. Is there something to worry?
Traceback (most recent call last):
File "process_init.py", line 2, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Traceback (most recent call last):
File "process_global_variables.py", line 12, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
File "process_map_icons.py", line 6, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
File "process_items.py", line 66, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Exporting scene data...
Traceback (most recent call last):
File "process_scenes.py", line 15, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
File "process_scene_props.py", line 7, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Traceback (most recent call last):
File "process_tableau_materials.py", line 8, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Traceback (most recent call last):
File "process_presentations.py", line 8, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Exporting party_template data...
Traceback (most recent call last):
File "process_parties.py", line 4, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
File "process_scripts.py", line 7, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Traceback (most recent call last):
File "process_mission_tmps.py", line 8, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Traceback (most recent call last):
File "process_game_menus.py", line 5, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Traceback (most recent call last):
File "process_simple_triggers.py", line 5, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Traceback (most recent call last):
File "process_dialogs.py", line 9, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Traceback (most recent call last):
File "process_global_variables_unused.py", line 3, in <module>
from process_operations import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\process_oper
ations.py", line 22, in <module>
from module_game_menus import *
File "C:\Program Files (x86)\Mount&Blade Warband\Modules\New\Data\module_game_
menus.py", line 10276
SyntaxError: Non-ASCII character '\x93' in file C:\Program Files (x86)\Mount&Bla
de Warband\Modules\New\Data\module_game_menus.py on line 10276, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
Exporting postfx_params...
______________________________
Script processing has ended.
Press any key to exit. . .
("tournament_options_panel", [(eq, “$g_wp_tpe_active”, 1)], "Change tournament options.",
I agree with this. If you have modmerger installed in your mod I will have 1.1 of TPE uploaded sometime in the morning assuming my Internet connection at home is back. Then modmerger can do the work for you. A much better set of installation instructions will also be included.Somebody said:Delete that entire line and re-type it yourself, or change the encoding declared at the top of the file - it's probably a quote character or something.
# script_tpe_determine_scaled_renown
# This section implements the "Renown Scaling" feature.
# Inputs: None
# Output: reg0 (new renown)
("tpe_determine_scaled_renown",
[
# Determine renown gained by player level.
(store_character_level, ":player_level", "trp_player"),
(store_div, ":sr_level_factor", 40, ":player_level"), # Balanced for a max level of 40. Beyond this you get minimum gain.
(val_mul, ":sr_level_factor", 5),
(store_div, ":sr_factor_limit", wp_tpe_max_renown, 2), # Since two factors are used. Total is split by 2.
(val_min, ":sr_level_factor", ":sr_factor_limit"), # Prevents an extremely low level gaining more renown than intended.
(val_max, ":sr_level_factor", 5), # Sets a minimum renown gain of 5 no matter how high your level is.
# Determine renown gained by player renown.
(troop_get_slot, ":player_renown", "trp_player", slot_troop_renown),
(store_div, ":sr_renown_factor", 1500, ":player_renown"), # Balanced for a max renown of 1500. Beyond this you get minimum gain.
(val_mul, ":sr_renown_factor", 5),
(store_div, ":sr_factor_limit", wp_tpe_max_renown, 2), # Since two factors are used. Total is split by 2.
(val_min, ":sr_renown_factor", ":sr_factor_limit"), # Prevents an extremely low level gaining more renown than intended.
(val_max, ":sr_renown_factor", 5), # Sets a minimum renown gain of 5 no matter how high your level is.
(store_add, reg0, ":sr_level_factor", ":sr_renown_factor"), # combines both factors.
]),
That is the correct script. The only input it needs to make it independent of the TPE mod is for constant (wp_tpe_max_renown) to be defined or simply set it locally. I used 80 since the amount scales down very quickly as you gain level and renown.Michigan J. Frog said:but is there any other section of the scripts that I would need to add to it to make it work?
# Determine scaled renown
(call_script, "script_tpe_determine_scaled_renown"),
(call_script, "script_change_troop_renown", "trp_player", reg0),
from ID_items import *
from ID_quests import *
from ID_factions import *
##############################################################
# These constants are used in various files.
# If you need to define a value that will be used in those files,
# just define it here rather than copying it across each file, so
# that it will be easy to change it if you need to.
##############################################################
# Renown Scaling
slot_center_tournament_wins = 233 # This tallies each win so that subsequent wins gain more reputation as a "crowd favorite".
wp_tpe_max_renown = 80 # This sets a hard limit on how much renown can be gained at most.
# -*- coding: cp1254 -*-
from header_common import *
from header_operations import *
from module_constants import *
from module_constants import *
from header_parties import *
from header_skills import *
from header_mission_templates import *
from header_items import *
from header_triggers import *
from header_terrain_types import *
from header_music import *
from header_map_icons import *
from ID_animations import *
####################################################################################################################
# scripts is a list of script records.
# Each script record contns the following two fields:
# 1) Script id: The prefix "script_" will be inserted when referencing scripts.
# 2) Operation block: This must be a valid operation block. See header_operations.py for reference.
####################################################################################################################
scripts = [
# Renown Scaling in Tournaments
# script_tpe_determine_scaled_renown
# This section implements the "Renown Scaling" feature.
# Inputs: None
# Output: reg0 (new renown)
("tpe_determine_scaled_renown",
[
# Determine renown gained by player level.
(store_character_level, ":player_level", "trp_player"),
(store_div, ":sr_level_factor", 40, ":player_level"), # Balanced for a max level of 40. Beyond this you get minimum gain.
(val_mul, ":sr_level_factor", 5),
(store_div, ":sr_factor_limit", wp_tpe_max_renown, 2), # Since two factors are used. Total is split by 2.
(val_min, ":sr_level_factor", ":sr_factor_limit"), # Prevents an extremely low level gaining more renown than intended.
(val_max, ":sr_level_factor", 5), # Sets a minimum renown gain of 5 no matter how high your level is.
# Determine renown gained by player renown.
(troop_get_slot, ":player_renown", "trp_player", slot_troop_renown),
(store_div, ":sr_renown_factor", 1500, ":player_renown"), # Balanced for a max renown of 1500. Beyond this you get minimum gain.
(val_mul, ":sr_renown_factor", 5),
(store_div, ":sr_factor_limit", wp_tpe_max_renown, 2), # Since two factors are used. Total is split by 2.
(val_min, ":sr_renown_factor", ":sr_factor_limit"), # Prevents an extremely low level gaining more renown than intended.
(val_max, ":sr_renown_factor", 5), # Sets a minimum renown gain of 5 no matter how high your level is.
(store_add, reg0, ":sr_level_factor", ":sr_renown_factor"), # combines both factors.
]),
I'm not sure I understand your question so let me clarify. Do you want to have the scaling renown, lord reputation, lady reputation and town reputation features work with the normal native tournament? If that is the case then:Michigan J. Frog said:If so, where do I need to call the script? I'm not the greatest at understanding where things need to be. I've been messing with prisoner chat dialogs, so I've just been copy/pasting scripts for the most part
(
"town_tournament_won",mnf_disable_all_keys,
"You have won the tournament of {s3}! You are filled with pride as the crowd cheers your name.\
In addition to honour, fame and glory, you earn a prize of {reg9} denars. {s8}",
"none",
[
(str_store_party_name, s3, "$current_town"),
(call_script, "script_change_troop_renown", "trp_player", 20),
(call_script, "script_change_player_relation_with_center", "$current_town", 1),
(assign, reg9, 200),
(add_xp_to_troop, 250, "trp_player"),
(troop_add_gold, "trp_player", reg9),
(str_clear, s8),
(store_add, ":total_win", "$g_tournament_bet_placed", "$g_tournament_bet_win_amount"),
(try_begin),
(gt, "$g_tournament_bet_win_amount", 0),
(assign, reg8, ":total_win"),
(str_store_string, s8, "@Moreover, you earn {reg8} denars from the clever bets you placed on yourself..."),
(try_end),
(try_begin),
(this_or_next|neq, "$players_kingdom", "$g_encountered_party_faction"),
(neg|troop_slot_ge, "trp_player", slot_troop_renown, 70),
(neg|troop_slot_ge, "trp_player", slot_troop_renown, 145),
(faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_state, sfai_feast),
(faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_object, "$g_encountered_party"),
(str_store_string, s8, "str_s8_you_are_also_invited_to_attend_the_ongoing_feast_in_the_castle"),
(try_end),
(troop_add_gold, "trp_player", ":total_win"),
(assign, ":player_odds_sub", 0),
(store_div, ":player_odds_sub", "$g_tournament_bet_win_amount", 5),
(party_get_slot, ":player_odds", "$current_town", slot_town_player_odds),
(val_sub, ":player_odds", ":player_odds_sub"),
(val_max, ":player_odds", 250),
(party_set_slot, "$current_town", slot_town_player_odds, ":player_odds"),
(call_script, "script_play_victorious_sound"),
(unlock_achievement, ACHIEVEMENT_MEDIEVAL_TIMES),
],
[
("continue", [], "Continue...",
[(jump_to_menu, "mnu_town"),
]),
]
),
(
"town_tournament_won",mnf_disable_all_keys,
"You have won the tournament of {s3}! You are filled with pride as the crowd cheers your name.\
In addition to honour, fame and glory, you earn a prize of {reg9} denars. {s8}",
"none",
[
## TOURNAMENT PLAY ENHANCEMENTS (1.0) begin - Windyplains
# Determine scaled renown
(call_script, "script_tpe_determine_scaled_renown"),
(assign, ":sr_renown", reg0),
# Determines relation gain based on repeated wins in the same town.
(str_store_party_name, s3, "$current_town"),
(party_get_slot, ":total_wins", "$current_town", slot_center_tournament_wins),
(val_add, ":total_wins", 1),
(party_set_slot, "$current_town", slot_center_tournament_wins, ":total_wins"),
(call_script, "script_change_troop_renown", "trp_player", ":sr_renown"),
(call_script, "script_change_player_relation_with_center", "$current_town", ":total_wins"),
# Raises relation with Lords that are (present) AND (friendly). Enemies lose relation.
(call_script, "script_tpe_rep_gain_lords"),
# Raises relation with Ladies that are (present). More so if in courtship.
(call_script, "script_tpe_rep_gain_ladies"),
## TOURNAMENT PLAY ENHANCEMENTS end
(assign, reg9, 2000), # Was 200
(add_xp_to_troop, 2500, "trp_player"), # Was 250
(troop_add_gold, "trp_player", reg9),
(str_clear, s8),
(store_add, ":total_win", "$g_tournament_bet_placed", "$g_tournament_bet_win_amount"),
(try_begin),
(gt, "$g_tournament_bet_win_amount", 0),
(assign, reg8, ":total_win"),
(str_store_string, s8, "@Moreover, you earn {reg8} denars from the clever bets you placed on yourself..."),
(try_end),
(try_begin),
(this_or_next|neq, "$players_kingdom", "$g_encountered_party_faction"),
(neg|troop_slot_ge, "trp_player", slot_troop_renown, 70),
(neg|troop_slot_ge, "trp_player", slot_troop_renown, 145),
(faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_state, sfai_feast),
(faction_slot_eq, "$g_encountered_party_faction", slot_faction_ai_object, "$g_encountered_party"),
(str_store_string, s8, "str_s8_you_are_also_invited_to_attend_the_ongoing_feast_in_the_castle"),
(try_end),
(troop_add_gold, "trp_player", ":total_win"),
(assign, ":player_odds_sub", 0),
(store_div, ":player_odds_sub", "$g_tournament_bet_win_amount", 5),
(party_get_slot, ":player_odds", "$current_town", slot_town_player_odds),
(val_sub, ":player_odds", ":player_odds_sub"),
(val_max, ":player_odds", 250),
(party_set_slot, "$current_town", slot_town_player_odds, ":player_odds"),
(call_script, "script_play_victorious_sound"),
(unlock_achievement, ACHIEVEMENT_MEDIEVAL_TIMES),
],
[
("continue", [], "Continue...",
[(jump_to_menu, "mnu_town"),
]),
]
),
So if I had won 10 tournaments in the town, I would gain 10 relation with them?Windyplains said:It just adds 1 to the counter each time and gives you a reputation gain equal to the total.
Correct. You are in effect a crowd favorite.So if I had won 10 tournaments in the town, I would gain 10 relation with them?
Sure. In that menu I showed before look for...I know it would take a while to get to a lot of wins in just one town (but there are feats, etc.), but is there a way to set a limit on the amount of relation points you get? Something like 7 seems reasonable to me. Or is there a way to make it so you get less relation points then your total wins (ex. 1 win/2 rounds to 1 point, 2 wins/2 rounds to 1 point, 3 wins/2 rounds to 2, and so on).
(val_add, ":total_wins", 1),
(party_set_slot, "$current_town", slot_center_tournament_wins, ":total_wins"),
(val_min, ":total_wins", 7),
Amusing, but odd. This kit doesn't touch the dueling template at all. Oh and sorry about the wp_tpe_debug, just set it to 0. Have you tried installing the kit via modmerger and seeing if it works? Without knowing whatever other changes you've made it is hard to say where that went wrong. The TPE 1.11 kit itself should only replace mnu_town_tournament & mnu_town_tournament_won. Everything else should be separate from the native code unless you've made other alterations.Michigan J. Frog said:I got an error when compiling it that said that wp_tpe_debug is not defined.
Does that need to be in the script to work? Otherwise, what needs to be done to fix it.
Edit: I got rid of the debug part, and I held a feast so I could test the tournament. When I started to wait at the town for lords to come, a screen said "you prepare to duel', and suddenly I was fighting Haringoth. After the duel, it went into a endless loop of him saying "surrender or die" and me saying "do your worst".
@ MichiganSomebody said:val_max returns the larger of the two values, so that would give you a minimum increase of two. Use val_div before (call_script, "script_change_player_relation_with_center", "$current_town", ":total_wins"), if you want to halve the effect.