OSP Kit SP Custom your own kingdom troops

Users who are viewing this thread

mskimizd

Sergeant at Arms
Hi,I have upgraded the the code, so you don't need to copy the code below, that is outdated.
You can download the new code here!


Hello,everyone. It's me again. This time, I bring another osp Custom Troop. I knew that many modders have writen such a script before.
But this time, I want to create a whole Custom system. You can custom attributes,proficiencies,skills,items,and names.
The code I posted is just the basicCustom Troop System. In my little mod, I used it as my own kingdom's troop. So there is some code about the how the troops related to the kingdom and lords haven't posted. Because I think every modder can decide where to use those troops, not just the kingdom troop.
You can download here. Include some material needed.

Sorry for those old picture. I forgot to get some new picture.Maybe next time.
[Moderator] Earendil: Picture links have been broken




Some missed script
Code:
("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"), ]),

("prsnt_upgrade_tree_troop_and_name",
[(store_script_param, ":troop_no", 1),
  (store_script_param, ":pos_x", 2),
  (store_script_param, ":pos_y", 3),
  (store_script_param, ":slot_no", 4),

  (str_store_troop_name, s1, ":troop_no"),
  (create_text_overlay, reg1, "@{s1}", tf_center_justify|tf_vertical_align_center),
  (position_set_x, pos1, smaller_size),
  (position_set_y, pos1, smaller_size),
  (overlay_set_size, reg1, pos1),
  (position_set_x, pos1, ":pos_x"),
  (position_set_y, pos1, ":pos_y"),
  (overlay_set_position, reg1, pos1),
  (val_sub, ":pos_x", 52), # adjusted from 65
  #(val_add, ":pos_y", 5), # adjusted from 10
  (store_mul, ":cur_troop", ":troop_no", 2), #with weapons
  (create_image_button_overlay_with_tableau_material, reg1, -1, "tableau_game_party_window", ":cur_troop"),
  (position_set_x, pos1, troop_tree_size_x),
  (position_set_y, pos1, troop_tree_size_y),
  (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_set_slot, "trp_temp_array_b", ":slot_no", ":troop_no"),
  ]),

[Moderator] Earendil: Updated downloadlink
 
Last edited by a moderator:
Here is the code, if someting miss or the codes don't work, please tell me~ :grin:

module_constant.py
Code:
##Here are some needed slots, you can put it anywhere in module_constants.py.
##Recommend to put it on the top of the file below the comment or at the end.
##Pay attention to the slot number like 303,304.....make sure there is no same type's slot has the same number.

## ZZ Custom Kingdom Troop begin
slot_item_difficulty                = 101 
slot_item_weight                    = 102 
slot_item_price                     = 103 
slot_custom_troop_wage              = 303 
slot_custom_troop_weight            = 304 
slot_custom_troop_ap                = 305 
slot_custom_troop_sp                = 306 
slot_custom_troop_wp                = 307 

custom_troop_begin = "trp_kingdom_recruit"
custom_troop_end = "trp_array_a"
## ZZ Custom Kingdom Troop end

module_factions.py
Code:
## Recommend to put it at the end of the file before "]"
## Useless, just to store the troop's name.

## ZZ Custom Kingdom Troop begin 
  ("troop_name_temp_1",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_2",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_3",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_4",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_5",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_6",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_7",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_8",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_9",  "{!}", 0, 0.9, [], []),
  ("troop_name_temp_10",  "{!}", 0, 0.9, [], []), 
## ZZ Custom Kingdom Troop end

module_meshs.py
Code:
  ## Some meshes used for designing the interface.
  ## put it anywehere in this file. Recommend the end.
  
  ## ZZ Custom Kingdom Troop begin
  ("troop_info_win_1", 0, "troop_info_win_1", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("troop_info_win_2", 0, "troop_info_win_2", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("button1_up", 0, "button1_up", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("button1_down", 0, "button1_down", 0, 0, 0, 0, 0, 0, 1, 1, 1),  
  ## ZZ Custom Kingdom Troop end

module_game_menus.py
Code:
## Add to any menu. Let you can design your kingdom's troop.
## For example: 
## I put it on camp_action menu
  ("camp_action",0,
   "Choose an action:",
   "none",
   [
     ],
    [
    
       ......
       ......
       
## ZZ Custom Kingdom Troop begin
      ("action_promote_kingdom_custom_troop",
       [
         (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_active),
         (faction_slot_eq, "fac_player_supporters_faction", slot_faction_leader, "trp_player"),
         ],"Promote your kingdom custom troop.",
       [(start_presentation, "prsnt_custom_kingdom_troop"), 
        ]
       ),	   
## ZZ Custom Kingdom Troop end

       ......
       ......
       ]),

module_troops.py
Code:
## ZZ Custom Kingdom Troop begin
  ["kingdom_recruit","Kingdom Recruit","Kingdom Recruits",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(4),wp(0),knows_common,swadian_face_younger_1, swadian_face_middle_2],#420 #2
  ["kingdom_militia","Kingdom Militia","Kingdom Militia",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(9),wp(0),knows_common,swadian_face_young_1, swadian_face_old_2],#525 #3
  ["kingdom_footman","Kingdom Footman","Kingdom Footmen",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(14),wp(0),knows_common,swadian_face_young_1, swadian_face_old_2],#600 #10
  ["kingdom_infantry","Kingdom Infantry","Kingdom Infantries",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(20),wp(0),knows_common,swadian_face_middle_1, swadian_face_old_2],#740 #14
  ["kingdom_sergeant","Kingdom Sergeant","Kingdom Sergeants",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(25),wp(0),knows_common,swadian_face_middle_1, swadian_face_older_2],#900 #20
  ["kingdom_skirmisher","Kingdom Skirmisher","Kingdom Skirmishers",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(14),wp(0),knows_common,swadian_face_young_1, swadian_face_middle_2],#600 #10
  ["kingdom_crossbowman","Kingdom Crossbowman","Kingdom Crossbowmen",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(20),wp(0),knows_common,swadian_face_young_1, swadian_face_old_2],#740 #14
  ["kingdom_sharpshooter","Kingdom Sharpshooter","Kingdom Sharpshooters",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(25),wp(0),knows_common,swadian_face_middle_1, swadian_face_older_2],#900 #20
  ["kingdom_man_at_arms","Kingdom Man at Arms","Kingdom Men at Arms",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(20),wp(0),knows_common,swadian_face_middle_1, swadian_face_old_2],#740 #14
  ["kingdom_knight","Kingdom Knight","Kingdom Knights",tf_guarantee_all,0,0,fac_neutral,[],def_attrib|level(25),wp(0),knows_common,swadian_face_middle_1, swadian_face_older_2], #900 #20  

  ["array_a","{!}temp_array_a","{!}temp_array_a",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_common, 0],
  ["array_b","{!}temp_array_b","{!}temp_array_b",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_common, 0],
  ["array_c","{!}temp_array_c","{!}temp_array_c",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_common, 0],
  ["array_d","{!}temp_array_d","{!}temp_array_d",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_common, 0],

  ["kingdom_inventory","{!}na","{!}na",0,0,0,fac_neutral,[itm_velvet],def_attrib|level(1),wp(60),knows_common|knows_inventory_management_10,swadian_face_middle_1, swadian_face_older_2],
  ["copy_inventory","{!}copy_inventory","{!}copy_inventory",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[],def_attrib|level(18),wp(60),knows_common|knows_inventory_management_10, 0],

## ZZ Custom Kingdom Troop end

module_simple_triggers.py
Code:
## ZZ Custom Kingdom Troop begin
  (0,
    [
      (map_free),
      (troop_get_inventory_slot, ":item", "trp_kingdom_inventory", 10),
      (eq,":item","itm_velvet"), 
      (try_for_range, ":troop", custom_troop_begin,  custom_troop_end),
		(store_sub,":slot_offset",":troop",custom_troop_begin),	
		(val_mul,":slot_offset",10),	
		(try_for_range, ":i_slot", 0, 9),
			(store_add,":slot_no",":i_slot",":slot_offset"),		
			(troop_get_slot,":item", "trp_kingdom_inventory", ":slot_no"),
			(gt,":item",0),
			(troop_set_inventory_slot,":troop", ":i_slot",":item"),
		(try_end),
	  (try_end),
      (try_for_range, ":troop", custom_troop_begin,  custom_troop_end),
          (store_sub,":offset",":troop","trp_kingdom_recruit"),
          (store_add,":faction_troop_name","fac_troop_name_temp_1",":offset"),
          (str_store_faction_name,s2,":faction_troop_name"),
	  (troop_set_name, ":troop", s2),
	  (troop_set_plural_name, ":troop", s2),
	  (try_end),      
      (troop_clear_inventory, "trp_kingdom_inventory"),
    ]
  ),
## ZZ Custom Kingdom Troop end

module_strings.py
Code:
## ZZ Custom Kingdom Troop begin
("firearm", "Firearm: {reg35}"),  
("throwing", "Throwing: {reg34}"),
("crossbow", "Crossbow: {reg33}"),  
("archery", "Archery: {reg32}"),
("polearm", "Polearm: {reg31}"),
("two_handed_weapon", "Two Handed Weapon: {reg30}"),  
("one_handed_weapon", "One Handed Weapon: {reg29}"),
("trade", "Trade"),
("leadership", "Leadership"),
("prisoner_management", "Prisoner Management"),
("persuasion", "Persuasion"),
("engineer", "Engineer"),
("first_aid", "First Aid"),
("surgery", "Surgery"),
("wound_treatment", "Wound Treatment"),
("inventory_management", "Inventory Management"),
("spotting", "Spotting"),
("pathfinding", "Pathfinding"),
("tactics", "Tactics"),
("tracking", "Tracking"),
("trainer", "Trainer"),
("looting", "Looting"),
("horse_archery", "Horse Archery"),
("riding", "Riding"),
("athletics", "Athletics"),
("shield", "Shield"),
("weapon_master", "Weapon Master"),
("power_draw", "Power Draw"),
("power_throw", "Power Throw"),
("power_strike", "Power Strike"),
("ironflesh", "Ironflesh"),
("cha", "CHA: {reg4}"), 
("int", "INT: {reg3}"),
("agi", "AGI: {reg2}"),
("str", "STR: {reg1}"),

("reg5", "{reg5}"),
("reg6", "{reg6}"),
("reg7", "{reg7}"),
("reg8", "{reg8}"),
("reg9", "{reg9}"),
("reg10", "{reg10}"),
("reg11", "{reg11}"),
("reg12", "{reg12}"),
("reg13", "{reg13}"),
("reg14", "{reg14}"),
("reg15", "{reg15}"),
("reg16", "{reg16}"),
("reg17", "{reg17}"),
("reg18", "{reg18}"),
("reg19", "{reg19}"),
("reg20", "{reg20}"),
("reg21", "{reg21}"),
("reg22", "{reg22}"),
("reg23", "{reg23}"),
("reg24", "{reg24}"),
("reg25", "{reg25}"),
("reg26", "{reg26}"),
("reg27", "{reg27}"),
("reg28", "{reg28}"),
 
("explanation_strength", "Strength: Every point adds +1 ^to hit points.The following ^skills can not be developed beyond ^1/3 of Strength: ironflesh, ^Power-strike, Power-throw, ^Power-draw."), 
("explanation_agility", "Agility: Each point gives five ^weapon points and slightly ^increases movement speed. ^The following skills can not be ^developed beyond 1/3 of Agility: ^weapon-master, Shield, ^Athletics, Riding, Horse ^archery, Looting."),
("explanation_intelligence", "Intelligence: Every point to ^intelligence immediately gives one ^extra skill point. The following ^skills can not be developed beyond ^1/3 of Intelligence: Trainer, Tracking, ^Tactics, Path finding, Spotting, ^Inventory Management, Wound treatment, ^Surgery, First-aid, Engineer, Persuasion."),
("explanation_charisma", "Charisma: Each point increases ^your party size limit by +1. ^The following skills can not be ^developed beyond 1/3 of Charisma: ^Prisoner Management, Leadership, Trade."),
("explanation_ironflesh", "Each point to this skill increases ^hit points by +2. ^(Personal skill)"),
("explanation_power_strike", "Each point to this skill increases ^melee damage by 8%%. ^(Personal skill)"),
("explanation_power_throw", "Each point to this skill increases ^throwing damage by 10%%. ^(Personal skill)"),
("explanation_power_draw", "Lets character use more powerful bows. ^Each point to this skill ^(up to four plus power-draw requirement of the bow) ^increases bow damage by 14%%. ^(Personal skill)"),
("explanation_weapon_master", "Makes it easier to learn ^weapon proficiencies and increases ^the proficiency limits. Limits go as: ^60, 100, 140, 180, 220, 260, 300, 340, 380, 420. ^(Personal skill)"),
("explanation_shield", "Reduces damage to shields ^(by 8%% per skill level) and ^improves shield speed and coverage. ^(Personal skill)"),
("explanation_athletics", "Improves your running speed. ^(Personal skill)"),
("explanation_riding", "Enables you to ride horses of ^higher difficulty levels and increases ^your riding speed and manuever. ^(Personal skill)"),
("explanation_horse_archery", "Reduces damage and accuracy penalties ^for archery and throwing from horseback. ^(Personal skill)"),
("explanation_looting", "This skill increases the amount of ^loot obtained by 10%% per skill level. ^(Party skill)"),
("explanation_trainer", "Every day, each hero with this skill ^adds some experience to every other member ^of the party whose level is lower than his/hers. ^Experience gained goes as: ^{0,4,10,16,23,30,38,46,55,65,80}. ^(Personal skill)"),
("explanation_tracking", "Tracks become more informative. ^(Party skill)"),
("explanation_tactics", "Every two levels of this skill ^increases starting battle advantage by 1. ^(Party skill)"),
("explanation_pathfinding", "Party map speed is increased ^by 3%% per skill level. ^(Party skill)"),
("explanation_spotting", "Party seeing range is increased ^by 10%% per skill level. ^(Party skill)"),
("explanation_inventory_management", "Increases inventory capacity ^by +6 per skill level. ^(Leader skill)"),
("explanation_wound_treatment", "Party healing speed is increased ^by 20%% per level of this skill. ^(Party skill)"),
("explanation_surgery", "Each point to this skill ^gives a 4%% chance that ^a mortally struck party member ^will be wounded rather than killed. ^(Party skill)"),
("explanation_first_aid", "Heroes regain 5%% per skill level ^of hit-points lost during mission. ^(Party skill)"),
("explanation_engineer", "This skill allows you to ^construct siege equipment and ^fief improvements more efficiently. ^(Party skill)"),
("explanation_persuasion", "This skill helps you ^make other people accept your point of view. ^It also lowers the minimum level of relationship ^needed to get NPCs to do what you want. ^(Personal skill)"),
("explanation_prisoner_management", "Every level of this skill ^increases maximum number of prisoners by %d. ^(Leader skill)"),
("explanation_leadership", "Every point increases maximum number ^of troops you can command by 5, ^increases your party morale and ^reduces troop wages by 5%%. ^(Leader skill)"),
("explanation_trade", "Every level of this skill ^reduces your trade penalty by 5%%. ^(Party skill)"),
("explanation_one_handed_weapon", "Covers usage of one handed swords, ^axes and blunt weapons."),
("explanation_two_handed_weapon", "Covers usage of two handed swords, ^great axes and mauls."),
("explanation_polearm", "Covers usage of pole weapons like ^spears, lances, staffs, etc."),
("explanation_archery", "Covers usage of bows."),
("explanation_crossbow", "Covers usage of crossbows."),
("explanation_throwing", "Covers usage of thrown weapons like ^javelins, darts, stones etc."),
("explanation_firearms", "Covers usage of pistols and muskets."),

("skills_info", "Current:{reg36}^Base Attribute:{s10}"),
("troop_basic_info", "Level:{reg45}^Health:{reg46}^Experience:{reg47}^Next Level at:e{reg48}"),
#("custom_troop_info", "LEVEL:{reg36}^AGI:^INT:^CHA:"),
("end", "End"),
## ZZ Custom Kingdom Troop end
 
module_scripts.py
Code:
## This part should be put at the begining before scripts = [

## ZZ for presentations import begin
from header_presentations import *
## ZZ for presentations import end

## ZZ Custom Kingdom Troop begin
## ZZ set_item_detial, include : difficulty, weight and price
from module_items import *
def set_item_detial():
  set_item_detial = []
  for i_item in xrange(len(items)):
    set_item_detial.append((item_set_slot, i_item, slot_item_difficulty, get_difficulty(items[i_item][6])))
    set_item_detial.append((item_set_slot, i_item, slot_item_weight, get_weight(items[i_item][6])))	
    set_item_detial.append((item_set_slot, i_item, slot_item_price, items[i_item][5]))		
  return set_item_detial[:]
## ZZ set_item_detial
## ZZ Custom Kingdom Troop end

## This part should be put in the script game_start
## ZZ Custom Kingdom Troop begin
(call_script,"script_item_detial"), ## Initialize the item detial
(call_script,"script_set_custom_troop_pionts_initialization"), ## Initialize custom troops' points
## ZZ Custom Kingdom Troop end

## This part should be put in the script game_get_troop_wage
## Like this:
		......
		......
## ZZ Custom Kingdom Troop begin
## ZZ custom troop wage
## Except the base wage, for custom troop, the price of the equiment will add to wage after cacualation
      (try_begin), 
        (is_between, ":troop_id", custom_troop_begin, custom_troop_end),
		(troop_get_slot, ":total_price", ":troop_id", slot_custom_troop_wage),
        (val_mul, ":total_price", 5),
        (val_div, ":total_price", 1000),
		(val_add,":wage",":total_price"),
      (try_end),
## ZZ Custom Kingdom Troop end

      (assign, reg0, ":wage"),
      (set_trigger_result, reg0),
      ]),
      
 
## This part should be put in the script game_get_upgrade_cost
## Like this:
		......
		......
	  ## ZZ Custom Kingdom Troop begin
	  ## ZZ custom troop upgrade cost also will be effected by the price of the equipment
            (troop_get_upgrade_troop, ":upgrade_troop", ":troop_id"),
      (try_begin),		
		(is_between, ":upgrade_troop", custom_troop_begin, custom_troop_end),
		(troop_get_slot, ":total_price",":upgrade_troop", slot_custom_troop_wage),	
		(store_div,":upgrade_cost_modify",":total_price",100),
		(val_add,reg0,":upgrade_cost_modify"),
      (try_end),
	  ## ZZ Custom Kingdom Troop end	
	  
	  (set_trigger_result, reg0),
  ]),
  
## You can put Those script at the end of the file before "]" 
## ZZ Custom Kingdom troop begin
## ZZ script_get_custom_troop_info 
## get the troop info
# Input: none
# Output: none
("get_custom_troop_info", 
[
        (str_store_troop_name,s2,"$temp_troop"),
		(store_attribute_level,reg1,"$temp_troop",ca_strength),
		(store_attribute_level,reg2,"$temp_troop",ca_agility),
		(store_attribute_level,reg3,"$temp_troop",ca_intelligence),
		(store_attribute_level,reg4,"$temp_troop",ca_charisma),
		(store_skill_level ,reg5,skl_ironflesh,"$temp_troop"),
		(store_skill_level ,reg6,skl_power_strike,"$temp_troop"),
		(store_skill_level ,reg7,skl_power_throw,"$temp_troop"),
		(store_skill_level ,reg8,skl_power_draw,"$temp_troop"),
		(store_skill_level ,reg9,skl_weapon_master,"$temp_troop"),
		(store_skill_level ,reg10,skl_shield,"$temp_troop"),
		(store_skill_level ,reg11,skl_athletics,"$temp_troop"),
		(store_skill_level ,reg12,skl_riding,"$temp_troop"),
		(store_skill_level ,reg13,skl_horse_archery,"$temp_troop"),
		(store_skill_level ,reg14,skl_looting,"$temp_troop"),
		(store_skill_level ,reg15,skl_trainer,"$temp_troop"),
		(store_skill_level ,reg16,skl_tracking,"$temp_troop"),
		(store_skill_level ,reg17,skl_tactics,"$temp_troop"),
		(store_skill_level ,reg18,skl_pathfinding,"$temp_troop"),
		(store_skill_level ,reg19,skl_spotting,"$temp_troop"),
		(store_skill_level ,reg20,skl_inventory_management,"$temp_troop"),
		(store_skill_level ,reg21,skl_wound_treatment,"$temp_troop"),
		(store_skill_level ,reg22,skl_surgery,"$temp_troop"),
		(store_skill_level ,reg23,skl_first_aid,"$temp_troop"),
		(store_skill_level ,reg24,skl_engineer,"$temp_troop"),
		(store_skill_level ,reg25,skl_persuasion,"$temp_troop"),
		(store_skill_level ,reg26,skl_prisoner_management,"$temp_troop"),
		(store_skill_level ,reg27,skl_leadership,"$temp_troop"),
		(store_skill_level ,reg28,skl_trade,"$temp_troop"),
        (store_proficiency_level, reg29, "$temp_troop", wpt_one_handed_weapon),
        (store_proficiency_level, reg30, "$temp_troop", wpt_two_handed_weapon),
        (store_proficiency_level, reg31, "$temp_troop", wpt_polearm),
        (store_proficiency_level, reg32, "$temp_troop", wpt_archery),
        (store_proficiency_level, reg33, "$temp_troop", wpt_crossbow),
        (store_proficiency_level, reg34, "$temp_troop", wpt_throwing),
        (store_proficiency_level, reg35, "$temp_troop", wpt_firearm),
		(store_character_level,reg45,"$temp_troop"),
		(store_mul,":hp_part1",reg5,2),
		(store_add,":hp_part2",reg1,35),
		(store_add,":hp",reg1,":hp_part2",":hp_part1"),
		(assign,reg46,":hp"),
		(troop_get_xp,reg47,"$temp_troop"),	
]),

## script_store_custom_troop_info_to_slot
# Input: arrays_no (the slot troop)
# Output: none
("store_custom_troop_info_to_slot", 
[
	(store_script_param_1, ":arrays_no"),
	
		(troop_set_slot,":arrays_no",0,reg1),
		(troop_set_slot,":arrays_no",1,reg2),
		(troop_set_slot,":arrays_no",2,reg3),
		(troop_set_slot,":arrays_no",3,reg4),
		(troop_set_slot,":arrays_no",4,reg5),
		(troop_set_slot,":arrays_no",5,reg6),
		(troop_set_slot,":arrays_no",6,reg7),
		(troop_set_slot,":arrays_no",7,reg8),
		(troop_set_slot,":arrays_no",8,reg9),
		(troop_set_slot,":arrays_no",9,reg10),
		(troop_set_slot,":arrays_no",10,reg11),	
		(troop_set_slot,":arrays_no",11,reg12),
		(troop_set_slot,":arrays_no",12,reg13),
		(troop_set_slot,":arrays_no",13,reg14),
		(troop_set_slot,":arrays_no",14,reg15),
		(troop_set_slot,":arrays_no",15,reg16),
		(troop_set_slot,":arrays_no",16,reg17),
		(troop_set_slot,":arrays_no",17,reg18),
		(troop_set_slot,":arrays_no",18,reg19),
		(troop_set_slot,":arrays_no",19,reg20),
		(troop_set_slot,":arrays_no",20,reg21),
		(troop_set_slot,":arrays_no",21,reg22),
		(troop_set_slot,":arrays_no",22,reg23),
		(troop_set_slot,":arrays_no",23,reg24),
		(troop_set_slot,":arrays_no",24,reg25),
		(troop_set_slot,":arrays_no",25,reg26),
		(troop_set_slot,":arrays_no",26,reg27),
		(troop_set_slot,":arrays_no",27,reg28),
		(troop_set_slot,":arrays_no",28,reg29),
		(troop_set_slot,":arrays_no",29,reg30),
		(troop_set_slot,":arrays_no",30,reg31),
		(troop_set_slot,":arrays_no",31,reg32),
		(troop_set_slot,":arrays_no",32,reg33),
		(troop_set_slot,":arrays_no",33,reg34),
		(troop_set_slot,":arrays_no",34,reg35),
]),

## script_clear_array
# Input: none
# Output: none
("clear_array", 
[
	(try_for_range,":slot_no",0,1000),
		(troop_set_slot,"trp_array_a",":slot_no",0),
		(troop_set_slot,"trp_array_b",":slot_no",0),
		(troop_set_slot,"trp_array_c",":slot_no",0),		
		(troop_set_slot,"trp_array_d",":slot_no",0),
	(try_end),	
]),

## script_custom_troop_button_action
# Input: none
# Output: none
("custom_troop_button_action", 
[
	(store_script_param, ":no",1), # which object you press
	(store_script_param, ":state",2),#0 add,1 save,2 show or not
	(store_script_param, ":increment",3), 
	
	(try_begin),
		(eq,":no",0), ## 0
		(try_begin),
			(eq,":state",0),  ## add	
			(val_add,reg1,1), ## ca_strength add 1
			(val_sub,"$attribute_points",1), ## attribute points decrease 1
		(else_try),
			(eq,":state",1),  ## save	
			(troop_raise_attribute, "$temp_troop",ca_strength,":increment"), ## raise ":increment" attribute
		(else_try),
			(eq,":state",2),
			(try_begin),
				(this_or_next|ge,reg1,63), # means if the ca_strength is larger than 63 or no more attribute points the button will not show.
				(le,"$attribute_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1), ## this will be used in presentations to decide show or not
			(try_end),					
		(try_end),			
	(else_try),
		(eq,":no",1),
		(try_begin),
			(eq,":state",0),		
			(val_add,reg2,1),
			(val_sub,"$attribute_points",1),		
		(else_try),
			(eq,":state",1),		
			(troop_raise_attribute, "$temp_troop",ca_agility,":increment"),
		(else_try),
			(eq,":state",2),
			(try_begin),
				(this_or_next|ge,reg2,63),
				(le,"$attribute_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),			
	(else_try),
		(eq,":no",2),
		(try_begin),
			(eq,":state",0),
			(val_add,reg3,1),
			(val_sub,"$attribute_points",1),	
		(else_try),
			(eq,":state",1),		
			(troop_raise_attribute, "$temp_troop",ca_intelligence,":increment"),
		(else_try),
			(eq,":state",2),
			(try_begin),
				(this_or_next|ge,reg3,63),
				(le,"$attribute_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),			
	(else_try),
		(eq,":no",3),
		(try_begin),
			(eq,":state",0),		
			(val_add,reg4,1),
			(val_sub,"$attribute_points",1),		
		(else_try),
			(eq,":state",1),		
			(troop_raise_attribute, "$temp_troop",ca_charisma,":increment"),
		(else_try),
			(eq,":state",2),
			(try_begin),
				(this_or_next|ge,reg4,63),
				(le,"$attribute_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),				
	(else_try),
		(eq,":no",4),
		(try_begin),
			(eq,":state",0),		
			(val_add,reg5,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_ironflesh,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg1,3),		
			(try_begin),
				(this_or_next|ge,reg5,10),
				(this_or_next|ge,reg5,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),				
	(else_try),
		(eq,":no",5),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg6,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_power_strike,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg1,3),		
			(try_begin),
				(this_or_next|ge,reg6,10),
				(this_or_next|ge,reg6,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",6),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg7,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_power_throw,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg1,3),		
			(try_begin),
				(this_or_next|ge,reg7,10),
				(this_or_next|ge,reg7,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",7),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg8,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_power_draw,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg1,3),		
			(try_begin),
				(this_or_next|ge,reg8,10),
				(this_or_next|ge,reg8,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",8),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg9,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_weapon_master,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg2,3),		
			(try_begin),
				(this_or_next|ge,reg9,10),
				(this_or_next|ge,reg9,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",9),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg10,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_shield,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg2,3),		
			(try_begin),
				(this_or_next|ge,reg10,10),
				(this_or_next|ge,reg10,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",10),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg11,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_athletics,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg2,3),		
			(try_begin),
				(this_or_next|ge,reg11,10),
				(this_or_next|ge,reg11,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),				
		(try_end),	
	(else_try),
		(eq,":no",11),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg12,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_riding,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg2,3),		
			(try_begin),
				(this_or_next|ge,reg12,10),
				(this_or_next|ge,reg12,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",12),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg13,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_horse_archery,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg2,3),		
			(try_begin),
				(this_or_next|ge,reg13,10),
				(this_or_next|ge,reg13,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",13),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg14,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_looting,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg2,3),		
			(try_begin),
				(this_or_next|ge,reg14,10),
				(this_or_next|ge,reg14,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",14),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg15,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_trainer,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg15,10),
				(this_or_next|ge,reg15,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",15),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg16,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_tracking,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg16,10),
				(this_or_next|ge,reg16,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",16),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg17,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_tactics,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg17,10),
				(this_or_next|ge,reg17,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",17),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg18,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_pathfinding,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg18,10),
				(this_or_next|ge,reg18,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",18),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg19,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_spotting,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg19,10),
				(this_or_next|ge,reg19,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",19),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg20,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_inventory_management,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg20,10),
				(this_or_next|ge,reg20,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",20),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg21,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_wound_treatment,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg21,10),
				(this_or_next|ge,reg21,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),		
	(else_try),
		(eq,":no",21),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg22,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_surgery,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg22,10),
				(this_or_next|ge,reg22,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",22),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg23,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_first_aid,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg23,10),
				(this_or_next|ge,reg23,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",23),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg24,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_engineer,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg24,10),
				(this_or_next|ge,reg24,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",24),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg25,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_persuasion,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg3,3),		
			(try_begin),
				(this_or_next|ge,reg25,10),
				(this_or_next|ge,reg25,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),	
	(else_try),
		(eq,":no",25),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg26,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_prisoner_management,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg4,3),		
			(try_begin),
				(this_or_next|ge,reg26,10),
				(this_or_next|ge,reg26,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),		
	(else_try),
		(eq,":no",26),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg27,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_leadership,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg4,3),		
			(try_begin),
				(this_or_next|ge,reg27,10),
				(this_or_next|ge,reg27,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),				
		(try_end),
	(else_try),
		(eq,":no",27),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg28,1),
			(val_sub,"$skill_points",1),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_skill, "$temp_troop",skl_trade,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_div,":limits",reg4,3),		
			(try_begin),
				(this_or_next|ge,reg28,10),
				(this_or_next|ge,reg28,":limits"),				
				(le,"$skill_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),				
		(try_end),
	(else_try),
		(eq,":no",28),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg29,10),
			(val_sub,"$weapon_points",10),			
		(else_try),
			(eq,":state",1),		
			(troop_raise_proficiency_linear, "$temp_troop",wpt_one_handed_weapon,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_mul,":add",reg9,40),
			(store_add,":limits",60,":add"),
			(try_begin),
				(le,"$weapon_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(else_try),					
				(lt,reg9,10),
				(ge,reg29,":limits"),				
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),				
		(try_end),
	(else_try),
		(eq,":no",29),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg30,10),
			(val_sub,"$weapon_points",10),				
		(else_try),
			(eq,":state",1),		
			(troop_raise_proficiency_linear, "$temp_troop",wpt_two_handed_weapon,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_mul,":add",reg9,40),
			(store_add,":limits",60,":add"),
			(try_begin),
				(le,"$weapon_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(else_try),					
				(lt,reg9,10),
				(ge,reg30,":limits"),				
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),		
		(try_end),
	(else_try),
		(eq,":no",30),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg31,10),
			(val_sub,"$weapon_points",10),				
		(else_try),
			(eq,":state",1),		
			(troop_raise_proficiency_linear, "$temp_troop",wpt_polearm,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_mul,":add",reg9,40),
			(store_add,":limits",60,":add"),
			(try_begin),
				(le,"$weapon_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(else_try),					
				(lt,reg9,10),
				(ge,reg31,":limits"),				
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",31),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg32,10),
			(val_sub,"$weapon_points",10),				
		(else_try),
			(eq,":state",1),		
			(troop_raise_proficiency_linear, "$temp_troop",wpt_archery,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_mul,":add",reg9,40),
			(store_add,":limits",60,":add"),
			(try_begin),
				(le,"$weapon_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(else_try),					
				(lt,reg9,10),
				(ge,reg32,":limits"),				
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),			
		(try_end),
	(else_try),
		(eq,":no",32),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg33,10),
			(val_sub,"$weapon_points",10),				
		(else_try),
			(eq,":state",1),		
			(troop_raise_proficiency_linear, "$temp_troop",wpt_crossbow,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_mul,":add",reg9,40),
			(store_add,":limits",60,":add"),
			(try_begin),
				(le,"$weapon_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(else_try),					
				(lt,reg9,10),
				(ge,reg33,":limits"),				
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),				
		(try_end),
	(else_try),
		(eq,":no",33),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg34,10),
			(val_sub,"$weapon_points",10),				
		(else_try),
			(eq,":state",1),		
			(troop_raise_proficiency_linear, "$temp_troop",wpt_throwing,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_mul,":add",reg9,40),
			(store_add,":limits",60,":add"),
			(try_begin),
				(le,"$weapon_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(else_try),					
				(lt,reg9,10),
				(ge,reg34,":limits"),				
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),				
		(try_end),
	(else_try),
		(eq,":no",34),
		(try_begin),
			(eq,":state",0),			
			(val_add,reg35,10),
			(val_sub,"$weapon_points",10),				
		(else_try),
			(eq,":state",1),		
			(troop_raise_proficiency_linear, "$temp_troop",wpt_firearm,":increment"),
		(else_try),			
			(eq,":state",2),
			(store_mul,":add",reg9,40),
			(store_add,":limits",60,":add"),
			(try_begin),
				(le,"$weapon_points",0),
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(else_try),					
				(lt,reg9,10),
				(ge,reg35,":limits"),				
				(store_add,":slot_no",":no",300),
				(troop_set_slot,"trp_array_a",":slot_no",1),
			(try_end),				
		(try_end),
	(try_end),		
]),
## script_custom_troop_inventory_initialization
## Input: troop
## Output: none
  ("custom_troop_inventory_initialization", [ 
    (store_script_param_1, ":troop"),
	
    (try_for_range, ":i_slot", 0, 100), ## clear the slot
	  (troop_set_slot, "trp_array_d", ":i_slot", 0),
    (try_end),	
    (try_for_range, ":i_slot", 0, 10),	## put troop's equipment to slot twice, one is used as backups
      (troop_get_inventory_slot, ":item",":troop", ":i_slot"),	  
      (gt, ":item", 0),
	  (troop_set_slot, "trp_array_d", ":i_slot", ":item"), ## store
	  (store_add,":slot_offset",":i_slot",50),
	  (troop_set_slot, "trp_array_d", ":slot_offset", ":item"),	  ## backups
    (try_end),
  ]),
## script_custom_troop_inventory_reset
## Input: troop
## Output: none  
  ("custom_troop_inventory_reset", [ 
    (store_script_param_1, ":troop"),

    (try_for_range, ":i_slot", 0, 10), ## clear the slot and troop equipment inventory
	  (troop_set_slot, "trp_array_d", ":i_slot", 0),
      (troop_set_inventory_slot,":troop", ":i_slot",-1), 	  
    (try_end),
	
    (try_for_range, ":i_slot", 0, 10), ## get the backips to put in troop's equipment inventory and slot.
	  (store_add,":slot_offset",":i_slot",50),	
	  (troop_get_slot, ":item", "trp_array_d", ":slot_offset"),
      (gt, ":item", 0),	  
      (troop_set_inventory_slot,":troop", ":i_slot",":item"), 
	  (troop_set_slot, "trp_array_d", ":i_slot", ":item"),	  
    (try_end),
  ]),  
## script_custom_troop_inventory_change
## Input: troop
## Output: none 
  ("custom_troop_inventory_change", [ 
    (store_script_param_1, ":troop"),
	
	(store_sub,":slot_offset",":troop","trp_kingdom_recruit"),
	(val_mul,":slot_offset",10),
    (try_for_range, ":i_slot", 0, 10), ## clear
      (troop_set_inventory_slot,":troop", ":i_slot",-1),
    (try_end),	  
    (try_for_range, ":i_slot", 0, 10), ## set
	  (troop_get_slot, ":item", "trp_array_d", ":i_slot"),
      (gt, ":item", 0),	  
      (troop_set_inventory_slot,":troop", ":i_slot",":item"),

	  ## change for save data
	  ## since when loading a save file, the equipment won't be saved ,so we need to save it in slot troop.
	  (store_add,":slot_no",":i_slot",":slot_offset"),
	  (troop_set_slot, "trp_kingdom_inventory", ":slot_no",":item"),
	  #(display_message,"@XXXXXXXXXXXXXXXXXXXXxxxx"),	  
	  ## change for save data	  
    (try_end),	
  ]),
## script_custom_troop_inventory_total_price
## Input: troop
## Output: total_price  
  ("custom_troop_inventory_total_price", [ 
    (store_script_param_1, ":troop"),
	
	(assign,":total_price",0),
    (try_for_range, ":i_slot", 0, 10),	
      (troop_get_inventory_slot, ":item",":troop", ":i_slot"),	  
      (gt, ":item", 0),
	  (item_get_slot, ":price", ":item", slot_item_price),
	  (val_add,":total_price",":price"),  
    (try_end),
	
    (assign,reg42,":total_price"),
	(troop_set_slot, ":troop", slot_custom_troop_wage, ":total_price"),	
  ]),  
## script_custom_troop_inventory_total_price
## Input: troop
## Output: total_weight   
  ("custom_troop_inventory_total_weight", [ 
    (store_script_param_1, ":troop"),
	
	(assign,":total_weight",0),	
    (try_for_range, ":i_slot", 0, 10),	
      (troop_get_inventory_slot, ":item",":troop", ":i_slot"),	  
      (gt, ":item", 0),
	  (item_get_slot, ":weight", ":item", slot_item_weight),
	  (val_add,":total_weight",":weight"),  
    (try_end),
	
    (assign,reg43,":total_weight"),
	(troop_set_slot, ":troop", slot_custom_troop_weight, ":total_weight"),	
  ]),
## script_custom_troop_inventory_total_price
## Input: item_no,item_slot(means position)
## Output: reg0 (can put or not)
  ("custom_troop_item_judge", [ 
    (store_script_param_1, ":item_no"),
    (store_script_param_2, ":item_slot"),

	(assign, ":right_place", 0),	
	(item_get_type,":item_type",":item_no"),
	(try_begin),
		(is_between,":item_slot",0,4),
        (this_or_next|eq, ":item_type", itp_type_one_handed_wpn),
		(this_or_next|eq, ":item_type", itp_type_two_handed_wpn),
		(this_or_next|eq, ":item_type", itp_type_polearm),
        (this_or_next|eq, ":item_type", itp_type_arrows),
        (this_or_next|eq, ":item_type", itp_type_bolts),
		(this_or_next|eq, ":item_type", itp_type_shield),
		(this_or_next|eq, ":item_type", itp_type_bow),
		(this_or_next|eq, ":item_type", itp_type_crossbow),
        (this_or_next|eq, ":item_type", itp_type_thrown),
		(this_or_next|eq, ":item_type", itp_type_pistol),
		(this_or_next|eq, ":item_type", itp_type_musket),
		(eq, ":item_type", itp_type_bullets),
		(assign, ":right_place", 1),
    (else_try),
        (eq, ":item_slot", 4), 
        (eq, ":item_type", itp_type_head_armor),
		(assign, ":right_place", 1),
    (else_try),
        (eq, ":item_slot", 5),
        (eq, ":item_type", itp_type_body_armor),
		(assign, ":right_place", 1),
    (else_try),
        (eq, ":item_slot", 6),
        (eq, ":item_type", itp_type_foot_armor),
		(assign, ":right_place", 1),
    (else_try),
        (eq, ":item_slot", 7),
        (eq, ":item_type", itp_type_hand_armor),
		(assign, ":right_place", 1),
    (else_try),
        (eq, ":item_slot", 8), 
        (eq, ":item_type", itp_type_horse),
		(assign, ":right_place", 1),
    (try_end),
	
	(call_script,"script_custom_troop_inventory_total_weight","$temp_troop"),
    (try_for_range, ":i_slot", 0, 9),	
      (troop_get_inventory_slot, ":item","$temp_troop", ":i_slot"),
	  (gt,":item",-1),	  
	  (eq,":i_slot",":item_slot"), 
	  ## if the position in whcih we put new equipment has original equipment existed
	  ## we need to reduce the original equipment's weight and then add the new one's weight.
	  (item_get_slot, ":weight", ":item", slot_item_weight),
	  (val_sub,reg43,":weight"),	  
    (try_end),	
	(item_get_slot, ":weight", "$current_item", slot_item_weight),
	(val_add,reg43,":weight"),
	(store_attribute_level,":strength_level","$temp_troop",ca_strength),
	(store_character_level,":character_level","$temp_troop"),
	(val_mul,":strength_level",2),
	(store_add,":weight_limits",":strength_level",":character_level"),
	(try_begin),
		(le,reg43,":weight_limits"),
		(assign, ":can_carry", 1),
    (else_try),	
		(assign, ":can_carry", 0),	
    (try_end),
	
	(store_and,reg0,":right_place",":can_carry"),	
  ]),  

## ZZ set_custom_troop_pionts_initialization
## Used for Custom Kingdom Troop
## According to their level to set the attribute point,skill point, weapon point.
## Input: None
## output: None
("set_custom_troop_pionts_initialization",[	  
	    (try_for_range, ":troop_no", custom_troop_begin, custom_troop_end),
			(store_character_level,":skill_point",":troop_no"),
			(troop_set_slot,  ":troop_no", slot_custom_troop_sp, ":skill_point"),			
		    (store_mul,":weapon_point",":skill_point",40),
			(troop_set_slot,  ":troop_no", slot_custom_troop_wp, ":weapon_point"),				
			(store_div,":attribute_point",":skill_point",3),
			(troop_set_slot,  ":troop_no", slot_custom_troop_ap, ":attribute_point"),	
		(try_end),
]),	  
  
## ZZ item_detial
  ("item_detial",set_item_detial()),

  
## ZZ Custom Kingdom Troop end
 
module_presentation.py
Code:
## ZZ custom_kingdom_troop_tree begin
  ("custom_kingdom_troop", 0, mesh_load_window, [
    (ti_on_presentation_load,
      [
        (presentation_set_duration, 999999),
        (set_fixed_point_multiplier, 1000),

	    #(call_script, "script_presentation_load"),		
        (str_store_faction_name, s7, "fac_player_supporters_faction"),
	    (create_text_overlay,"$g_presentation_obj_13","@ {s7} 's troop^ Design your own kingdom troop",tf_double_space|tf_with_outline),		
		(position_set_x, pos1, 110),
        (position_set_y, pos1, 600),
		(overlay_set_position, "$g_presentation_obj_13", pos1),
        (position_set_x, pos1, 1500),
        (position_set_y, pos1, 1500),
        (overlay_set_size, "$g_presentation_obj_13", pos1),
		(overlay_set_color, "$g_presentation_obj_13", 0x000033),

		
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_recruit", 115, 250,0),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_militia", 265, 250,1),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_footman", 415, 400,2),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_man_at_arms", 565, 500,3),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_knight", 715, 500,4),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_infantry", 565, 300,5),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_sergeant", 715, 300,6),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_skirmisher", 415, 100,7),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_crossbowman", 565, 100,8),
        (call_script, "script_prsnt_upgrade_tree_troop_and_name","trp_kingdom_sharpshooter", 715, 100,9),

        ## cost
        (call_script, "script_prsnt_upgrade_tree_troop_cost", "trp_kingdom_recruit", 195, 360),
        (call_script, "script_prsnt_upgrade_tree_troop_cost", "trp_kingdom_militia", 320, 360),
        (call_script, "script_prsnt_upgrade_tree_troop_cost", "trp_kingdom_footman", 470, 510),
        (call_script, "script_prsnt_upgrade_tree_troop_cost", "trp_kingdom_man_at_arms", 645, 610),
        (call_script, "script_prsnt_upgrade_tree_troop_cost", "trp_kingdom_infantry", 645, 410),
        (call_script, "script_prsnt_upgrade_tree_troop_cost", "trp_kingdom_skirmisher", 495, 210),
        (call_script, "script_prsnt_upgrade_tree_troop_cost", "trp_kingdom_crossbowman", 645, 210),
        ## cost

        ##### - lines
        (call_script, "script_prsnt_lines", 50, 4, 170, 340, 0),
        (call_script, "script_prsnt_lines", 25, 4, 320, 340, 0),
        (call_script, "script_prsnt_lines", 25, 4, 345, 490, 0),
        (call_script, "script_prsnt_lines", 25, 4, 345, 190, 0),
        (call_script, "script_prsnt_lines", 50, 4, 470, 190, 0),
        (call_script, "script_prsnt_lines", 25, 4, 470, 490, 0),
        (call_script, "script_prsnt_lines", 25, 4, 495, 590, 0),
        (call_script, "script_prsnt_lines", 25, 4, 495, 390, 0),
        ##### - lines

        ##### | lines
        (call_script, "script_prsnt_lines", 4, 304, 343, 190, 0),
        (call_script, "script_prsnt_lines", 4, 204, 493, 390, 0),
        ##### | lines

        (call_script, "script_prsnt_lines", 50, 4, 620, 190, 0),
        (call_script, "script_prsnt_lines", 50, 4, 620, 390, 0),
        (call_script, "script_prsnt_lines", 50, 4, 620, 590, 0),
      ]),
		
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),

        (try_for_range, ":slot_no", 0, 10),
          (troop_slot_eq, "trp_temp_array_a", ":slot_no", ":object"),
          (troop_get_slot, "$temp_troop", "trp_temp_array_b", ":slot_no"),
	      (call_script,"script_get_custom_troop_info"),
	      (call_script,"script_store_custom_troop_info_to_slot","trp_array_b"),

		  (troop_get_slot, ":skill_point", "$temp_troop", slot_custom_troop_sp),
	      (troop_get_slot, ":weapon_point",  "$temp_troop", slot_custom_troop_wp),
		  (troop_get_slot, ":attribute_point",  "$temp_troop", slot_custom_troop_ap),
		  (assign,"$skill_points",":skill_point"),
		  (assign,"$weapon_points",":weapon_point"),
		  (assign,"$attribute_points",":attribute_point"),
		  
          (start_presentation, "prsnt_custom_troop"),
        (try_end),
      ]),
	  
    (ti_on_presentation_run,
     [
      (set_fixed_point_multiplier, 1000),

	  #(call_script, "script_presentation_run"),	  

     (try_begin),
        (this_or_next|key_clicked, key_escape),
        (key_clicked, key_right_mouse_button),
        (presentation_set_duration, 0),
        (jump_to_menu, "mnu_camp_action"), 
      (try_end),]),	  
  ]),
## ZZ custom_kingdom_troop_tree end	
	
## ZZ custom_troop presentations begin
("custom_troop", prsntf_manual_end_only, mesh_troop_info_win_1, [
    (ti_on_presentation_load,
     [
      (set_fixed_point_multiplier, 1000),

	  #(call_script, "script_presentation_load"),
	  
        (store_mul, ":cur_troop", "$temp_troop", 2), #with weapons
		(create_image_button_overlay_with_tableau_material, "$g_presentation_credits_obj_1", -1, "tableau_game_party_window", ":cur_troop"),	
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_1", pos1),		
		(position_set_x, pos1, 0),
		(position_set_y, pos1, 355),
		(overlay_set_position, "$g_presentation_credits_obj_1", pos1),
		
		(str_store_string,s1,"@Attributes"),	
	    (create_text_overlay,"$g_presentation_credits_obj_2",s1,tf_left_align),
		(overlay_set_color, "$g_presentation_credits_obj_2", 0x000033),			
		(position_set_x, pos1, 80),
        (position_set_y, pos1, 240),
		(overlay_set_position, "$g_presentation_credits_obj_2", pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_2", pos1),
		
		(str_store_string,s1,"@Skills"),	
	    (create_text_overlay,"$g_presentation_credits_obj_3",s1,tf_left_align),
		(overlay_set_color, "$g_presentation_credits_obj_3", 0x003300),			
		(position_set_x, pos1, 400),
        (position_set_y, pos1, 510),
		(overlay_set_position, "$g_presentation_credits_obj_3", pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_3", pos1),

		(str_store_string,s1,"@Proficiencies"),	
	    (create_text_overlay,"$g_presentation_credits_obj_4",s1,tf_left_align),
		(overlay_set_color, "$g_presentation_credits_obj_4", 0x330000),			
		(position_set_x, pos1, 755),
        (position_set_y, pos1, 410),
		(overlay_set_position, "$g_presentation_credits_obj_4", pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_4", pos1),		

		(assign,reg40,"$attribute_points"),
		(assign,reg41,"$skill_points"),
		(assign,reg42,"$weapon_points"),
		
		(str_store_string,s1,"@Attribute points {reg40}"),	
	    (create_text_overlay,"$g_presentation_credits_obj_5",s1,tf_left_align),
		(overlay_set_color, "$g_presentation_credits_obj_5", 0x000033),			
		(position_set_x, pos1, 90),
        (position_set_y, pos1, 50),
		(overlay_set_position, "$g_presentation_credits_obj_5", pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_5", pos1),

		(str_store_string,s1,"@Skill points {reg41}"),	
	    (create_text_overlay,"$g_presentation_credits_obj_6",s1,tf_left_align),
		(overlay_set_color, "$g_presentation_credits_obj_6", 0x003300),			
		(position_set_x, pos1, 400),
        (position_set_y, pos1, 50),
		(overlay_set_position, "$g_presentation_credits_obj_6", pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_6", pos1),

		(str_store_string,s1,"@Weapon points {reg42}"),	
	    (create_text_overlay,"$g_presentation_credits_obj_7",s1,tf_left_align),
		(overlay_set_color, "$g_presentation_credits_obj_7", 0x330000),			
		(position_set_x, pos1, 750),
        (position_set_y, pos1, 100),
		(overlay_set_position, "$g_presentation_credits_obj_7", pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_7", pos1),

	    (create_text_overlay,"$g_presentation_credits_obj_8","str_troop_basic_info",tf_left_align),
		(overlay_set_color, "$g_presentation_credits_obj_8", 0x330000),			
		(position_set_x, pos1, 355),
        (position_set_y, pos1, 565),
		(overlay_set_position, "$g_presentation_credits_obj_8", pos1),
        (position_set_x, pos1, 1300),
        (position_set_y, pos1, 1300),
        (overlay_set_size, "$g_presentation_credits_obj_8", pos1),	

	    (create_text_box_overlay,"$g_presentation_credits_obj_9"),		
		(position_set_x, pos1, 462),
        (position_set_y, pos1, 700),
		(overlay_set_position, "$g_presentation_credits_obj_9", pos1),
        (position_set_x, pos1, 1300),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_credits_obj_9", pos1),		
		(str_store_troop_name_plural,s2,"$temp_troop"),
		(overlay_set_text,"$g_presentation_credits_obj_9",s2),
		
        (create_game_button_overlay, "$g_presentation_credits_obj_10", "@Save", 0),
        (position_set_x, pos1, 920),
        (position_set_y, pos1, 10),
        (overlay_set_position, "$g_presentation_credits_obj_10", pos1),
		
        (create_game_button_overlay, "$g_presentation_credits_obj_11", "@Reset", 0),
        (position_set_x, pos1, 760),
        (position_set_y, pos1, 10),
        (overlay_set_position, "$g_presentation_credits_obj_11", pos1),		
		
		(assign,":offset",0),
		(assign,":offset_2",0),		
		(assign,":pos_1_y",210),
		(assign,":pos_2_y",480),
		(assign,":pos_2_2_y",485),		
		(assign,":pos_3_y",370),		
		(position_set_x, pos1, 40),
		(position_set_x, pos2, 350),
		(position_set_x, pos3, 710),
		(position_set_x, pos4, 600),
		(position_set_x, pos5, 230),
		(position_set_x, pos6, 640),
		(position_set_x, pos7, 950),		
		(position_set_x, pos10, 850),
        (position_set_y, pos10, 850),
		(position_set_x, pos11, 1100),
        (position_set_y, pos11, 1100),
		(position_set_x, pos12, 300),
        (position_set_y, pos12, 300),
		(position_set_x, pos13, 200),
        (position_set_y, pos13, 200),		
		(try_for_range,":num",0,35),
			(store_sub, ":str_id", "str_str",  ":offset"),
			(str_store_string,s1,":str_id"),
			(val_add,":offset",1),
			(try_begin),
				(lt,":num",4),
				(position_set_y, pos1, ":pos_1_y"),
				(position_set_y, pos5, ":pos_1_y"),							
				(create_text_overlay,"$g_presentation_obj_20",s1,tf_left_align),
				(overlay_set_position, "$g_presentation_obj_20", pos1),
				(overlay_set_size, "$g_presentation_obj_20", pos11),				
				(overlay_set_color, "$g_presentation_obj_20", 0x000033),
				(store_add, ":num_2", ":num",  50),				
				(troop_set_slot,"trp_array_a",":num_2","$g_presentation_obj_20"),
				(create_image_button_overlay, "$g_presentation_obj_20","mesh_button1_up", "mesh_button1_down"),
				(overlay_set_position, "$g_presentation_obj_20", pos5),
				(overlay_set_size, "$g_presentation_obj_20", pos12),				
				(troop_set_slot,"trp_array_a",":num","$g_presentation_obj_20"),					
				(val_sub, ":pos_1_y",30),
			(else_try),
				(ge,":num",4),
				(lt,":num",28),				
				(store_add, ":str_id_2", "str_reg5",  ":offset_2"),
				(str_store_string,s2,":str_id_2"),
				(val_add,":offset_2",1),				
				(position_set_y, pos2,":pos_2_y"),
				(position_set_y, pos4,":pos_2_y"),
				(position_set_y, pos6,":pos_2_2_y"),				
				(create_text_overlay,"$g_presentation_obj_20",s1,tf_left_align),
				(overlay_set_position, "$g_presentation_obj_20", pos2),
				(overlay_set_size, "$g_presentation_obj_20", pos10),				
				(overlay_set_color, "$g_presentation_obj_20", 0x003300),
				(store_add, ":num_2", ":num",  50),					
				(troop_set_slot,"trp_array_a",":num_2","$g_presentation_obj_20"),
				(create_text_overlay,"$g_presentation_obj_20",s2,tf_left_align),	
				(overlay_set_position, "$g_presentation_obj_20", pos4),
				(overlay_set_size, "$g_presentation_obj_20", pos10),	
				(overlay_set_color, "$g_presentation_obj_20", 0x003300),
				(store_add, ":num_2", ":num",  100),				
				(troop_set_slot,"trp_array_a",":num_2","$g_presentation_obj_20"),
				(create_image_button_overlay, "$g_presentation_obj_20","mesh_button1_up", "mesh_button1_down"),
				(overlay_set_position, "$g_presentation_obj_20", pos6),
				(overlay_set_size, "$g_presentation_obj_20", pos13),			
				(troop_set_slot,"trp_array_a",":num","$g_presentation_obj_20"),				
				(val_sub, ":pos_2_y",17),	
				(val_sub, ":pos_2_2_y",17),					
			(else_try),
				(position_set_y, pos3,":pos_3_y"),
				(position_set_y, pos7,":pos_3_y"),				
				(create_text_overlay,"$g_presentation_obj_20",s1,tf_left_align),
				(overlay_set_position, "$g_presentation_obj_20", pos3),
				(overlay_set_size, "$g_presentation_obj_20", pos11),				
				(overlay_set_color, "$g_presentation_obj_20", 0x330000),
				(store_add, ":num_2", ":num",  50),				
				(troop_set_slot,"trp_array_a",":num_2","$g_presentation_obj_20"),
				(create_image_button_overlay, "$g_presentation_obj_20","mesh_button1_up", "mesh_button1_down"),
				(overlay_set_position, "$g_presentation_obj_20", pos7),
				(overlay_set_size, "$g_presentation_obj_20", pos12),			
				(troop_set_slot,"trp_array_a",":num","$g_presentation_obj_20"),				
				(val_sub, ":pos_3_y",30),				
			(try_end),
		(try_end),

		(try_for_range, ":num", 0,35),
			(store_add,":slot_no",":num",300),			
			(troop_set_slot,"trp_array_a",":slot_no",0),		
			(call_script,"script_custom_troop_button_action",":num",2,0),			
			(troop_get_slot,":show_or_hide","trp_array_a", ":slot_no"),
			(troop_get_slot,"$g_presentation_obj_20","trp_array_a", ":num"),			
			(try_begin),
				(eq,":show_or_hide",1),
				(overlay_set_display,"$g_presentation_obj_20",0),
			(try_end),
			(troop_set_slot,"trp_array_a",":num","$g_presentation_obj_20"),
			(troop_set_slot,"trp_array_a",":slot_no",0),				
		(try_end),
		
		(assign,":offset",0),
		(position_set_x, pos1, 960),
        (position_set_y, pos1, 565),
		(position_set_x, pos2, 800),
        (position_set_y, pos2, 800),		
		(try_for_range, ":num", 0,35),
			(store_add, ":str_id", "str_explanation_strength",  ":offset"),
			(str_store_string,s1,":str_id"),
			(val_add,":offset",1),
			(create_text_overlay,"$g_presentation_obj_20",s1,tf_right_align),
			(overlay_set_position, "$g_presentation_obj_20", pos1),
			(overlay_set_size, "$g_presentation_obj_20", pos2),
			(overlay_set_color, "$g_presentation_obj_20", 0x330000),			
			(overlay_set_display,"$g_presentation_obj_20",0),			
			(store_add, ":num_3", ":num",  150),				
			(troop_set_slot,"trp_array_a",":num_3","$g_presentation_obj_20"),
		(try_end),
		
		(assign,":offset",0),
		(position_set_x, pos1, 710),
        (position_set_y, pos1, 460),
		(position_set_x, pos2, 1000),
        (position_set_y, pos2, 1000),		
		(try_for_range, ":num", 4,28),
			(store_add, ":str_id", "str_reg5",  ":offset"),
			(str_store_string,s1,":str_id"),
			(val_add,":offset",1),
			(str_store_string,s2,"@Current:{s1}"),
			(try_begin),
				(gt,":num",24),
				(str_store_string,s3,"@{s2}^Base Attribute:CHA"),
			(else_try),
				(gt,":num",13),
				(str_store_string,s3,"@{s2}^Base Attribute:INT"),
			(else_try),
				(gt,":num",7),
				(str_store_string,s3,"@{s2}^Base Attribute:AGI"),
			(else_try),
				(str_store_string,s3,"@{s2}^Base Attribute:STR"),
			(try_end),				
			(create_text_overlay,"$g_presentation_obj_20",s3,tf_left_align),
			(overlay_set_position, "$g_presentation_obj_20", pos1),
			(overlay_set_size, "$g_presentation_obj_20", pos2),
			(overlay_set_color, "$g_presentation_obj_20", 0x330000),			
			(overlay_set_display,"$g_presentation_obj_20",0),			
			(store_add, ":num_4", ":num",  200),				
			(troop_set_slot,"trp_array_a",":num_4","$g_presentation_obj_20"),
		(try_end),		
		
      (presentation_set_duration, 999999),
     ]),
	 
      (ti_on_presentation_mouse_enter_leave,
       [(store_trigger_param_1, ":object"),
        (store_trigger_param_2, ":enter_leave"),

        (mouse_get_position, pos1),
        (position_get_x, ":pos_m_x", pos1),
		
		(try_begin),
			(eq, ":enter_leave", 0),
			(try_begin),
				(gt,":pos_m_x",700),
				(lt,":pos_m_x",950),			
				(try_for_range, ":num", 78,85),
					(troop_slot_eq, "trp_array_a", ":num", ":object"),
					(overlay_animate_to_color, ":object", 10, 0xFF0000),
					(store_add, ":num_3", ":num",  100),					
					(troop_get_slot,":str_obj","trp_array_a",":num_3"),
					(overlay_set_display,":str_obj",1),					
				(try_end),				
			(else_try),
				(gt,":pos_m_x",345),
				(lt,":pos_m_x",600),		
				(try_for_range, ":num", 54,78),
					(troop_slot_eq, "trp_array_a", ":num", ":object"),
					(overlay_animate_to_color, ":object", 10, 0x00FF00),
					(store_add, ":num_3", ":num",  100),					
					(troop_get_slot,":str_obj","trp_array_a",":num_3"),
					(overlay_set_display,":str_obj",1),	
					(store_add, ":num_4", ":num",  150),					
					(troop_get_slot,":str_obj","trp_array_a",":num_4"),
					(overlay_set_display,":str_obj",1),						
				(try_end),					
			(else_try),
				(gt,":pos_m_x",40),
				(lt,":pos_m_x",230),
				(eq, ":enter_leave", 0),			
				(try_for_range, ":num", 50,54),
					(troop_slot_eq, "trp_array_a", ":num", ":object"),
					(overlay_animate_to_color, ":object", 10, 0x0000FF),
					(store_add, ":num_3", ":num",  100),					
					(troop_get_slot,":str_obj","trp_array_a",":num_3"),
					(overlay_set_display,":str_obj",1),				
				(try_end),			
			(try_end),	
		(else_try),		
			(try_for_range, ":num", 78,85),
				(troop_slot_eq, "trp_array_a", ":num", ":object"),
				(overlay_animate_to_color, ":object", 10, 0x330000),
				(store_add, ":num_3", ":num",  100),					
				(troop_get_slot,":str_obj","trp_array_a",":num_3"),
				(overlay_set_display,":str_obj",0),				
			(try_end),
			(try_for_range, ":num", 54,78),
				(troop_slot_eq, "trp_array_a", ":num", ":object"),
				(overlay_animate_to_color, ":object", 10, 0x003300),
				(store_add, ":num_3", ":num",  100),					
				(troop_get_slot,":str_obj","trp_array_a",":num_3"),
				(overlay_set_display,":str_obj",0),
				(store_add, ":num_4", ":num",  150),					
				(troop_get_slot,":str_obj","trp_array_a",":num_4"),
				(overlay_set_display,":str_obj",0),					
			(try_end),
			(try_for_range, ":num", 50,54),
				(troop_slot_eq, "trp_array_a", ":num", ":object"),
				(overlay_animate_to_color, ":object", 10, 0x000033),
				(store_add, ":num_3", ":num",  100),					
				(troop_get_slot,":str_obj","trp_array_a",":num_3"),
				(overlay_set_display,":str_obj",0),				
			(try_end),			
        (try_end),
        ]),	

    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),

				(assign,reg50,0),
				(assign,reg51,0),
		
		(try_for_range, ":num", 0,35),
			(troop_slot_eq, "trp_array_a", ":num", ":object"),
			(call_script,"script_custom_troop_button_action",":num",0,0),
            (start_presentation, "prsnt_custom_troop"),			
		(try_end),
		
		(try_begin),
			(eq,":object","$g_presentation_credits_obj_10"),
			(call_script,"script_store_custom_troop_info_to_slot","trp_array_c"),			
			(try_for_range,":num",0,35),
				(troop_get_slot,":original_num","trp_array_b",":num"),
				(troop_get_slot,":current_num","trp_array_c",":num"),
				#(assign,reg50,":original_num"),
				#(assign,reg51,":current_num"),
				#(display_message,"@original_num:{reg50},current_num:{reg51}"),
				(try_begin),
					(gt,":current_num",":original_num"),
					(store_sub,":increment",":current_num",":original_num"),
					(call_script,"script_custom_troop_button_action",":num",1,":increment"),
				(try_end),
			(try_end),
			(call_script,"script_store_custom_troop_info_to_slot","trp_array_b"),

		    (troop_set_slot,"$temp_troop", slot_custom_troop_sp,"$skill_points"),
	        (troop_set_slot,"$temp_troop", slot_custom_troop_wp,"$weapon_points"),
		    (troop_set_slot,"$temp_troop", slot_custom_troop_ap,"$attribute_points"),
			
		(else_try),	
			(eq,":object","$g_presentation_credits_obj_9"),	
			(str_store_string,s2,s0),
			(troop_set_name, "$temp_troop", s2),
			(troop_set_plural_name, "$temp_troop", s2),
                        (store_sub,":offset","$temp_troop","trp_kingdom_recruit"),
                        (store_add,":faction_troop_name","fac_troop_name_temp_1",":offset"),
                        (faction_set_name,":faction_troop_name",s2),
		(else_try),	
			(eq,":object","$g_presentation_credits_obj_11"),

			(call_script,"script_get_custom_troop_info"),
			(call_script,"script_store_custom_troop_info_to_slot","trp_array_b"),			
			
		    (troop_get_slot, ":skill_point", "$temp_troop", slot_custom_troop_sp),
	        (troop_get_slot, ":weapon_point",  "$temp_troop", slot_custom_troop_wp),
		    (troop_get_slot, ":attribute_point",  "$temp_troop", slot_custom_troop_ap),
		    (assign,"$skill_points",":skill_point"),
		    (assign,"$weapon_points",":weapon_point"),
		    (assign,"$attribute_points",":attribute_point"),
			
            (start_presentation, "prsnt_custom_troop"),	
		(else_try),	
			(eq,":object","$g_presentation_credits_obj_1"),
			(assign,"$current_item",-1),		
			(call_script,"script_custom_troop_inventory_initialization","$temp_troop"),			
			(start_presentation, "prsnt_custom_troop_item"),			
		(try_end),
    ]),		
	 
    (ti_on_presentation_run,
     [
      (set_fixed_point_multiplier, 1000),

	  #(call_script, "script_presentation_run"),	  

     (try_begin),
        (this_or_next|key_clicked, key_escape),
        (key_clicked, key_right_mouse_button),
		(start_presentation, "prsnt_custom_kingdom_troop"), 
      (try_end),]),
  ]),
 
module_presentation.py
Code:
("custom_troop_item", 0, mesh_troop_info_win_2, [
    (ti_on_presentation_load,
     [
      (set_fixed_point_multiplier, 1000),

        (store_mul, ":cur_troop", "$temp_troop", 2), #with weapons
		(create_mesh_overlay_with_tableau_material, "$g_presentation_obj_5", -1, "tableau_game_party_window", ":cur_troop"),## tableau_game_character_sheet
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_5", pos1),		
		(position_set_x, pos1, 300),
		(position_set_y, pos1, 20),
		(overlay_set_position, "$g_presentation_obj_5", pos1),	  
	  
        (create_button_overlay, "$g_presentation_obj_3", "@Next"),
        (position_set_x, pos1, 115),
        (position_set_y, pos1, 35),
        (overlay_set_position, "$g_presentation_obj_3", pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_area_size, "$g_presentation_obj_3", pos1),

		(call_script,"script_custom_troop_inventory_total_price","$temp_troop"),	
		(call_script,"script_custom_troop_inventory_total_weight","$temp_troop"),
	    (store_attribute_level,":strength_level","$temp_troop",ca_strength),
	    (store_character_level,":character_level","$temp_troop"),
	    (val_mul,":strength_level",2),
	    (store_add,":weight_limits",":strength_level",":character_level"),
        (assign,reg44,":weight_limits"),	
	    (create_text_overlay,"$g_presentation_obj_6","@Price: {reg42}^Weight: {reg43}^Limits: {reg44}",tf_left_align),		
		(position_set_x, pos1, 530),
        (position_set_y, pos1, 240),
		(overlay_set_position, "$g_presentation_obj_6", pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_6", pos1),
		
        (assign, reg5, "$cheat_find_item_range_begin"),
        (store_add, reg6, "$cheat_find_item_range_begin", 96),
	    (val_min, reg6, "itm_items_end"),
	    (val_sub, reg6, 1),
				
	    (create_text_overlay,"$g_presentation_obj_4","@{reg5} to {reg6}",0),		
		(position_set_x, pos1, 110),
        (position_set_y, pos1, 700),
		(overlay_set_position, "$g_presentation_obj_4", pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1000),
        (overlay_set_size, "$g_presentation_obj_4", pos1),	
		
        (assign, ":pos_y_0_0", 605),
        (assign, ":pos_y_0_1", 650),		
        (assign, ":pos_y_1_0", 605),
        (assign, ":pos_y_1_1", 650),
		(position_set_x, pos10, 890),
		(position_set_y, pos10, 830),		
        (assign, ":slot_no", 0),		
        (try_for_range, ":unused_width", 0, 3),
		  (try_for_range, ":unused_height", 0, 4),	  
			(try_begin),
				(is_between,":slot_no",0,4),
				(troop_get_slot, ":slot_item", "trp_array_d",":slot_no"),				
				(create_mesh_overlay_with_item_id, "$g_presentation_obj_1", ":slot_item"),
				(position_set_x, pos1, 598),
				(position_set_y, pos1,  ":pos_y_0_1"),
				(overlay_set_position, "$g_presentation_obj_1", pos1),
				(overlay_set_size, "$g_presentation_obj_1", pos10),				
				(troop_set_slot, "trp_array_c", ":slot_no", "$g_presentation_obj_1"),				
				(create_mesh_overlay, "$g_presentation_obj_1", "mesh_inv_slot"),				
				(position_set_x, pos1, 890),
				(position_set_y, pos1, 890),
				(overlay_set_size, "$g_presentation_obj_1", pos1),
				(position_set_x, pos1, 553),
				(position_set_y, pos1,  ":pos_y_0_0"),
				(overlay_set_position, "$g_presentation_obj_1", pos1),
				(try_begin),
					(eq,":slot_item",0),
					(overlay_set_alpha, "$g_presentation_obj_1", 100),
				(try_end),
				(store_add,":slot_offset",":slot_no",50),				
				(troop_set_slot, "trp_array_c",":slot_offset", "$g_presentation_obj_1"),				
				(val_sub,  ":pos_y_0_0", 89),
				(val_sub,  ":pos_y_0_1", 89),				
			(else_try),
				(is_between,":slot_no",4,7),
				(troop_get_slot, ":slot_item", "trp_array_d",":slot_no"),				
				(create_mesh_overlay_with_item_id, "$g_presentation_obj_1", ":slot_item"),
				(position_set_x, pos1, 495),
				(position_set_y, pos1,  ":pos_y_1_1"),
				(overlay_set_position, "$g_presentation_obj_1", pos1),
				(overlay_set_size, "$g_presentation_obj_1", pos10),					
				(troop_set_slot, "trp_array_c", ":slot_no", "$g_presentation_obj_1"),				
				(create_mesh_overlay, "$g_presentation_obj_1", "mesh_inv_slot"),					
				(position_set_x, pos1, 890),
				(position_set_y, pos1, 890),
				(overlay_set_size, "$g_presentation_obj_1", pos1),			
				(position_set_x, pos1, 450),
				(position_set_y, pos1,  ":pos_y_1_0"),
				(overlay_set_position, "$g_presentation_obj_1", pos1),
				(try_begin),
					(eq,":slot_item",0),
					(overlay_set_alpha, "$g_presentation_obj_1", 100),
				(try_end),			
				(store_add,":slot_offset",":slot_no",50),				
				(troop_set_slot, "trp_array_c", ":slot_offset", "$g_presentation_obj_1"),				
				(val_sub,  ":pos_y_1_0", 89),
				(val_sub,  ":pos_y_1_1", 89),
			(else_try),
				(eq,":slot_no",7),
				(troop_get_slot, ":slot_item", "trp_array_d",":slot_no"),				
				(create_mesh_overlay_with_item_id, "$g_presentation_obj_1", ":slot_item"),
				(position_set_x, pos1, 405),
				(position_set_y, pos1,  565),
				(overlay_set_position, "$g_presentation_obj_1", pos1),
				(overlay_set_size, "$g_presentation_obj_1", pos10),					
				(troop_set_slot, "trp_array_c", ":slot_no", "$g_presentation_obj_1"),				
				(create_mesh_overlay, "$g_presentation_obj_1", "mesh_inv_slot"),				
				(position_set_x, pos1, 890),
				(position_set_y, pos1, 830),
				(overlay_set_size, "$g_presentation_obj_1", pos1),			
				(position_set_x, pos1, 360),
				(position_set_y, pos1,  520),
				(overlay_set_position, "$g_presentation_obj_1", pos1),
				(try_begin),
					(eq,":slot_item",0),
					(overlay_set_alpha, "$g_presentation_obj_1", 100),
				(try_end),		
				(store_add,":slot_offset",":slot_no",50),					
				(troop_set_slot, "trp_array_c", ":slot_offset", "$g_presentation_obj_1"),				
			(else_try),
				(eq,":slot_no",8),
				(troop_get_slot, ":slot_item", "trp_array_d",":slot_no"),				
				(create_mesh_overlay_with_item_id, "$g_presentation_obj_1", ":slot_item"),
				(position_set_x, pos1, 405),
				(position_set_y, pos1,  365),
				(overlay_set_position, "$g_presentation_obj_1", pos1),
				(overlay_set_size, "$g_presentation_obj_1", pos10),					
				(troop_set_slot, "trp_array_c", ":slot_no", "$g_presentation_obj_1"),				
				(create_mesh_overlay, "$g_presentation_obj_1", "mesh_inv_slot"),				
				(position_set_x, pos1, 890),
				(position_set_y, pos1, 830),
				(overlay_set_size, "$g_presentation_obj_1", pos1),			
				(position_set_x, pos1, 360),
				(position_set_y, pos1,  320),
				(overlay_set_position, "$g_presentation_obj_1", pos1),
				(try_begin),
					(eq,":slot_item",0),
					(overlay_set_alpha, "$g_presentation_obj_1", 100),
				(try_end),
				(store_add,":slot_offset",":slot_no",50),				
				(troop_set_slot, "trp_array_c", ":slot_offset", "$g_presentation_obj_1"),			
			(try_end),
            (val_add, ":slot_no", 1),
			(assign,reg30,":slot_no"),
			#(display_message,"@{reg30}"),
          (try_end),			
        (try_end),		
		
        (str_clear, s0),
        (create_text_overlay, "$g_presentation_obj_1", s0, tf_scrollable),
        (position_set_x, pos1, 15),
        (position_set_y, pos1, 100),
        (overlay_set_position, "$g_presentation_obj_1", pos1),
        (position_set_x, pos1, 270),
        (position_set_y, pos1, 600),
        (overlay_set_area_size, "$g_presentation_obj_1", pos1),
        (set_container_overlay, "$g_presentation_obj_1"),
	  
        (assign, ":pos_x", 0),
        (assign, ":pos_y", 2575),
        (assign, ":slot_no", 0),
        (try_for_range, ":unused_height", 0, 32),
          (try_for_range, ":unused_width", 0, 3),
            (create_mesh_overlay, "$g_presentation_obj_1", "mesh_inv_slot"),
            (position_set_x, pos1, 890),
            (position_set_y, pos1, 830),
            (overlay_set_size, "$g_presentation_obj_1", pos1),
            (position_set_x, pos1, ":pos_x"),
            (position_set_y, pos1, ":pos_y"),
            (overlay_set_position, "$g_presentation_obj_1", pos1),
            (create_mesh_overlay, "$g_presentation_obj_1", "mesh_mp_inventory_choose"),
			(overlay_set_alpha, "$g_presentation_obj_1", 0),
            (position_set_x, pos1, 712),
            (position_set_y, pos1, 650),
            (overlay_set_size, "$g_presentation_obj_1", pos1),
            (position_set_x, pos1, ":pos_x"),
            (position_set_y, pos1, ":pos_y"),
            (overlay_set_position, "$g_presentation_obj_1", pos1),			
            (troop_set_slot, "trp_array_a", ":slot_no", "$g_presentation_obj_1"),
		    (store_add,":num_temp",":slot_no","$cheat_find_item_range_begin"),
			(store_add,":item_no",":num_temp","itm_no_item"),
			(try_begin),
				(lt, ":item_no", "itm_items_end"),
				(create_mesh_overlay_with_item_id, "$g_presentation_obj_1", ":item_no"),
				(position_set_x, pos1, 890),
				(position_set_y, pos1, 830),				
				(overlay_set_size, "$g_presentation_obj_1", pos1),
				(store_add, ":item_x", ":pos_x", 44),
				(store_add, ":item_y", ":pos_y", 41),
				(position_set_x, pos1, ":item_x"),
				(position_set_y, pos1, ":item_y"),
				(overlay_set_position, "$g_presentation_obj_1", pos1),	
				(troop_set_slot, "trp_array_b", ":num_temp", "$g_presentation_obj_1"),	
            (try_end),				
            (val_add, ":slot_no", 1),
			(val_add, ":pos_x", 89),
          (try_end),			
          (assign, ":pos_x", 0),
          (val_sub, ":pos_y", 83),
        (try_end),
		
        (set_container_overlay, -1),

        (position_set_x, pos2, 50),
        (position_set_y, pos2, 50),		
        (create_game_button_overlay, "$g_presentation_obj_11", "@Save", 0),	
        (position_set_x, pos1, 590),
        (position_set_y, pos1, 190),
        (overlay_set_position, "$g_presentation_obj_11", pos1),
        (overlay_set_area_size, "$g_presentation_obj_11", pos2),		
        (create_game_button_overlay, "$g_presentation_obj_12", "@Reset", 0),	
        (position_set_x, pos1, 590),
        (position_set_y, pos1, 130),
        (overlay_set_position, "$g_presentation_obj_12", pos1),
        (overlay_set_area_size, "$g_presentation_obj_12", pos2),
        (create_game_button_overlay, "$g_presentation_obj_13", "str_back", 0),	
        (position_set_x, pos1, 590),
        (position_set_y, pos1, 70),
        (overlay_set_position, "$g_presentation_obj_13", pos1),
        (overlay_set_area_size, "$g_presentation_obj_13", pos2),		
				
	  #(call_script, "script_presentation_load"),		
      (presentation_set_duration, 999999),
     ]),
	 
    (ti_on_presentation_event_state_change,
      [
        (store_trigger_param_1, ":object"),	
		
		(try_begin),
			(eq,":object","$g_presentation_obj_3"),
			(val_add, "$cheat_find_item_range_begin", 96),
			(try_begin),
				(ge, "$cheat_find_item_range_begin", "itm_items_end"),
				(assign, "$cheat_find_item_range_begin", 0),
			(try_end),
			(start_presentation, "prsnt_custom_troop_item"),
        (else_try),
			(eq,":object","$g_presentation_obj_11"),
			(call_script,"script_custom_troop_inventory_change","$temp_troop"),
			(call_script,"script_custom_troop_inventory_initialization","$temp_troop"),			
			(start_presentation, "prsnt_custom_troop_item"),
        (else_try),
			(eq,":object","$g_presentation_obj_12"),
			(assign,"$current_item",-1),			
			(call_script,"script_custom_troop_inventory_reset","$temp_troop"),			
			(start_presentation, "prsnt_custom_troop_item"),
        (else_try),
			(eq,":object","$g_presentation_obj_13"),
			(call_script,"script_custom_troop_inventory_reset","$temp_troop"),			
			(call_script,"script_get_custom_troop_info"),
			(call_script,"script_store_custom_troop_info_to_slot","trp_array_b"),		
			(start_presentation, "prsnt_custom_troop"),			
        (try_end),		

	  ]),

    (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", 0, 96),
          (troop_slot_eq, "trp_array_a", ":slot_no", ":object"),
		  (store_add,":num_temp",":slot_no","$cheat_find_item_range_begin"),
		  (store_add,":item_no",":num_temp","itm_no_item"),
          (try_begin),
			(lt, ":item_no", "itm_items_end"),
            (troop_get_slot, ":target_obj", "trp_array_b", ":num_temp"),
            (overlay_get_position, pos0, ":target_obj"),
            (show_item_details, ":item_no", pos0, 100),
            (assign, "$g_current_opened_item_details", ":num_temp"),
          (try_end),
        (try_end),
		(try_for_range, ":slot_no", 0, 9),
		  (store_add,":slot_offset",":slot_no",50),
          (troop_slot_eq, "trp_array_c", ":slot_offset", ":object"),
		  (troop_get_slot, ":slot_item","trp_array_d", ":slot_no"),
		  (gt,":slot_item",0),
		  (troop_get_slot, ":target_obj","trp_array_c", ":slot_no"),
          (overlay_get_position, pos0, ":target_obj"),
          (show_item_details, ":slot_item", pos0, 100),	
          (assign, "$g_current_opened_item_details", ":slot_item"),
        (try_end),		  
      (else_try),
        (try_for_range, ":slot_no", 0, 96),
          (troop_slot_eq, "trp_array_a", ":slot_no", ":object"),
          (try_begin),
            (eq, "$g_current_opened_item_details", ":num_temp"),
            (close_item_details),
          (try_end),
        (try_end),
		(try_for_range, ":slot_no", 0, 9),
		  (store_add,":slot_offset",":slot_no",50),
          (troop_slot_eq, "trp_array_c", ":slot_offset", ":object"),
		  (troop_get_slot, ":slot_item","trp_array_d", ":slot_no"),
          (eq, "$g_current_opened_item_details", ":slot_item"),
          (close_item_details),
        (try_end),		
      (try_end),
    ]),

    (ti_on_presentation_mouse_press,
     [
	  (store_trigger_param_1, ":object"),
      (store_trigger_param_2, ":mouse_state"),

      (try_begin),
        (eq, ":mouse_state", 0),	  
        (try_for_range, ":slot_no", 0, 96),
          (troop_slot_eq, "trp_array_a", ":slot_no", ":object"),		
		  (store_add,":num_temp",":slot_no","$cheat_find_item_range_begin"),
		  (store_add,":item_no",":num_temp","itm_no_item"),		
          (try_begin),
			(eq, "$current_item", -1),
			(lt, ":item_no", "itm_items_end"),
            (troop_get_slot, ":target_obj", "trp_array_b", ":num_temp"),
			(assign,"$current_item",":num_temp"),
			(overlay_set_display, ":target_obj", 0),			
			(create_mesh_overlay_with_item_id, "$g_presentation_credits_obj_1", "$current_item"),
			(position_set_x, pos1, 1000),
			(position_set_y, pos1, 1000),				
			(overlay_set_size, "$g_presentation_credits_obj_1", pos1),				
		  (else_try),
			(eq, "$current_item", ":num_temp"),
            (troop_get_slot, ":target_obj", "trp_array_b", ":num_temp"),			
			(overlay_set_display,":target_obj", 1),	
			(assign,"$g_presentation_credits_obj_1",-1),
			(assign,"$current_item",-1),
			(start_presentation, "prsnt_custom_troop_item"),			
          (try_end),
        (try_end),		  
        (try_for_range, ":slot_no", 0, 9),
		  (store_add,":slot_offset",":slot_no",50),
          (troop_slot_eq, "trp_array_c", ":slot_offset", ":object"),
		  (troop_get_slot, ":slot_item","trp_array_d", ":slot_no"),
		  (troop_get_slot, ":target_obj","trp_array_c", ":slot_no"),			  
          (try_begin),		  
			(gt,"$current_item",-1),
			(call_script,"script_custom_troop_item_judge","$current_item",":slot_no"),			
			(try_begin),
				(eq,reg0,1),
				(overlay_get_position, pos0, ":target_obj"),		  		  
				(overlay_set_position, "$g_presentation_credits_obj_1", pos0),
				(troop_set_slot, "trp_array_d", ":slot_no", "$current_item"),	
				(assign,"$current_item",-1),
				(call_script,"script_custom_troop_inventory_change","$temp_troop"),			
				(start_presentation, "prsnt_custom_troop_item"),
		  (else_try),
				(display_message,"@You can't equip this item. Wrong Place or too heavy!!",0xFF0000),
          (try_end),				
		  (else_try),
			(eq, "$current_item", -1),
			(overlay_set_display,":target_obj", 0),
			(assign,"$g_presentation_credits_obj_1",-1),
			(neq, ":slot_item", 0),
			(create_mesh_overlay_with_item_id, "$g_presentation_credits_obj_1", ":slot_item"),		
			(position_set_x, pos1, 1000),
			(position_set_y, pos1, 1000),				
			(overlay_set_size, "$g_presentation_credits_obj_1", pos1),
			(assign,"$current_item",":slot_item"),
			(troop_set_slot, "trp_array_d", ":slot_no", 0),	
			(overlay_set_alpha, ":object", 100),
          (try_end),		  
        (try_end),
	  (else_try),
        (eq, ":mouse_state", 1),
		(gt,"$current_item",-1),
		(assign,"$current_item",-1),
		(call_script,"script_custom_troop_inventory_change","$temp_troop"),
		(start_presentation, "prsnt_custom_troop_item"),		
      (try_end),
	  
	  ]),	  
			
    (ti_on_presentation_run,
     [
      (set_fixed_point_multiplier, 1000),
 
     #(try_begin),
     #   (this_or_next|key_clicked, key_escape),
     #   (key_clicked, key_right_mouse_button),
	 # 	(call_script,"script_custom_troop_inventory_reset","$temp_troop"),			
        #(presentation_set_duration, 0),
	   # (call_script,"script_get_custom_troop_info"),
	   # (call_script,"script_store_custom_troop_info_to_slot","trp_array_b"),		
       # (start_presentation, "prsnt_custom_troop"),
      #(try_end),

     (gt,"$current_item",-1),
     (mouse_get_position, pos1),
	 (overlay_set_position, "$g_presentation_credits_obj_1", pos1),
	  
	  #(call_script, "script_presentation_run"),	
	  
	  ]),
  ]),  
 
## ZZ custom_troop presentations end
 
That's really interesting; this basically lets players design their own Troops, eh?  I'm very tempted to make use of this, so that my players can indulge in their wildest fantasies. 

Does this script let us pick the sex of the troop we're creating?
 
Making your entire army change on the fly does seem a bit ridiculous, doesn't it? You can probably do something like this (or seed it with the agent number)
Code:
(is_between, ":troop", "trp_kingdom_recruit", "trp_array_a"),
(troop_get_type, ":gender", ":troop"),
(val_add, ":gender", 1),
(val_mod, ":gender", 1),
(troop_set_type, ":troop", ":gender"),

I've also done something similar a long time ago in teatrc, but it's based off item slots from custom commander and uses the old 3 troop per custom troop technique. It also links to a bunch of other stuff (requisition, debt, battlefield loss/looting), so it might be too messy for integration elsewhere.
 
That is absolutely fascinating. Nice job. It sorta gives you the chance to hand make an army. Could be laborious, actually...will be laborious, when you have huge numbers of troops and then lose many in a battle. But, I have to admit, the control freak in me loves the idea.

I might do this in my native just for giggles.

<3

CR
 
Somebody said:
Making your entire army change on the fly does seem a bit ridiculous, doesn't it? You can probably do something like this (or seed it with the agent number)
Code:
(is_between, ":troop", "trp_kingdom_recruit", "trp_array_a"),
(troop_get_type, ":gender", ":troop"),
(val_add, ":gender", 1),
(val_mod, ":gender", 1),
(troop_set_type, ":troop", ":gender"),

I've also done something similar a long time ago in teatrc, but it's based off item slots from custom commander and uses the old 3 troop per custom troop technique. It also links to a bunch of other stuff (requisition, debt, battlefield loss/looting), so it might be too messy for integration elsewhere.

yes, create a entire army is laborious, even for me. I never seriously design whole troops. But it depends on user. You don't need to use many troops, may be one,or two, not for kingdom troop, just for lansquenets or guards.
 
Just threw this into my module system, I think you forgot to define 'custom_troop_begin/end'. Entirely possible I'm an idiot and am missing it, though. Easy to fix, but any special places they should be defined?
 
I guess I was probably wrong to put the block
# 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"),
     
      (store_character_level, ":troop_level", ":troop_id"),
     
      (try_begin),
        (is_between, ":troop_level", 0, 6),
        (assign, reg0, 10),
      (else_try), 
        (is_between, ":troop_level", 6, 11),
        (assign, reg0, 20),
      (else_try), 
        (is_between, ":troop_level", 11, 16),
        (assign, reg0, 40),
      (else_try), 
        (is_between, ":troop_level", 16, 21),
        (assign, reg0, 80),
      (else_try), 
        (is_between, ":troop_level", 21, 26),
        (assign, reg0, 120),
      (else_try), 
        (is_between, ":troop_level", 26, 31),
        (assign, reg0, 160),
      (else_try), 
        (assign, reg0, 200),
      (try_end), 
## ZZ Custom Kingdom Troop begin
## ZZ custom troop upgrade cost also will be effected by the price of the equipment
      (try_begin),
(is_between, ":upgrade_troop", custom_troop_begin, custom_troop_end),
(troop_get_slot, ":total_price",":upgrade_troop", slot_custom_troop_wage),
(store_div,":upgrade_cost_modify",":total_price",100),
(val_add,reg0,":upgrade_cost_modify"),
      (try_end),
## ZZ Custom Kingdom Troop end
 
  (set_trigger_result, reg0),
  ]),


:?: ERROR: Usage  of  Unassigned  locale  variable      ":upgrade_troop" 
 
SkyShadowing said:
Just threw this into my module system, I think you forgot to define 'custom_troop_begin/end'. Entirely possible I'm an idiot and am missing it, though. Easy to fix, but any special places they should be defined?

ya, Thank you very much. I forgot that. And thank to "somebody", That is what you need to add. Now I have changed it.
 
Uh I hate how much I suck at these things, I really want this but I don't know how to do it, like where do I put this stuff doI copy and paste the code somewhere? Any help would be nice.
 
What you need to do to put in the clothes and weapons to the soldiers :?: 
3ff76ff2dfcc52baef53e8f7705b240e.jpg
When pressing the on bare units in the troop metry nothing happens .. :neutral:

 
Back
Top Bottom