Introduction
Introduction Statistics Contact Development Disclaimer Help
Return Create A Forum - Home
---------------------------------------------------------
The World Of Perisno
https://perisno.createaforum.com
---------------------------------------------------------
*****************************************************
Return to: Everything About Modding
*****************************************************
#Post#: 75--------------------------------------------------
Codes/Scrips
By: Michadr Date: August 10, 2013, 12:13 am
---------------------------------------------------------
[/sub]Any codes you find that would be helpful go here. If you
post a code/script please make subject what the code is about so
it's easier to find in search function.
A Introduction to modding by Lumas >>
http://forums.taleworlds.com/index.php/topic,240255.0.html
#Post#: 144--------------------------------------------------
Spear Bracing And Horse Calling
By: Michadr Date: August 13, 2013, 2:20 am
---------------------------------------------------------
http://forums.taleworlds.com/index.php/topic,61051.0.html
#Post#: 232--------------------------------------------------
Gender Face Codes
By: Michadr Date: August 16, 2013, 12:02 am
---------------------------------------------------------
Problem: if you add multiple races as genders, the new races are
always considered female because they don't have header tf=0.
i heard there was a solution that could be a bit complicated,
but i didn't find anything about the neccessary changes/coding.
and i know some mods have managed to add new male races, but i
don't get it.
Solution:
Replace all troop_get_type with script to define the gender. We
can make male have least significant bit=0, and female' LSB =1.
Let's say tf_male=0, tf_female=1, tf_goblin=2. Then, Female
goblin=tf_goblin|tf_female
So after call (troop_get_type,":gender", ":troop"), then call
(val_and, ":gender", 1),
male will be 0, and female will be 1.
or...
http://forums.taleworlds.com/index.php/topic,59300.msg1534679.html#msg1534679
#Post#: 417--------------------------------------------------
Creating Message When Bandits Spawn
By: Michadr Date: August 18, 2013, 2:21 am
---------------------------------------------------------
How to create a message when bandits spawn
You can go down to the message box route or just display a
side-log entry, if you'd like it more subtle. Either way, you
just use the adequate opcode in the spawning trigger block, just
at the end. Or variable chaining, you know, a trigger which sets
to truth a variable which after a certain delay when certain
conditions are met launches the user message and sets it to
false again.
Reference Codes
[code]##########################################################
######################
# [ Z18 ] OUTPUT AND MESSAGES
################################################################
################
# These operations will provide some textual information to
the player during
# the game. There are three operations which will generate a
game message
# (displayed as a chat-like series of text strings in the
bottom-left part of
# the screen), while most others will be displaying various
types of dialog
# boxes. You can also ask a question to player using these
operations.
display_debug_message = 1104 #
(display_debug_message, <string_id>, [hex_colour_code]),
# Displays a string
message, but only in debug mode, using provided color (hex-coded
0xRRGGBB). The message is additionally written to rgl_log.txt
file in both release and debug modes when edit mode is enabled.
display_log_message = 1105 #
(display_log_message, <string_id>, [hex_colour_code]),
# Display a string
message using provided color (hex-coded 0xRRGGBB). The message
will also be written to game log (accessible through Notes /
Game Log), and will persist between sessions (i.e. it will be
stored as part of the savegame).
display_message = 1106 # (display_message,
<string_id>,[hex_colour_code]),
# Display a string
message using provided color (hex-coded 0xRRGGBB).
set_show_messages = 1107 #
(set_show_messages, <value>),
# Suppresses (value
= 0) or enables (value = 1) game messages, including those
generated by the game engine.
tutorial_box = 1120 # (tutorial_box,
<string_id>, <string_id>),
# This operation is
deprecated but is still used in Native.
dialog_box = 1120 # (dialog_box,
<text_string_id>, [title_string_id]),
# Displays a popup
window with the text message and an optional caption.
question_box = 1121 # (question_box,
<string_id>, [<yes_string_id>], [<no_string_id>]),
# Displays a popup
window with the text of the question and two buttons (Yes and No
by default, but can be overridden). When the player selects one
of possible responses, a ti_on_question_answered trigger will be
executed.
tutorial_message = 1122 # (tutorial_message,
<string_id>, [color], [auto_close_time]),
# Displays a popup
window with tutorial text stored in referenced string or string
register. Use -1 to close any currently open tutorial box.
Optional parameters allow you to define text color and time
period after which the tutorial box will close automatically.
tutorial_message_set_position = 1123 #
(tutorial_message_set_position, <position_x>, <position_y>),
# Defines screen
position for the tutorial box. Assumes screen size is 1000*750.
tutorial_message_set_size = 1124 #
(tutorial_message_set_size, <size_x>, <size_y>),
# Defines size of
the tutorial box. Assumes screen size is 1000*750.
tutorial_message_set_center_justify = 1125 #
(tutorial_message_set_center_justify, <val>),
# Sets tutorial box
to be center justified (value = 1), or use positioning dictated
by tutorial_message_set_position (value = 0).
tutorial_message_set_background = 1126 #
(tutorial_message_set_background, <value>),
# Defines whether
the tutorial box will have a background or not (1 or 0). Default
is off.
################################################################
################
# [ Z19 ] GAME CONTROL: SCREENS, MENUS, DIALOGS AND ENCOUNTERS
################################################################
################
# An encounter is what happens when player's party meets
another party on the
# world map. While most operations in the game can be
performed outside of
# encounter, there's one thing you can only do when in
encounter context -
# standard game battle. When you are initiating the battle
from an encounter,
# the game engine will do most of the grunt work for you. You
can order the
# engine to add some parties to the battle on this or that
side, and the
# soldiers from those parties will spawn on the battlefield,
in the numbers
# proportional to the party sizes, and the agents will
maintain links with
# their parties. If agents earn experience, this will be
reflected on the
# world map, and if some agents die, party sizes will be
decreased. All this
# stuff can potentially be emulated by the Module System code,
but it's tons
# of work and is still much less efficient than the tool the
game engine
# already provides to you.
# An important notice: when player encounters an AI party on
the map, the game
# calls "game_event_party_encounter" script in the
module_scripts.py. So if
# you want to implement some non-standard processing of game
encounters, this
# is the place you should start from. Also note that the game
implements the
# Camp menu as an encounter with a hardcoded party
"p_camp_bandits".
# Also you can find many operations in this section dealing
with game screens,
# game menus and game dialogs. Keep in mind that some screens
only make sense
# in certain contexts, and game menus are only available on
the world map, you
# cannot use game menus during the mission.
# Condition check operations
entering_town = 36 # (entering_town,
<town_id>),
# Apparently
deprecated.
encountered_party_is_attacker = 39 #
(encountered_party_is_attacker),
# Checks that the
party encountered on the world map was following player (i.e.
either player was trying to run away or at the very least this
is a head-on clash).
conversation_screen_is_active = 42 #
(conversation_screen_active),
# Checks that the
player is currently in dialogue with some agent. Can only be
used in triggers of module_mission_templates.py file.
in_meta_mission = 44 #
(in_meta_mission),
# Deprecated, do
not use.
# Game hardcoded windows and related operations
change_screen_return = 2040 #
(change_screen_return),
# Closes any
current screen and returns the player to worldmap (to scene?).
4research how it behaves in missions.
change_screen_loot = 2041 #
(change_screen_loot, <troop_id>),
# Opens the
Looting interface, using the provided troop as loot storage.
Player has full access to troop inventory.
change_screen_trade = 2042 #
(change_screen_trade, [troop_id]),
# Opens the Trade
screen, using the provided troop as the trading partner. When
called from module_dialogs, troop_id is optional and defaults to
current dialogue partner.
change_screen_exchange_members = 2043 #
(change_screen_exchange_members, [exchange_leader], [party_id]),
# Opens the
Exchange Members With Party interface, using the specified
party_id. If called during an encounter, party_id is optional
and defaults to the encountered party. Second parameter
determines whether the party leader is exchangeable (useful when
managing the castle garrison).
change_screen_trade_prisoners = 2044 #
(change_screen_trade_prisoners),
# Opens the Sell
Prisoners interface. Script "script_game_get_prisoner_price"
will be used to determine prisoner price.
change_screen_buy_mercenaries = 2045 #
(change_screen_buy_mercenaries),
# Opens the Buy
Mercenaries interface, where player can hire troops from the
party specified with (set_mercenary_source_party) operation.
Only works from the dialog.
change_screen_view_character = 2046 #
(change_screen_view_character),
# Opens the
character screen of another troop. Can only be used in dialogs.
change_screen_training = 2047 #
(change_screen_training),
# Opens the
character screen for the troop that player is currently talking
to. Only works in dialogs. Deprecated, use
(change_screen_view_character) instead.
change_screen_mission = 2048 #
(change_screen_mission),
# Starts the
mission, using previously defined scene and mission template.
change_screen_map_conversation = 2049 #
(change_screen_map_conversation, <troop_id>),
# Starts the
mission, same as (change_screen_mission). However once the
mission starts, player will get into dialog with the specified
troop, and once the dialog ends, the mission will automatically
end.
change_screen_exchange_with_party = 2050 #
(change_screen_exchange_with_party, <party_id>),
# Effectively
duplicates (change_screen_exchange_members), but party_id
parameter is obligatory and the operation doesn't have an option
to prevent party leader from being exchanged.
change_screen_equip_other = 2051 #
(change_screen_equip_other, [troop_id]),
# Opens the Equip
Companion interface. When calling from a dialog, it is not
necessary to specify troop_id.
change_screen_map = 2052 #
(change_screen_map),
# Changes the
screen to global map, closing any currently running game menu,
dialog or mission.
change_screen_notes = 2053 #
(change_screen_notes, <note_type>, <object_id>),
# Opens the Notes
screen, in the selected category (note_type: 1=troops,
2=factions, 3=parties, 4=quests, 5=info_pages) and for the
specified object in that category.
change_screen_quit = 2055 #
(change_screen_quit),
# Quits the game
to the main menu.
change_screen_give_members = 2056 #
(change_screen_give_members, [party_id]),
# Opens the Give
Troops to Another Party interface. Party_id parameter is
optional during an encounter and will use encountered party as
default value.
change_screen_controls = 2057 #
(change_screen_controls),
# Opens the
standard Configure Controls screen, pausing the game.
change_screen_options = 2058 #
(change_screen_options),
# Opens the
standard Game Options screen, pausing the game.
set_mercenary_source_party = 1320 #
(set_mercenary_source_party, <party_id>),
# Defines the
party from which the player will buy mercenaries with
(change_screen_buy_mercenaries).
start_map_conversation = 1025 #
(start_map_conversation, <troop_id>, [troop_dna]),
# Starts a
conversation with the selected troop. Can be called directly
from global map or game menus. Troop DNA parameter allows you to
randomize non-hero troop appearances.
# Game menus
set_background_mesh = 2031 #
(set_background_mesh, <mesh_id>),
# Sets the
specified mesh as the background for the current menu. Possibly
can be used for dialogs or presentations, but was not tested.
set_game_menu_tableau_mesh = 2032 #
(set_game_menu_tableau_mesh, <tableau_material_id>, <value>,
<position_register_no>),
# Adds a tableau
to the current game menu screen. Position (X,Y) coordinates
define mesh position, Z coordinate defines scaling. Parameter
<value> will be passed as tableau_material script parameter.
jump_to_menu = 2060 # (jump_to_menu,
<menu_id>),
# Opens the
specified game menu. Note this only happens after the current
block of code completes execution.
disable_menu_option = 2061 #
(disable_menu_option),
# Never used in
native. Apparently deprecated as menu options have prerequisite
code blocks now.
# Game encounter handling operations
set_party_battle_mode = 1020 #
(set_party_battle_mode),
# Used before or
during the mission to start battle mode (and apparently make
agents use appropriate AI).
finish_party_battle_mode = 1019 #
(finish_party_battle_mode),
# Used during the
mission to stop battle mode.
start_encounter = 1300 #
(start_encounter, <party_id>),
# Forces the
player party to initiate encounter with the specified party.
Distance does not matter in this situation.
leave_encounter = 1301 #
(leave_encounter),
# Leaves encounter
mode.
encounter_attack = 1302 #
(encounter_attack),
# Apparently
starts the standard battle with the encountered party.
4research.
select_enemy = 1303 # (select_enemy,
<value>),
# When joining a
battle, this determines what side player will be helping. Player
can support either attackers (value = 0) or defenders (value =
1).
set_passage_menu = 1304 #
(set_passage_menu, <value>),
# When setting up
a mission, this allows you to determine what game menu will be
used for that mission passages instead of "mnu_town". Passage
menu item number will determine what menu option (in sequential
order, starting from 0) will be executed when the player
activates that passage on the scene.
start_mission_conversation = 1920 #
(start_mission_conversation, <troop_id>),
# During the
mission, initiates the dialog with specified troop.
set_conversation_speaker_troop = 2197 #
(set_conversation_speaker_troop, <troop_id>),
# Allows to
dynamically switch speaking troops during the dialog when
developer doesn't know in advance who will be doing the
speaking. Should be placed in post-talk code section of dialog
entry.
set_conversation_speaker_agent = 2198 #
(set_conversation_speaker_agent, <agent_id>),
# Allows to
dynamically switch speaking agents during the dialog when
developer doesn't know in advance who will be doing the
speaking. Should be placed in post-talk code section of dialog
entry.
store_conversation_agent = 2199 #
(store_conversation_agent, <destination>),
# Stores
identifier of agent who is currently speaking.
store_conversation_troop = 2200 #
(store_conversation_troop, <destination>),
# Stores
identifier of troop who is currently speaking.
store_partner_faction = 2201 #
(store_partner_faction, <destination>),
# Stores faction
of the troop player is speaking to.
store_encountered_party = 2202 #
(store_encountered_party, <destination>),
# Stores
identifier of the encountered party.
store_encountered_party2 = 2203 #
(store_encountered_party2, <destination>),
# Stores the
identifier of the second encountered party (when first party is
in battle, this one will return it's battle opponent).
set_encountered_party = 2205 #
(set_encountered_party, <party_no>),
# Sets the
specified party as encountered by player, but does not run the
entire encounter routine. Used in Native during chargen to set
up the starting town and then immediately throw the player into
street fight without showing him the town menu.
end_current_battle = 1307 #
(end_current_battle),
# Apparently ends
the battle between player's party and it's opponent. Exact
effects not clear. 4research.
# Operations specific to dialogs
store_repeat_object = 50 #
(store_repeat_object, <destination>),
# Used in the
dialogs code in combination with repeat_for_* dialog parameters,
when creating dynamical player responses. Stores the value for
the current iteration (i.e. a faction ID when
repeat_for_factions is used, etc).
talk_info_show = 2020 # (talk_info_show,
<hide_or_show>),
# Used in the
dialogs code to display relations bar on opponent's portrait
when mouse is hovering over it (value = 1) or disable this
functionality (value = 0)
talk_info_set_relation_bar = 2021 #
(talk_info_set_relation_bar, <value>),
# Sets the
relations value for relationship bar in the dialog. Value should
be in range -100..100.
talk_info_set_line = 2022 #
(talk_info_set_line, <line_no>, <string_no>)
# Sets the
additional text information (usually troop name) to be displayed
together with the relations bar.[/code]
#Post#: 426--------------------------------------------------
Making troop upgrade cost different amount of money depending on
the path chosen
By: Michadr Date: August 18, 2013, 3:30 am
---------------------------------------------------------
[center]Making troop upgrade cost different amount of money
depending on the path chosen.[/center] [right]By- Lav[/right]
module scripts.py
[code] # script_game_get_upgrade_cost_for_path
# This script is called to determine the price of troop
upgrade along the provided path (0 = first upgrade path, 1 =
second upgrade path)
# Code is just a stub, replace with whatever you need.
# Input: arg1 = troop_id, arg2 = path
# Output: reg0 = needed cost for upgrade
("game_get_upgrade_cost_for_path",
[
#(store_script_param_1, ":troop_id"),
(store_script_param_2, ":path"),
(assign, reg0, 100),
(val_lshift, reg0, ":path"),
]),
# script_game_get_upgrade_cost
# This script is called from game engine for calculating
needed troop upgrade exp
# Input:
# param1: troop_id,
# Output: reg0 = needed cost for upgrade
("game_get_upgrade_cost",
[
(store_script_param_1, ":troop_id"),
(try_begin),
(gt, "$g_upgraded_troop_id", 0), # Last time was on a
troop with more than 1 upgrade path
(troop_get_upgrade_troop, ":tier1",
"$g_upgraded_troop_id", 0),
(troop_get_upgrade_troop, ":tier2",
"$g_upgraded_troop_id", 1),
(party_count_companions_of_type, ":tier1count",
"p_main_party", ":tier1"),
(party_count_companions_of_type, ":tier2count",
"p_main_party", ":tier2"),
(this_or_next|gt, ":tier1count", reg10),
(gt, ":tier2count", reg11), # Number of upgraded troops
increased since previous call!
(try_begin),
(gt, ":tier2count", reg11), # Number of upgraded
troops in path2 increased since previous call!
(call_script, "script_game_get_upgrade_cost_for_path",
"$g_upgraded_troop_id", 1),
(assign, ":price", reg0),
(call_script, "script_game_get_upgrade_cost_for_path",
"$g_upgraded_troop_id", 0),
(val_sub, ":price", reg0),
(store_sub, ":upgraded", ":tier2count", reg11),
(val_mul, ":price", ":upgraded"),
(set_show_messages, 0),
(troop_remove_gold, "trp_player", ":price"),
(set_show_messages, 1),
(try_end),
# Now cleaning up to imitate first run
(assign, "$g_upgraded_counter", 0),
(try_end),
(troop_get_upgrade_troop, ":tier1", ":troop_id", 0),
(troop_get_upgrade_troop, ":tier2", ":troop_id", 1),
(try_begin),
(gt, ":tier2", 0),
(assign, "$g_upgraded_troop_id", ":troop_id"), # Set
flag for next run
(assign, ":path", "$g_upgraded_counter"),
(store_sub, "$g_upgraded_counter", 1,
"$g_upgraded_counter"), # Flip
(party_count_companions_of_type, reg10, "p_main_party",
":tier1"), # Remember how many upgraded troops from 1st path are
there
(party_count_companions_of_type, reg11, "p_main_party",
":tier2"), # Remember how many upgraded troops from 2nd path are
there
(else_try),
(assign, "$g_upgraded_troop_id", 0), # Reset flag
(assign, ":path", 0),
(try_end),
(call_script, "script_game_get_upgrade_cost_for_path",
":troop_id", ":path"),
(set_trigger_result, reg0),
]),[/code]
module_triggers.py
[code] (0, 0, 0, [(gt, "$g_upgraded_troop_id", 0)], [assign,
"$g_upgraded_troop_id", 0]),[/code]
An important caveat: this will not detect the upgrade if the
upgraded troop is at the top of the tree. This means that in
order to use this code, top-level upgrades should not allow
branching.
#Post#: 427--------------------------------------------------
Enhanced script initialize aristocracy
By: Michadr Date: August 18, 2013, 3:32 am
---------------------------------------------------------
[center]Enhanced script_initialize_aristocracy[/center]
[right]By- dunde[/right]
[code]("initialize_aristocracy",
[
#LORD OCCUPATIONS, BLOOD RELATIONSHIPS, RENOWN AND
REPUTATIONS
#King ages
(try_for_range, ":cur_troop", kings_begin, kings_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation,
slto_kingdom_hero),
(store_random_in_range, ":age", 50, 60),
(try_begin),
(eq, ":cur_troop", "trp_kingdom_5_lord"),
(assign, ":age", 47),
(try_end),
(call_script, "script_init_troop_age", ":cur_troop",
":age"),
(try_end),
#The first thing - family structure
#lords 1 to 8 are patriarchs with one live-at-home son and
one daughter. They come from one of six possible ancestors, thus
making it likely that there will be two sets of siblings
#lords 9 to 12 are unmarried landowners with sisters
#lords 13 to 20 are sons who still live in their fathers'
houses
#For the sake of simplicity, we can assume that all male
aristocrats in prior generations either married commoners or
procured their brides from the Old Country, thus discounting
intermarriage
(try_for_range, ":cur_troop", kingdom_ladies_begin,
kingdom_ladies_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation,
slto_kingdom_lady),
(try_end),
(assign, ":cur_lady", "trp_kingdom_1_lady_1"),
(try_for_range, ":cur_troop", lords_begin, lords_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation,
slto_kingdom_hero),
(store_random_in_range, ":father_age_at_birth", 23, 26),
# (store_random_in_range, ":mother_age_at_birth", 19,
22),
(try_begin),
(is_between, ":cur_troop", "trp_knight_1_1",
"trp_knight_2_1"),
(store_sub, ":npc_seed", ":cur_troop",
"trp_knight_1_1"),
(assign, ":ancestor_seed", 1),
(assign, ":king", "trp_kingdom_1_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_2_1",
"trp_knight_3_1"),
(store_sub, ":npc_seed", ":cur_troop",
"trp_knight_2_1"),
(assign, ":ancestor_seed", 7),
(assign, ":king", "trp_kingdom_2_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_3_1",
"trp_knight_4_1"),
(store_sub, ":npc_seed", ":cur_troop",
"trp_knight_3_1"),
(assign, ":ancestor_seed", 13),
(assign, ":king", "trp_kingdom_3_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_4_1",
"trp_knight_5_1"),
(store_sub, ":npc_seed", ":cur_troop",
"trp_knight_4_1"),
(assign, ":ancestor_seed", 19),
(assign, ":king", "trp_kingdom_4_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_5_1",
"trp_knight_6_1"),
(store_sub, ":npc_seed", ":cur_troop",
"trp_knight_5_1"),
(assign, ":ancestor_seed", 25),
(assign, ":king", "trp_kingdom_5_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_6_1",
"trp_kingdom_1_pretender"),
(store_sub, ":npc_seed", ":cur_troop",
"trp_knight_6_1"),
(assign, ":ancestor_seed", 31),
(assign, ":king", "trp_kingdom_6_lord"),
(try_end),
(try_begin), #NPC seed is the order in the faction
(lt, ":npc_seed", 8), #Senior lords
(assign, ":reputation", ":npc_seed"),
(store_random_in_range, ":age", 45, 64),
(store_random_in_range, ":father", 0, 6), #six
possible fathers
(val_add, ":father", ":ancestor_seed"),
(troop_set_slot, ":cur_troop", slot_troop_father,
":father"), # Father is not active npc
#wife
(troop_set_slot, ":cur_troop", slot_troop_spouse,
":cur_lady"),
(troop_set_slot, ":cur_lady", slot_troop_spouse,
":cur_troop"),
(store_random_in_range, ":wife_reputation", 20, 26),
(try_begin),
(eq, ":wife_reputation", 20),
(assign, ":wife_reputation", lrep_conventional),
(try_end),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, ":wife_reputation"),
(store_random_in_range, ":lady_age", 40, ":age"),
(call_script, "script_init_troop_age", ":cur_lady",
":lady_age"),
(call_script, "script_add_lady_items", ":cur_lady"),
(val_add, ":cur_lady", 1),
#daughter
(troop_set_slot, ":cur_lady", slot_troop_father,
":cur_troop"),
(store_sub, ":mother", ":cur_lady", 1),
(store_random_in_range, ":lady_age", 17, 25),
(val_max, ":lady_age", 19),
(call_script, "script_init_troop_age", ":cur_lady",
":lady_age"),
(troop_set_slot, ":cur_lady", slot_troop_mother,
":cur_lady"),
(store_random_in_range, ":lady_reputation",
lrep_conventional, 34), #33% chance of father-derived
(try_begin),
(le, ":lady_reputation", 25),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, ":lady_reputation"),
(else_try),
(eq, ":lady_reputation", 26),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":lady_reputation", 27),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_moralist),
(else_try),
(assign, ":guardian_reputation", ":reputation"),
(try_begin),
(this_or_next|eq, ":guardian_reputation",
lrep_martial),
(eq, ":guardian_reputation", 0),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":guardian_reputation",
lrep_quarrelsome),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_otherworldly),
(else_try),
(eq, ":guardian_reputation",
lrep_selfrighteous),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_cunning),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation",
lrep_goodnatured),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation",
lrep_debauched),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation",
lrep_upstanding),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_moralist),
(try_end),
(try_end),
(call_script, "script_add_lady_items", ":cur_lady"),
(val_add, ":cur_lady", 1),
#high renown
(else_try), #Older unmarried lords
(is_between, ":npc_seed", 8, 12), # Dunde gives sons
to the kings
(store_random_in_range, ":age", 25, 36),
(store_random_in_range, ":reputation", 0, 8),
(try_begin),
(is_between, ":npc_seed", 8, 10),
(this_or_next|eq, ":npc_seed", 8), (ge,
":reputation", 6),
(troop_set_slot, ":cur_troop", slot_troop_father,
":king"),
(val_min, ":age", 28), # we want young princes
(try_end),
(try_begin),
# No Father
(troop_slot_lt, ":cur_troop", slot_troop_father,
0),
(store_random_in_range, ":sister_reputation",
20, 26),
(try_begin),
(eq, ":sister_reputation", 20),
(assign, ":sister_reputation",
lrep_conventional),
(try_end),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, ":sister_reputation"),
(troop_set_slot, ":cur_lady",
slot_troop_guardian, ":cur_troop"),
(else_try),
# King's son
(try_begin), #50% chance of having father's rep
(store_random_in_range, ":reputation", 0,
16),
(gt, ":reputation", 7),
(troop_get_slot, ":reputation", ":king",
slot_lord_reputation_type),
(try_end),
(troop_set_slot, ":cur_lady", slot_troop_father,
":king"),
(store_random_in_range, ":lady_reputation",
lrep_conventional, 34), #33% chance of father-derived
(try_begin),
(le, ":lady_reputation", 25),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, ":lady_reputation"),
(else_try),
(eq, ":lady_reputation", 26),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":lady_reputation", 27),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_moralist),
(else_try),
(assign, ":guardian_reputation",
":reputation"),
(try_begin),
(this_or_next|eq,
":guardian_reputation", lrep_martial),
(eq, ":guardian_reputation", 0),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":guardian_reputation",
lrep_quarrelsome),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_otherworldly),
(else_try),
(eq, ":guardian_reputation",
lrep_selfrighteous),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation",
lrep_cunning),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation",
lrep_goodnatured),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation",
lrep_debauched),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation",
lrep_upstanding),
(troop_set_slot, ":cur_lady",
slot_lord_reputation_type, lrep_moralist),
(try_end),
(try_end),
(try_end),
(store_random_in_range, ":lady_age", 15, 28),
(val_max, ":lady_age", 21),
(call_script, "script_init_troop_age", ":cur_lady",
":lady_age"),
(call_script, "script_add_lady_items", ":cur_lady"),
(val_add, ":cur_lady", 1),
(else_try), #Younger unmarried lords
#age is father's minus 20 to 25
(store_sub, ":father", ":cur_troop", 12),
(troop_set_slot, ":cur_troop", slot_troop_father,
":father"),
(troop_get_slot, ":mother", ":father",
slot_troop_spouse),
(troop_set_slot, ":cur_troop", slot_troop_mother,
":mother"),
(troop_get_slot, ":father_age", ":father",
slot_troop_age),
(store_sub, ":age", ":father_age",
":father_age_at_birth"),
(try_begin), #50% chance of having father's rep
(store_random_in_range, ":reputation", 0, 16),
(gt, ":reputation", 7),
(troop_get_slot, ":reputation", ":father",
slot_lord_reputation_type),
(try_end),
(try_end),
(try_begin),
(eq, ":reputation", 0),
(assign, ":reputation", 1),
(try_end),
(troop_set_slot, ":cur_troop",
slot_lord_reputation_type, ":reputation"),
(call_script, "script_init_troop_age", ":cur_troop",
":age"),
(try_end),
(try_begin),
(eq, "$cheat_mode", 1),
(assign, reg3, "$cheat_mode"),
(display_message, "@{!}DEBUG -- Assigned lord reputation
and relations"),
# (display_message,
"str_assigned_lord_reputation_and_relations_cheat_mode_reg3"),
#This string can be removed
(try_end),
(try_for_range, ":cur_troop", pretenders_begin,
pretenders_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation,
slto_inactive_pretender),
(store_random_in_range, ":age", 25, 30),
#(troop_set_slot, ":cur_troop", slot_troop_age, ":age"),
(try_begin),
(eq, ":cur_troop", "trp_kingdom_5_pretender"),
(assign, ":age", 45),
(try_end),
(call_script, "script_init_troop_age", ":cur_troop",
":age"),
(try_end),
]),[/code]
#Post#: 428--------------------------------------------------
Extended Prisoner Chat
By: Michadr Date: August 18, 2013, 3:35 am
---------------------------------------------------------
[center] Extended Prisoner Chat[/center] [right]By-
Specialist[/right]
Replaces Existing Prisoner Chat in (Dialogs)
[code]##########
# Prisoner Talk - Originally written by Leprechaun, majorly
overhauled & extended by Mordachai
################################################################
###################################
# this is a dummy dialog - it sets up the globals we need
[anyone|plyr, "prisoner_chat", [
(store_conversation_troop,"$g_talk_troop"),
(store_troop_faction,"$g_talk_troop_faction","$g_talk_troop"),
(store_relation, "$g_talk_troop_faction_relation",
"$g_talk_troop_faction", "fac_player_faction"),
(call_script, "script_troop_get_player_relation",
"$g_talk_troop"),
(assign, "$g_talk_troop_relation", reg0),
(eq, 1, 0)
], "", "close_window", &#91;]],
# the following is intended to catch when you free up space
for a prisoner that already agreed to join you
[anyone|plyr, "prisoner_chat", [(troop_slot_eq,
"$g_talk_troop", slot_prisoner_agreed, 1),(troops_can_join, 1)],
"All right, I have made room for you.",
"prisoner_chat_accept_confirm", &#91;]],
[anyone, "prisoner_chat_accept_confirm", &#91;], "I am at
your command, my {lord/lady}.", "prisoner_chat_accept3",
&#91;]],
# and we catch the case where you still don't have any room
for a pending conscripted prisoner
[anyone|plyr, "prisoner_chat", [(troop_slot_eq,
"$g_talk_troop", slot_prisoner_agreed, 1),(neg|troops_can_join,
1)], "I am sorry, I still have no room for you. You'll have to
wait a while longer.", "close_window",&#91;]],
# default entry (no prior join agreement, or they've
previously refused)
[anyone|plyr, "prisoner_chat", [(neg|troop_slot_eq,
"$g_talk_troop", slot_troop_occupation, slto_kingdom_hero)],
"You there!", "prisoner_chat_commoner", &#91;]],
[anyone|plyr, "prisoner_chat", [(troop_slot_eq,
"$g_talk_troop", slot_troop_occupation,
slto_kingdom_hero),(str_store_troop_name, s1, "$g_talk_troop")],
"{s1}", "prisoner_chat_lord", &#91;]],
# reaction to you based on noble or low-birth
[anyone, "prisoner_chat_commoner", &#91;], "Me?! (Gulp!)",
"prisoner_chat_menu",&#91;]],
[anyone, "prisoner_chat_lord", [(str_store_troop_name, s1,
"trp_player")], "Yes, {Lord/Lady} {s1}?",
"prisoner_chat_noble",&#91;]],
# nobles chat begin
[anyone|plyr,"prisoner_chat_noble", &#91;], "You are free to
go.", "prisoner_chat_noble_prerelease",&#91;]],
[anyone|plyr,"prisoner_chat_noble", &#91;], "You will remain
my prisoner.", "prisoner_chat_noble_prekeep",&#91;]],
[anyone|plyr,"prisoner_chat_noble", [(gt, "$players_kingdom",
0)], "You have committed high treason!",
"prisoner_chat_treason",&#91;]],
[anyone|plyr,"prisoner_chat_noble_prerelease", &#91;],
"Despite what you may have heard, I am a {man/woman} of honor.
You are free to go.", "prisoner_chat_noble_release", &#91;]],
[anyone, "prisoner_chat_noble_release", &#91;], "I will
not forget this act of Chivalry!", "close_window",
[
# remove the troop from prison
(call_script, "script_remove_troop_from_prison",
"$g_talk_troop"),
(party_remove_prisoners, "p_main_party", "$g_talk_troop",
1),
# determine how much honor and faction relation change this
prisoner is worth
(try_begin),
# king
(faction_slot_eq, "$g_talk_troop_faction",
slot_faction_leader, "$g_talk_troop"),
(assign, ":honor", 5),
(assign, ":fac_reln", 15),
(else_try),
# other lord
(assign, ":honor", 2),
(assign, ":fac_reln", 5),
(try_end),
# give the player their honor, faction relation, and lord
relation change
(call_script, "script_change_player_relation_with_troop",
"$g_talk_troop", 10),
(call_script, "script_change_player_honor", ":honor"),
(call_script, "script_change_player_relation_with_faction",
"$g_talk_troop_faction", ":fac_reln" ),
]],
[anyone|plyr,"prisoner_chat_noble_prekeep", &#91;], "You will
understand if I keep you hostage until your family can afford
to... compensate me for certain expenses and hardships I have
endured to keep you fed and ...safe... these past weeks.",
"prisoner_chat_noble_keep",&#91;]],
[anyone, "prisoner_chat_noble_keep", [(ge,
"$player_honor", 10),(ge, "$g_talk_troop_relation", 0)], "Truly,
this is beneath you.", "close_window",&#91;]],
[anyone, "prisoner_chat_noble_keep", &#91;], "And I trust
you will be as understanding when I hunt you down like the dog
you are!", "close_window",[(call_script,
"script_change_player_relation_with_troop", "$g_talk_troop",
-1)]],
# commoners chat begin
[anyone|plyr,"prisoner_chat_menu", &#91;], "Hmmm... perhaps
you're not as stupid as the rest of those rabble.",
"prisoner_chat_offer",&#91;]],
[anyone|plyr,"prisoner_chat_menu", &#91;], "As wretched as you
are, I cannot help but feel sorry for you.",
"prisoner_chat_release",&#91;]],
[anyone|plyr,"prisoner_chat_menu", &#91;], "The sight of you
makes me sick! You.. Die.. Now!", "prisoner_chat_die1",&#91;]],
[anyone|plyr,"prisoner_chat_menu", &#91;], "Get back in line,
Scum!", "close_window",&#91;]],
[anyone|plyr,"prisoner_chat_release", &#91;], "I'm feeling
magnanimous today. Begone, before I change my mind!",
"prisoner_chat_release2", &#91;]],
[anyone, "prisoner_chat_release2", &#91;], "Oh, thank you,
{sir/madam}. Blessings on you!", "close_window",
[(remove_troops_from_prisoners, "$g_talk_troop",
1),(call_script, "script_change_player_honor", 1)]],
[anyone|plyr,"prisoner_chat_offer", &#91;], "Listen, scum, you
have one last chance to redeem yourself before I sell you to the
slave-traders. "\
"Drop all your previous
allegiances and swear fealty to me, obey my every order to the
letter, and you'll be paid, fed and equipped. "\
"If you don't....well,
let's just say that life as a slave will be seemingly unending
years of agony, malnutrition and beatings. "\
"I'd advise you to think
very, very carefully before choosing. ",
"prisoner_chat_reaction",
[(call_script,
"script_determine_prisoner_agreed", "$g_talk_troop",
"$g_talk_troop_faction_relation")]],
[anyone, "prisoner_chat_reaction", [(troop_slot_eq,
"$g_talk_troop", slot_prisoner_agreed, 1)], "Thank you for your
mercy, {sir/madam}. I swear on my mothers grave I will serve
you, my {lord/lady}!","prisoner_chat_accept1",&#91;]],
[anyone, "prisoner_chat_reaction", &#91;], "I'll show you
what I think of your offer! (The prisoner spits at your feet)
There. Now get lost, I'm not interested.",
"prisoner_chat_refuse",&#91;]],
[anyone|plyr,"prisoner_chat_refuse", &#91;], "I see...",
"prisoner_chat_menu",&#91;]],
[anyone|plyr,"prisoner_chat_die1", &#91;], "(You advance on
the prisoner...)", "prisoner_chat_die2",&#91;]],
[anyone, "prisoner_chat_die2", &#91;], "Please,
{sir/madam}, don't kill me. I am a defenceless prisoner. Surely
you're not that cruel?", "prisoner_chat_die3",&#91;]],
[anyone|plyr,"prisoner_chat_die3", &#91;], "(Kill the
prisoner)", "prisoner_chat_die4",&#91;]],
[anyone|plyr,"prisoner_chat_die3", &#91;], "No, I will not
sink that low.", "close_window",&#91;]],
[anyone|plyr,"prisoner_chat_die4", &#91;], "(The prisoner
struggles against his shackles, desperate to free himself and
escape you, but to no avail. You slit their throat with a knife
and watch, satisfied, as his corpse sags to the floor.)",
"close_window",
[(remove_troops_from_prisoners, "$g_talk_troop", 1),
(call_script, "script_change_player_honor", -1)]],
[anyone|plyr, "prisoner_chat_accept1", &#91;], "If you so much
as fail to tremble on my command, I will have you severely
disciplined!", "prisoner_chat_accept2",&#91;]],
[anyone|plyr, "prisoner_chat_accept1", &#91;], "In my camp we
are all treated as equals. I expect your obedience, but also
your trust.", "prisoner_chat_accept2",&#91;]],
[anyone, "prisoner_chat_accept2", &#91;], "I will obey
your wishes, my {lord/lady}. I swear!",
"prisoner_chat_accept3",&#91;]],
[anyone|plyr, "prisoner_chat_accept3", [(neg|troops_can_join,
1)], "Oh! Apparently there isn't enough room for you in my
party. I will be back when I have made space.", "close_window",
&#91;]],
[anyone|plyr, "prisoner_chat_accept3", [(troops_can_join, 1)],
"Excellent. Report to the quartermaster for provisions and
equiment. There is hard fighting ahead.", "close_window",
[(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
(remove_troops_from_prisoners, "$g_talk_troop",1),
(party_add_members, "p_main_party", "$g_talk_troop", 1),
(call_script, "script_change_troop_renown", "trp_player",
1),]],
[anyone|plyr, "prisoner_chat_treason", [(str_store_troop_name,
s1, "$g_talk_troop"), (str_store_faction_name, s2,
"$players_kingdom")],
"{s1}, you have committed cimes against the {s2}, for which
you will now stand trial.^How plead you?",
"prisoner_chat_treason_plead",
[
# determine the noble's reaction to this accusation
(store_random_in_range, reg0, 1, 5),#bug: must set upper
number one higher to actually generate correct range
#TODO: weight the reaction according to the renown? Or at
least according to king or not...
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed,
reg0),
]
],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq,
"$g_talk_troop", slot_prisoner_agreed, 1),],
"Please have mercy upon my soul. All I have done, I have
done in the name of my King and Country! I am but a patriot, as
you, and I deserve your respect, if nothing else.",
"prisoner_chat_treason_choose", &#91;]],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq,
"$g_talk_troop", slot_prisoner_agreed, 2),],
"You are gravely mistaken! I am an honorable Lord, and I
have done nothing that you would not do were our roles
exchanged.", "prisoner_chat_treason_choose", &#91;]],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq,
"$g_talk_troop", slot_prisoner_agreed, 3),],
"I spit on you and yours! You are but a cur come to put on
airs, as though you were Noble and had any right whatsoever to
judge me! Me! You are a nothing but a common brigand and a
coward! I do not bow to you. You should drop to your knees and
beg *my* forgiveness!", "prisoner_chat_treason_choose", &#91;]],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq,
"$g_talk_troop", slot_prisoner_agreed, 4),],
"You dare accuse me?! You sniveling whelpling! I should
see you flogged and put in chains in one of my prisons for your
insolence!", "prisoner_chat_treason_choose", &#91;]],
[anyone|plyr, "prisoner_chat_treason_choose", &#91;], "I am a
{man/woman} of honor. I shall spare your life this day!",
"prisoner_chat_treason_not_guilty",
[
#TODO: have the relation with the prison have a mixed
(random) result - relief, anger, etc, which dictates their final
monologue to the player before exiting the dialog
# make sure we don't try to recruit this prisoner later!
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed,
0),
]
],
[anyone, "prisoner_chat_treason_not_guilty",
[(str_store_troop_name, s1, "trp_player")], "There is yet hope
for you, {s1}.", "close_window", &#91;]],
[anyone|plyr, "prisoner_chat_treason_choose", &#91;], "You do
not deserve leiniency. You must pay for your crimes with your
life.", "prisoner_chat_treason_guilty", &#91;]],
[anyone|plyr, "prisoner_chat_treason_guilty", &#91;], "For
your many crimes against {s1}, I hereby sentence you to death,
to be carried out immediately. Have you any final words to
say?", "prisoner_chat_treason_final_words",
[(store_random_in_range, reg0, 1, 6), (troop_set_slot,
"$g_talk_troop", slot_prisoner_agreed, reg0)]],
[anyone, "prisoner_chat_treason_final_words",
[(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "I
believe you will one day come to regret your actions. There is
only one who is worthy to decide another's fate... and that one
is not you.", "prisoner_chat_treason_execute", &#91;]],
[anyone, "prisoner_chat_treason_final_words",
[(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2)],
"You are a coward and a dog! May your soul rot eternal, damn
you!", "prisoner_chat_treason_execute", &#91;]],
[anyone, "prisoner_chat_treason_final_words",
[(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3)],
"Winter's mortality,^locked in frozen indifference,^melts with
Spring's rebirth.", "prisoner_chat_treason_execute", &#91;]],
[anyone, "prisoner_chat_treason_final_words",
[(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4)],
"You will find no peace on this earth! I shall haunt thee
eternal! Unto death you will find nothing but unhappiness and
fear. And beyond... only torture and pain!",
"prisoner_chat_treason_execute", &#91;]],
[anyone, "prisoner_chat_treason_final_words",
[(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 5)],
"Who are you?^A day passes^We are but children",
"prisoner_chat_treason_execute", &#91;]],
[anyone|plyr, "prisoner_chat_treason_execute", &#91;],
"(The prisoner struggles against his shackles, desperate to
free himself and escape you, but to no avail. You slit his
throat and watch, satisfied, as his corpse sags to the floor.)",
"close_window",
[
# attempt to allow the player to see the consequences of
their actions
#(set_show_messages, 1), # this not only fails - but
messages are hereafter disabled in the main game...
# make sure we don't try to recruit this prisoner stack
later!
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed,
0),
# "kill" the NPC - force the 48 hr respawn kingdom heros
trigger to ignore this troop (no party will be created for this
troop, ever again)
# [q.v. script_create_kingdom_hero_party]
(troop_set_slot, "$g_talk_troop", slot_troop_occupation,
slto_dead),
# remove them from their faction
(troop_set_slot, "$g_talk_troop",
slot_troop_change_to_faction, "fac_no_faction"),
(troop_set_slot, "$g_talk_troop",
slot_troop_original_faction, "fac_no_faction"),
# determine the penalty for this act (based on the honor
of the troop they've killed)
(troop_get_slot, ":impact", "$g_talk_troop",
slot_troop_renown),
(val_div, ":impact", -33),
(store_div, ":half", ":impact", 2),
# reduce the player's relationship with every village,
town, and castle
(try_for_range, ":center", centers_begin, centers_end),
(store_faction_of_party, ":faction", ":center"),
(store_relation, ":relation", ":faction",
"$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script,
"script_change_player_relation_with_center", ":center",
":half"),
(else_try),
# not at war, full impact
(call_script,
"script_change_player_relation_with_center", ":center",
":impact"),
(try_end),
(try_end),
# reduce the player's relationship with every hero,
companion, lady, and daughter
(try_for_range, ":troop", trp_npc1, trp_heroes_end),
# don't make the dead any angrier than they already are!
(neg|troop_slot_eq, ":troop", slot_troop_occupation,
slto_dead),
(store_troop_faction, ":faction", ":troop"),
(store_relation, ":relation", ":faction",
"$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script,
"script_change_player_relation_with_troop", ":troop", ":half"),
(else_try),
# not at war, full impact
(call_script,
"script_change_player_relation_with_troop", ":troop",
":impact"),
(try_end),
(try_end),
# reduce the player's relationship with every faction
(enemies 1/2 as much)
(try_for_range, ":faction", kingdoms_begin, kingdoms_end),
(store_relation, ":relation", ":faction",
"$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script,
"script_change_player_relation_with_faction", ":faction",
":half"),
(else_try),
# not at war, full impact
(call_script,
"script_change_player_relation_with_faction", ":faction",
":impact"),
(try_end),
(try_end),
# apply the honor hit
(call_script, "script_change_player_honor", ":impact"),
# party morale takes a hit as well
(call_script, "script_change_player_party_morale",
":half"),
# but give them renown for this evil deed (their deed
spreads upon every tongue, impressing some, and cowing others)
(val_mul, ":impact", -1),
(call_script, "script_change_troop_renown", "trp_player" ,
":impact"),
# start with the assumption that the fief should return to
its faction for redistribution
(assign, ":fief_faction", "$g_talk_troop_faction"),
(try_begin),
# handle executing the King!
(faction_slot_eq, "$g_talk_troop_faction",
slot_faction_leader, "$g_talk_troop"),
# find best candidate to become king
(assign, ":best_troop", -1),
(assign, ":best_renown", -1),
(try_for_range, ":troop",
trp_kingdom_heroes_including_player_begin, trp_knight_6_20),
(neg|troop_slot_eq, ":troop", slot_troop_occupation,
slto_dead), #can't choose a dead hero!
(store_troop_faction, ":faction", ":troop"),
(eq, ":faction", "$g_talk_troop_faction"),
(troop_slot_eq, ":troop", slot_troop_occupation,
slto_kingdom_hero), #only other heros of this faction may
become the king
(troop_get_slot, ":renown", ":troop",
slot_troop_renown),
(gt, ":renown", ":best_renown"),
(assign, ":best_troop", ":troop"),
(assign, ":best_renown", ":renown"),
(try_end),
(try_begin),
# check if a candidate was found
(neq, ":best_troop", -1),
# make them king
(faction_set_slot, "$g_talk_troop_faction",
slot_faction_leader, ":best_troop"),
# announce it!
#TODO: generate a presentation for this!
(start_presentation, "prsnt_enemy_succession"),
(str_store_troop_name, s1, ":best_troop"),
(str_store_faction_name, s2, "$g_talk_troop_faction"),
(display_message, "@{s1} is the new King of the
{s2}!!!", 0xFFFF2222),
#TODO: update the game log for this event
(else_try),
# all of the lords have been eliminated - so eliminate
the faction by making their last fief neutral (q.v. trigger: #
Check if a faction is defeated every day)
(assign, ":fief_faction", "fac_no_faction"),
(try_end),
(try_end),
# free up the deceased's fief
(try_for_range, ":fief", centers_begin, centers_end),
(party_get_slot, ":lord", ":fief", slot_town_lord),
(eq, ":lord", "$g_talk_troop"),
(call_script, "script_give_center_to_faction", ":fief",
":fief_faction"),
(try_end),
# no longer our prisoner
(call_script, "script_remove_troop_from_prison",
"$g_talk_troop"),
(remove_troops_from_prisoners, "$g_talk_troop", 1),
]
],
################################################################
###################################
# End Prisoner Talk
################################################################
###################################
[/code]
Note: Search for prisoner_chat in module_dialogs. Simply erase
the two lines there, and paste these lines in where the Native
prisoner chat used to be.
Now: Search for slot_troop_kingsupport_objection_state = 145 in
module_constants. Put a line or two below it, then add these
lines underneath...
(Module Constants)
[code]####Mordechai EPC Begin
slto_dead = 146
slot_prisoner_agreed = 147
####Mordechai EPC End[/code]
Then add the final code below to module_scripts
(Module Scripts)
[code] #MORDACHAI - update whether the specified prisoner would
like to join the player's party
# script_determine_prisoner_agreed
# Input: arg1 = troop, arg2 = troop faction relation
# Output: slot_prisoner_agreed is set to 1 if they agreed, or
0 if not
# reg0 = agreed or not
("determine_prisoner_agreed",
[
(store_script_param, ":troop", 1),
(store_script_param, ":relation", 2),
# upper bound = Persuasion*3 + Charisma + Leadership*3 +
Honor/2 + Renown/100
(store_attribute_level, ":charisma", "trp_player",
ca_charisma),
(store_skill_level, ":persuasion", "skl_persuasion",
"trp_player"),
(store_skill_level, ":leadership", "skl_leadership",
"trp_player"),
(val_mul, ":persuasion", 3),
(val_mul, ":leadership", 3),
(store_div, ":half_honor", "$player_honor", 2),
(troop_get_slot, ":renown_factor", slot_troop_renown),
(val_div, ":renown_factor", 100),
(assign, ":upper_bound", ":persuasion"),
(val_add, ":upper_bound", ":leadership"),
(val_add, ":upper_bound", ":charisma"),
(val_add, ":upper_bound", ":half_honor"),
(val_add, ":upper_bound", ":renown_factor"),
(val_min, ":relation", ":upper_bound"),
# determine their reaction (relation...upper_bound)
(store_random_in_range, ":reaction", ":relation",
":upper_bound"),
(assign, reg1, ":reaction"),
(assign, reg2, ":relation"),
(assign, reg3, ":upper_bound"),
#(display_message, "@Prisoner Agrees Check: rolled a
{reg1} out of a possible {reg2}-{reg3}"),#diagnostic only
# record whether they agree or not
(try_begin),
(ge, ":reaction", 0),
(troop_set_slot, ":troop", slot_prisoner_agreed, 1),
(else_try),
(troop_set_slot, ":troop", slot_prisoner_agreed, 0),
(try_end),
# return the results
(troop_get_slot, reg0, ":troop", slot_prisoner_agreed),
#(display_message, "@Prisoner Agrees Check:
slot_prisoner_agreed = {reg0?yes:no}"),#diagnostic only
]
),[/code]
*****************************************************
You are viewing proxied material from gopher.createaforum.com. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.