For more: visit the main thread
Hey, in this thread I will present the Troop Tree Extended + NPC Reports OSP for VC.
Short description:
Based on Custom Commander and Brytenwalda Mod.
It adds the option to see a unit details page while visiting the troops tree screen (see pics below).
It also adds Relation Matrix by Windyplains and Characters Report by Jrider.
Code:
Download link: https://drive.google.com/file/d/0B_oc2ReDoxuuSENZVEhVdEdxekk/view?usp=sharing
(it requires WRECK)
Code:
#################################################################
### INJECT POINTS FOR PLUGINS ###
#################################################################
# PRESENTATIONS (module_presentations.py)
1) "character_screen_main"
(overlay_set_position, "$g_presentation_obj_2", 1),
inject('plugin_prst_world_map_new_button_load'),
(create_text_overlay, reg1, "@Name:_^{playername}", 16),
2) "character_screen_main"
(overlay_set_position, "$g_presentation_obj_11", 1),
# New button for heroes: vassals, kings, companions....
inject('plugin_prst_companions_button'),
(try_begin),
(eq, "$temp", 2),
3) "character_screen_main"
(call_script, "script_texto_courtship_relation"),
(start_presentation, "prsnt_character_screen_main"),
inject('plugin_prst_world_map_new_button_event'),
inject('plugin_prst_companions_button_event'),
(try_end),
4) "troop_tree": trigger -60 (load)
(overlay_set_position, "$presentation_leave_button", 1),
inject('plugin_prst_prstn_troop_tree_2'),
]),
5) "troop_tree": after ending of triggers to add mouse_over and mouse_click
]),
inject('plugin_prst_prstn_troop_tree_3'),
]),
6) "troop_tree": start of the presentation to change layout of slider
(presentation_set_duration, 999999),
(set_fixed_point_multiplier, 1000),
(create_text_overlay, reg1, "@Troop_Tree", 16),
(position_set_x, 1, 500),
(position_set_y, 1, 685),
(overlay_set_position, reg1, 1),
inject('plugin_prst_prstn_troop_tree_1a'), # hides old text
(create_text_overlay, reg1, "@From_Troop:_", 8),
(position_set_x, 1, 450),
(position_set_y, 1, 650),
inject('plugin_prst_prstn_troop_tree_1b'), # higher Y
(overlay_set_position, reg1, 1),
(create_combo_button_overlay, "$g_presentation_obj_sliders_1"),
(position_set_x, 1, 580),
(position_set_y, 1, 645),
inject('plugin_prst_prstn_troop_tree_1b'), # higher Y
(overlay_set_position, "$g_presentation_obj_sliders_1", 1),
# SCRIPTS (module_scripts.py)
1) "troop_tree_recurse"
("troop_tree_recurse", [
(store_script_param, ":local_1", 1), # troop_id
(store_script_param, ":local_2", 2), # center_x
(store_script_param, ":local_3", 3), # center_y
(store_script_param, ":local_4", 3), # parameter 4
# fix max height
inject('plugin_prst_script_troop_tree_recurse_1'), # after parameters
2) "troop_tree_recurse"
(create_mesh_overlay_with_tableau_material, reg1, -1, "tableau_troop_tree_pic", reg2),
# saves data to array
inject('plugin_prst_script_troop_tree_recurse_1'),
file: plugin_prst_troop_tree_extended.py
Code:
from compiler import *
register_plugin()
strings = [
("tte_click_for_details","{!}(Click on a unit for details)"),
("tte_click_for_details2","{!}Click for details"),
("tte_done","{!}Done"),
("tte_name_level","{!}Name: {s1}^Level: {reg1}"),
("tte_hp","{!}{s1}^HP: {reg0}"),
("tte_s1","{!}{s1}"),
("tte_attributes","{!}Attributes:"),
("tte_str_int_skills","{!}{s3}^STR: {reg1}^INT: {reg2}^^Skills:"),
("tte_list_skills","{!}{s3}^Power Strike: {reg1}^Power Draw: {reg2}^Power Throw: {reg3}^Horse Archery: {reg4}^^Weapon Proficiencies:"),
("tte_list_weapons_skills","{!}{s3}^1 Hand Wpns: {reg1}^2 Hand Wpns: {reg2}^Polearms: {reg3}"),
("tte_s3","{!}{s3}"),
("tte_agi_cha","{!}{s4}^AGI: {reg1}^CHA: {reg2}^^"),
("tte_list_skills2","{!}{s4}^Ironflesh: {reg1}^Athletics: {reg2}^Shield: {reg3}^Riding: {reg4}^^"),
("tte_list_weapons_skills_ranged","{!}{s4}^Archery: {reg1}^Crossbows: {reg2}^Throwing: {reg3}"),
("tte_s4","{!}{s4}"),
("tte_equipment","{!}Equipments: "),
]
injection = {
'plugin_prst_script_troop_tree_recurse_1' : [
# Fix height of pic
(val_min, "$troop_tree_pic_height", 272),
],
'plugin_prst_script_troop_tree_recurse_2' : [
# Plugin CODE START : saves data to array
(val_add, "$troop_tree_counter", 1),
(troop_set_slot, trp.temp_array_a, "$troop_tree_counter", reg1), # overlay id
(troop_set_slot, trp.temp_array_b, "$troop_tree_counter", ":local_1"), # troop_id
# Plugin CODE END
],
'plugin_prst_prstn_troop_tree_1a' : [
(overlay_set_display, reg1, 0),
(assign, "$troop_tree_counter", -1),
],
'plugin_prst_prstn_troop_tree_1b' : [
(position_set_y, 1, 700),
],
'plugin_prst_prstn_troop_tree_2' : [
# Alert that click opens detail
(create_text_overlay, reg1, s.tte_click_for_details, tf_right_align),
(position_set_x, 1, 950),
(position_set_y, 1, 25),
(overlay_set_position, reg1, 1),
(position_set_x, pos1, 1750/2),
(position_set_y, pos1, 1750/2),
(overlay_set_size, reg1, pos1),
(overlay_set_color, reg1, 0x0000FF),
],
'plugin_prst_prstn_troop_tree_3' : [
(-64.000, [ # mouse click
(store_trigger_param_1, ":object_id"),
(store_trigger_param_2, ":obj_value"),
(try_begin),
(assign, reg50, l.object_id),(assign, reg51, l.obj_value),
(assign, ":end_loop", 0),
(store_add, ":end_loop", "$troop_tree_counter", 1),
(try_for_range, ":slot_no", 0, ":end_loop"),
(troop_get_slot, l.aqui, trp.temp_array_a, l.slot_no),
(troop_slot_eq, trp.temp_array_a, ":slot_no", ":object_id"),
(troop_get_slot, ":troop_id", trp.temp_array_b, ":slot_no"),
(assign, "$temp_troop", ":troop_id"),
(assign, ":end_loop", 0),
(start_presentation, "prsnt_troop_note"),
(try_end),
(try_end),
]),
],
}
scripts = [
# rubik's CC scripts
("copy_inventory",
[
(store_script_param_1, ":source"),
(store_script_param_2, ":target_inv"),
(troop_clear_inventory, ":target_inv"),
(troop_get_inventory_capacity, ":inv_cap", ":source"),
(try_for_range, ":i_slot", 0, ":inv_cap"),
(troop_get_inventory_slot, ":item", ":source", ":i_slot"),
(troop_set_inventory_slot, ":target_inv", ":i_slot", ":item"),
(troop_get_inventory_slot_modifier, ":imod", ":source", ":i_slot"),
(troop_set_inventory_slot_modifier, ":target_inv", ":i_slot", ":imod"),
(troop_inventory_slot_get_item_amount, ":amount", ":source", ":i_slot"),
(gt, ":amount", 0),
(troop_inventory_slot_set_item_amount, ":target_inv", ":i_slot", ":amount"),
(try_end),
]),
("get_troop_max_hp",
[
(store_script_param_1, ":troop"),
(store_skill_level, ":skill", skl.ironflesh, ":troop"),
(store_attribute_level, ":attrib", ":troop", ca_strength),
(val_mul, ":skill", 2),
(val_add, ":skill", ":attrib"),
(val_add, ":skill", 35),
(assign, reg0, ":skill"),
]),
("prsnt_lines_to", # Drawing lines from (x1,y1) to (x2,y2), the line will be horizontal til half way, vertical and then horizontal again
[
(store_script_param, ":pos_x1", 1),
(store_script_param, ":pos_y1", 2),
(store_script_param, ":pos_x2", 3),
(store_script_param, ":pos_y2", 4),
(store_script_param, ":color", 5),
(try_begin),
(eq, ":pos_x1", ":pos_x2"),
(store_sub, ":size", ":pos_y1", ":pos_y2"),
(val_abs, ":size"),
(val_min, ":pos_y1", ":pos_y2"),
(call_script, "script_prsnt_lines", 4, ":size", ":pos_x1", ":pos_y1", ":color"),
(else_try),
(eq, ":pos_y1", ":pos_y2"),
(store_sub, ":size", ":pos_x1", ":pos_x2"),
(val_abs, ":size"),
(val_min, ":pos_x1", ":pos_x2"),
(call_script, "script_prsnt_lines", ":size", 5, ":pos_x1", ":pos_y1", ":color"),
(else_try),
(store_add, ":pos_x", ":pos_x1", ":pos_x2"), (val_div, ":pos_x", 2), (val_sub, ":pos_x", 6),
(call_script, "script_prsnt_lines_to", ":pos_x1", ":pos_y1", ":pos_x", ":pos_y1", ":color"),
(call_script, "script_prsnt_lines_to", ":pos_x", ":pos_y1", ":pos_x", ":pos_y2", ":color"),
(call_script, "script_prsnt_lines_to", ":pos_x", ":pos_y2", ":pos_x2", ":pos_y2", ":color"),
(try_end),
]),
("prsnt_lines",
[
(store_script_param, ":size_x", 1),
(store_script_param, ":size_y", 2),
(store_script_param, ":pos_x", 3),
(store_script_param, ":pos_y", 4),
(store_script_param, ":color", 5),
(create_mesh_overlay, reg1, mesh.white_plane),
(val_mul, ":size_x", 50),
(val_mul, ":size_y", 50),
(position_set_x, pos0, ":size_x"),
(position_set_y, pos0, ":size_y"),
(overlay_set_size, reg1, pos0),
(position_set_x, pos0, ":pos_x"),
(position_set_y, pos0, ":pos_y"),
(overlay_set_position, reg1, pos0),
(overlay_set_color, reg1, ":color"),
]),
]
presentations = [
#Custom Commander troop detail screen
("troop_note", 0, mesh.load_window, [
(ti_on_presentation_load,[
(presentation_set_duration, 999999),
(set_fixed_point_multiplier, 1000),
## init troop items
(call_script, "script_copy_inventory", "$temp_troop", trp.temp_array_a),
(try_for_range, ":i_slot", 0, 10),
(troop_get_inventory_slot, ":item", trp.temp_array_a, ":i_slot"),
(gt, ":item", -1),
(troop_add_item,trp.temp_array_a,":item"),
(troop_set_inventory_slot, trp.temp_array_a, ":i_slot", -1),
(try_end),
## back
(create_image_button_overlay, "$g_presentation_obj_1", mesh.used_button, mesh.used_button_down),
(position_set_x, pos1, 832),
(position_set_y, pos1, 36),
(overlay_set_position, "$g_presentation_obj_1", pos1),
## done
(create_text_overlay, reg1, s.tte_done, tf_center_justify|tf_vertical_align_center),
(position_set_x, pos1, 900),
(position_set_y, pos1, 50),
(overlay_set_position, reg1, pos1),
################
(store_mul, ":cur_troop", "$temp_troop", 2), #with weapons
(create_mesh_overlay_with_tableau_material, reg0, -1, "tableau_game_party_window", ":cur_troop"),
(position_set_x, pos1, 800),
(position_set_y, pos1, 800),
(overlay_set_size, reg0, pos1),
(position_set_x, pos1, 720+100),
(position_set_y, pos1, 450+50),
(overlay_set_position, reg0, pos1),
(str_store_troop_name, s1, "$temp_troop"),
(store_character_level, ":troop_level", "$temp_troop"),
(assign, reg1, ":troop_level"),
(str_store_string, s1, s.tte_name_level), #Name: {s1}^Level: {reg1}
(call_script, "script_get_troop_max_hp", "$temp_troop"),
(str_store_string, s1, s.tte_hp), #{s1}^HP: {reg0}
(create_text_overlay, reg0, s.tte_s1, tf_double_space), #{s1}
(position_set_x, pos1, 500),
(position_set_y, pos1, 500),
(overlay_set_position, reg0, pos1),
(str_store_string, s3, s.tte_attributes),
(store_attribute_level, reg1, "$temp_troop", ca_strength),
(store_attribute_level, reg2, "$temp_troop", ca_intelligence),
(str_store_string, s3, s.tte_str_int_skills), # {s3}^STR: {reg1}^INT: {reg2}^^Skills:
(store_skill_level, reg1, skl.power_strike, "$temp_troop"),
(store_skill_level, reg2, skl.power_draw, "$temp_troop"),
(store_skill_level, reg3, skl.power_throw, "$temp_troop"),
(store_skill_level, reg4, skl.horse_archery, "$temp_troop"),
(str_store_string, s3, s.tte_list_skills),
(store_proficiency_level, reg1, "$temp_troop", wpt_one_handed_weapon),
(store_proficiency_level, reg2, "$temp_troop", wpt_two_handed_weapon),
(store_proficiency_level, reg3, "$temp_troop", wpt_polearm),
(str_store_string, s3, s.tte_list_weapons_skills),
(create_text_overlay, reg0, s.tte_s3, tf_double_space),
(position_set_x, pos1, 500),
(position_set_y, pos1, 100),
(overlay_set_position, reg0, pos1),
(str_store_string, s4, "str_empty_string"),
(store_attribute_level, reg1, "$temp_troop", ca_agility),
(store_attribute_level, reg2, "$temp_troop", ca_charisma),
(str_store_string, s4, s.tte_agi_cha),
(store_skill_level, reg1, skl.ironflesh, "$temp_troop"),
(store_skill_level, reg2, skl.athletics, "$temp_troop"),
(store_skill_level, reg3, skl.shield, "$temp_troop"),
(store_skill_level, reg4, skl.riding, "$temp_troop"),
(str_store_string, s4, s.tte_list_skills2),
(store_proficiency_level, reg1, "$temp_troop", wpt_archery),
(store_proficiency_level, reg2, "$temp_troop", wpt_crossbow),
(store_proficiency_level, reg3, "$temp_troop", wpt_throwing),
(str_store_string, s4, s.tte_list_weapons_skills_ranged),
(create_text_overlay, reg0, s.tte_s4, tf_double_space),
(position_set_x, pos1, 710),
(position_set_y, pos1, 100),
(overlay_set_position, reg0, pos1),
################
(str_clear, s0),
(create_text_overlay, "$g_presentation_obj_2", s0, tf_scrollable),
(position_set_x, pos1, 50),
(position_set_y, pos1, 50),
(overlay_set_position, "$g_presentation_obj_2", pos1),
(position_set_x, pos1, 350),
(position_set_y, pos1, 560),
(overlay_set_area_size, "$g_presentation_obj_2", pos1),
(set_container_overlay, "$g_presentation_obj_2"),
(assign, ":pos_x", 0),
(assign, ":pos_y", 1840),
(assign, ":slot_no", 10),
(try_for_range, ":unused_height", 0, 24),
(try_for_range, ":unused_width", 0, 4),
(create_mesh_overlay, reg1, mesh.inv_slot),
(position_set_x, pos1, 800),
(position_set_y, pos1, 800),
(overlay_set_size, reg1, pos1),
(position_set_x, pos1, ":pos_x"),
(position_set_y, pos1, ":pos_y"),
(overlay_set_position, reg1, pos1),
(create_mesh_overlay, reg1, mesh.mp_inventory_choose),
(position_set_x, pos1, 640),
(position_set_y, pos1, 640),
(overlay_set_size, reg1, pos1),
(position_set_x, pos1, ":pos_x"),
(position_set_y, pos1, ":pos_y"),
(overlay_set_position, reg1, pos1),
(troop_set_slot, trp.temp_array_a, ":slot_no", reg1),
(troop_get_inventory_slot, ":item_no", trp.temp_array_a, ":slot_no"),
(try_begin),
(gt, ":item_no", -1),
(create_mesh_overlay_with_item_id, reg1, ":item_no"),
(position_set_x, pos1, 800),
(position_set_y, pos1, 800),
(overlay_set_size, reg1, pos1),
(store_add, ":item_x", ":pos_x", 40),
(store_add, ":item_y", ":pos_y", 40),
(position_set_x, pos1, ":item_x"),
(position_set_y, pos1, ":item_y"),
(overlay_set_position, reg1, pos1),
(troop_set_slot, trp.temp_array_b, ":slot_no", reg1),
(try_end),
(val_add, ":pos_x", 80),
(val_add, ":slot_no", 1),
(try_end),
(assign, ":pos_x", 0),
(val_sub, ":pos_y", 80),
(try_end),
(set_container_overlay, -1),
(create_text_overlay, reg1, s.tte_equipment, tf_vertical_align_center),
(position_set_x, pos1, 60),
(position_set_y, pos1, 635),
(overlay_set_position, reg1, pos1),
]),
(ti_on_presentation_mouse_enter_leave,
[
(store_trigger_param_1, ":object"),
(store_trigger_param_2, ":enter_leave"),
(try_begin),
(eq, ":enter_leave", 0),
(try_for_range, ":slot_no", 10, 106),
(troop_slot_eq, trp.temp_array_a, ":slot_no", ":object"),
(troop_get_inventory_slot, ":item_no", trp.temp_array_a, ":slot_no"),
(try_begin),
(gt, ":item_no", -1),
(troop_get_slot, ":target_obj", trp.temp_array_b, ":slot_no"),
(overlay_get_position, pos0, ":target_obj"),
(show_item_details, ":item_no", pos0, 100),
(assign, "$g_current_opened_item_details", ":slot_no"),
(try_end),
(try_end),
(else_try),
(try_for_range, ":slot_no", 10, 106),
(troop_slot_eq, trp.temp_array_a, ":slot_no", ":object"),
(try_begin),
(eq, "$g_current_opened_item_details", ":slot_no"),
(close_item_details),
(try_end),
(try_end),
(try_end),
]),
(ti_on_presentation_event_state_change,
[
(store_trigger_param_1, ":object"),
(try_begin),
(eq, ":object", "$g_presentation_obj_1"),
(start_presentation, "prsnt_troop_tree"),
(try_end),
]),
]),
]
How to install: pack with the presentations (mapnodes, troop tree, companions, ...)
1) Any player installing a mod must agree with the terms:
a) Player accepts risks with bugs
b) Player will not ask the dev team (VC) for help/support on mod features
a) Player accepts risks with bugs
b) Player will not ask the dev team (VC) for help/support on mod features
Steps:
1) You must have 1.04 installed
2) Copy your DLC folder: from modules/Viking Conquest to modules/VC_104_mod
3) Download this patch (it requires 7zip or similar): https://drive.google.com/file/d/0B_oc2ReDoxuuaFRuSFJJYy1XSkk/view?usp=sharing
4) Unzip the files inside your modules/VC_104_mod folder. Replace all files as requested.
5) Optional: you can copy your savegames to continue a game: go to your documents folder, find warband savegames, create a new folder VC_104_mod and copy the files to there
6) Start the game. Choose VC_104_mod as your module.
1) You must have 1.04 installed
2) Copy your DLC folder: from modules/Viking Conquest to modules/VC_104_mod
3) Download this patch (it requires 7zip or similar): https://drive.google.com/file/d/0B_oc2ReDoxuuaFRuSFJJYy1XSkk/view?usp=sharing
4) Unzip the files inside your modules/VC_104_mod folder. Replace all files as requested.
5) Optional: you can copy your savegames to continue a game: go to your documents folder, find warband savegames, create a new folder VC_104_mod and copy the files to there
6) Start the game. Choose VC_104_mod as your module.