I've been working on getting a new race into the game, and so far have met with great success. However, M&B scripting, indeed Python scripting, is a new territory for me.
This script is supposed to have it set up so that if a faction made up of the new race (culture type 6) controls a town or village, it will replace the townspeople with people of said race.
The only problem is it doesn't work. Can anyone tell me what's wrong with it? Or if it's just some glitch?
This script is supposed to have it set up so that if a faction made up of the new race (culture type 6) controls a town or village, it will replace the townspeople with people of said race.
The only problem is it doesn't work. Can anyone tell me what's wrong with it? Or if it's just some glitch?
插入代码块:
("center_set_walker_to_type",
[
(store_script_param, ":center_no", 1),
(store_script_param, ":walker_no", 2),
(store_script_param, ":walker_type", 3),
(store_script_param, ":faction_no", 4),
(store_add, ":type_slot", slot_center_walker_0_type, ":walker_no"),
(party_set_slot, ":center_no", ":type_slot", ":walker_type"),
(try_begin),
(faction_slot_eq, ":faction_no", slot_faction_culture, "fac_culture_6"),
(party_slot_eq, ":center_no", slot_party_type, spt_village),
(store_random_in_range, ":walker_troop_id", dracvillage_walkers_begin, dracvillage_walkers_end),
(else_try),
(party_slot_eq, ":center_no", slot_party_type, spt_village),
(store_random_in_range, ":walker_troop_id", village_walkers_begin, village_walkers_end),
(else_try),
(faction_slot_eq, ":faction_no", slot_faction_culture, "fac_culture_6"),
(store_random_in_range, ":walker_troop_id", dractown_walkers_begin, dractown_walkers_end),
(else_try),
(store_random_in_range, ":walker_troop_id", town_walkers_begin, town_walkers_end),
(try_end),
(try_begin),
(eq,":walker_type",walkert_spy),
(assign,":original_walker",":walker_troop_id"),
(val_add,":walker_troop_id",4), # select spy troop id
# restore spy inventory
(try_for_range,":item_no","itm_horse_meat","itm_wooden_stick"),
(store_item_kind_count,":num_items",":item_no",":original_walker"),
(ge,":num_items",1),
(store_item_kind_count,":num_items",":item_no",":walker_troop_id"),
(lt,":num_items",1),
(troop_add_items,":walker_troop_id",":item_no",1),
(try_end),
# determine spy recognition item
(store_random_in_range,":spy_item_type",itp_type_head_armor,itp_type_hand_armor),
(assign,":num",0),
(try_for_range,":item_no","itm_horse_meat","itm_wooden_stick"),
(store_item_kind_count,":num_items",":item_no",":walker_troop_id"),
(ge,":num_items",1),
(item_get_type, ":itp", ":item_no"),
(eq,":itp",":spy_item_type"),
(val_add,":num",1),
(troop_remove_items,":walker_troop_id",":item_no",":num_items"),
(try_end),
(store_random_in_range,":random_item",0,":num"),
(assign,":num",-1),
(try_for_range,":item_no","itm_horse_meat","itm_wooden_stick"),
(store_item_kind_count,":num_items",":item_no",":original_walker"),
(ge,":num_items",1),
(item_get_type, ":itp", ":item_no"),
(eq,":itp",":spy_item_type"),
(val_add,":num",1),
(eq,":num",":random_item"),
(troop_add_items,":walker_troop_id",":item_no",1),
(assign,":spy_item",":item_no"),
(try_end),
(assign,"$spy_item_worn",":spy_item"),
(assign,"$spy_quest_troop",":walker_troop_id"),
(troop_equip_items,":walker_troop_id"),
(try_end),
(store_add, ":troop_slot", slot_center_walker_0_troop, ":walker_no"),
(party_set_slot, ":center_no", ":troop_slot", ":walker_troop_id"),
(store_random_in_range, ":walker_dna", 0, 1000000),
(store_add, ":dna_slot", slot_center_walker_0_dna, ":walker_no"),
(party_set_slot, ":center_no", ":dna_slot", ":walker_dna"),
]),



