axe_trap_control = (0.1, 0, 0,
[(assign, ":go", 0),
(scene_prop_get_num_instances, ":num_guilliotine_triggers", "spr_guilliotine_trigger"),
(try_for_range, ":trigger_no", 0, ":num_guilliotine_triggers"),
(scene_prop_get_instance, ":guilliotine_trigger_prop_id", "spr_guilliotine_trigger", ":trigger_no"),
(try_for_agents, ":agent"),
(agent_is_alive, ":agent"),
(scene_prop_has_agent_on_it, ":guilliotine_trigger_prop_id", ":agent"),
(try_begin),
(ge, "$g_trap_axe", 0),
(else_try),
(lt, "$g_trap_axe", 0),
(assign, ":go", 1),
(assign, "$g_trap_axe", ":agent"),
(try_end),
(try_end),
(try_begin),
(ge, "$g_trap_axe", 0),
(neg|scene_prop_has_agent_on_it, ":guilliotine_trigger_prop_id", ":agent"),
(assign, ":go", 1),
(assign, "$g_trap_axe", -1),
(try_end),
(try_end),
(eq, ":go", 1),
],
[(try_for_prop_instances, ":axe", "spr_guilliotine"),
(try_begin),
(scene_prop_slot_eq, ":axe", scene_prop_open_or_close_slot, 0), # if the trap is hidden - activate
(prop_instance_get_position, pos2, ":axe"),
(position_move_z, pos2, -320),
(prop_instance_animate_to_position, ":axe", pos2, 50),
(scene_prop_set_slot, ":axe", scene_prop_open_or_close_slot, 1),
(prop_instance_play_sound, ":axe", "snd_draw_greatsword", sf_vol_15),
(else_try), # if it is active - hide
(prop_instance_get_starting_position, pos1, ":axe"),
(prop_instance_animate_to_position, ":axe", pos1, 50),
(scene_prop_set_slot, ":axe", scene_prop_open_or_close_slot, 3),
(prop_instance_play_sound, ":axe", "snd_draw_greataxe", sf_vol_15),
(try_end),
(try_end),
])
Azura34 said:
Aşağıdaki tetikleyici module_mission_templates.py içindeki "town_center" bölümüne eklenebilirAzura34 said:
Madijeis said:
(0, 0, ti_once, [], [
(party_get_slot, ":town_lord", "$current_town", slot_town_lord),
(ge, ":town_lord", 0),
(troop_get_inventory_capacity, ":inventory_capacity", ":town_lord"),#whole inventory
#(assign,":inventory_capacity", 4),# for equipped items only
(try_begin),
(scene_prop_get_instance, ":weapon_rack", "spr_weapon_rack", 0),
(prop_instance_is_valid, ":weapon_rack"),
(prop_instance_set_scale, ":weapon_rack", 110, 100, 100), #it's slightly to narrow, so we widen by 10%
(assign, ":pos", pos0),
(prop_instance_get_position, ":pos", ":weapon_rack"),
(try_for_range, ":inv_slt_no", 0, ":inventory_capacity"),
(troop_get_inventory_slot, ":weapon_0", ":town_lord", ":inv_slt_no"),
(ge, ":weapon_0", 1), #aborted if slot is empty
(item_get_weapon_length, ":weapon_0_length", ":weapon_0"),
(item_get_type, ":weapon_0_type", ":weapon_0"),
(try_begin),
(eq, ":weapon_0_type", itp_type_shield), #shields go on the wall behind (where it should be anyway)
(position_move_z, ":pos", 150),
(position_move_y, ":pos", 40),
(position_move_x, ":pos", 10),
(position_rotate_x, ":pos", 90),
(position_rotate_z, ":pos", 45),
(else_try),
(this_or_next|eq, ":weapon_0_type", itp_type_crossbow),
(eq, ":weapon_0_type", itp_type_bow),
(position_move_x, ":pos", -60, 0),
(position_move_z, ":pos", 13, 0),
(position_move_y, ":pos", -5),
(position_move_z, ":pos", ":weapon_0_length", 0),
(position_rotate_x, ":pos", -95),
(else_try),
(eq, ":weapon_0_type", itp_type_thrown),
(position_move_x, ":pos", -60, 0),
(position_move_z, ":pos", -10, 0),
(position_move_y, ":pos", -5),
(position_move_z, ":pos", ":weapon_0_length", 0),
(position_rotate_z, ":pos", -180),
(position_rotate_x, ":pos", 90),
(else_try),
(eq, ":weapon_0_type", itp_type_polearm),
(position_move_x, ":pos", -60, 0),
(position_move_z, ":pos", -120, 0),
(position_move_y, ":pos", -10),
(val_div, ":weapon_0_length", 3),
(val_mul, ":weapon_0_length", 2),
(position_move_z, ":pos", ":weapon_0_length", 0),
(position_rotate_x, ":pos", 85),
(else_try),
(this_or_next|eq, ":weapon_0_type", itp_type_arrows),
(eq, ":weapon_0_type", itp_type_bolts),
(position_move_z, ":pos", -80, 0),
(position_move_y, ":pos", 18, 0),
(position_rotate_z, ":pos", 90),
(else_try),
(position_move_x, ":pos", -60, 0),
(position_move_z, ":pos", -70, 0),
(position_move_y, ":pos", -5),
(position_move_z, ":pos", ":weapon_0_length", 0),
(position_rotate_x, ":pos", -95),
(try_end),
(set_spawn_position, ":pos"),
(spawn_item, ":weapon_0", 0, 0),
#some manipulations with ":pos" here, if needed move or change pos
(try_end),
(try_end),
]),
ai_shield_bash = (3, 0, 0,[],
[
(eq,"$mmc_ai_shield_bash",1),
(get_player_agent_no,":player_agent"),
(try_for_agents, ":agent_no"),
(neq,":agent_no", ":player_agent"),
(agent_get_troop_id, ":troop_sb_id", ":agent_no"),
(store_skill_level, ":skill_shield", "skl_shield", ":troop_sb_id"),
(ge,":skill_shield",1),#set needed level of skill_shield for bashing
(agent_is_alive, ":agent_no"),
(agent_is_human, ":agent_no"),#Only humans can kick....FOR NOW
(agent_is_active, ":agent_no"),
#-----------------------------------Garedyr begin
(agent_get_horse, ":horse", ":agent_no"),
(eq, ":horse", -1), #agent cannot be mounted
#-----------------------------------Garedyr end
(agent_slot_eq, ":agent_no", slot_agent_is_running_away, 0),#Isn't fleeing the battle.
(agent_get_wielded_item, ":shield_item", ":agent_no", 1),# what agent has in the left hand
(gt, ":shield_item", itm_no_item),#its item
(item_get_type, ":type", ":shield_item"),#
(eq, ":type", itp_type_shield),# item is shield
(agent_get_animation, ":anim", ":agent_no", 0),
(neq, ":anim", "anim_shield_bash"),
(agent_get_attack_action, ":attack_action", ":agent_no"),
(agent_get_defend_action, ":defend_action", ":agent_no"),
(this_or_next|eq,":attack_action",4),#Just got parried
(this_or_next|eq,":defend_action",1),#Parrying an enemy
##So he'll only try to kick if he just parried an enemy attack, or his own attack just got parried.
(agent_get_team, ":team", ":agent_no"),
(assign, ":maximum_distance", 100), #100 cm / 1m
#Target Acquisition
(agent_ai_get_look_target,":victim",":agent_no"),
(gt,":victim",0),#Make sure there is someone.
(agent_is_alive, ":victim"),
(agent_is_human, ":victim"),#Only kick humans
(agent_is_active, ":victim"),
#-----------------------------------Garedyr begin
(agent_get_horse, ":v_horse", ":victim"),
(eq, ":v_horse", -1), #victim agent cannot be mounted too
#-----------------------------------Garedyr end
(agent_get_team, ":v_team", ":victim"),
(teams_are_enemies, ":v_team", ":team"),
(agent_get_position, pos1, ":agent_no"),#Distance check
(position_move_y, pos1, 75),#75 cm directly ahead, so it's not a cuboid space around player center
(agent_get_position, pos2, ":victim"),
(neg|position_is_behind_position, pos2, pos1), #victim can't be behind kicker.
(get_distance_between_positions, ":distance", pos1, pos2),
(le, ":distance", ":maximum_distance"),
(try_begin),
### dodge part ###
(agent_get_troop_id, ":victim_troop", ":victim"),
(store_skill_level, ":athletics", "skl_athletics", ":victim_troop"),
(val_mul, ":athletics", 5),# 5 percent chance to avoid bash per athletics skill point
(store_random_in_range, ":dodge", 1, 100),
(le, ":dodge", ":athletics"),
(else_try),
### dodge part end ###
(val_mul, ":skill_shield", 3),#3 percent chance to bash per shield skill
(store_random_in_range, ":random", 1, 100),
(le,":random",":skill_shield"),
(agent_set_animation, ":agent_no","anim_shield_bash"),
(agent_get_troop_id, ":id", ":agent_no"),
(troop_get_type, ":type", ":id"),
(try_begin),
(eq, ":type", tf_male),
(agent_play_sound, ":agent_no", "snd_man_yell"),
(else_try),
(agent_play_sound, ":agent_no", "snd_woman_yell"),
(try_end),
(agent_play_sound, ":agent_no", "snd_wooden_hit_low_armor_high_damage"),
(agent_set_animation, ":victim", "anim_shield_strike"),
(store_mul, ":bs_damage", ":skill_shield",2),#
(agent_deliver_damage_to_agent, ":agent_no", ":victim", ":bs_damage", "itm_tutorial_club"),
(try_end),
(try_end),
])
#Shield Bash end
(troop_clear_inventory, ":merchant_troop"),
(troop_add_merchandise, ":merchant_troop", itp_type_goods, ":number_of_items_in_village"),
### cultural restriction ###
(try_begin),
(party_get_slot, ":culture", ":village_no", slot_center_culture),
(store_add, ":number_of_eqslot", ":number_of_items_in_village", 10),
(try_for_range, ":inv", 9, ":number_of_eqslot"),
(try_begin),
(eq,":culture",fac_culture_6),#sarranids
(troop_get_inventory_slot, ":haram", ":merchant_troop", ":inv"),
#(this_or_next|eq,":haram",itm_boar_meat),
#(this_or_next|eq,":haram",itm_deer_meat),
(eq,":haram",itm_pork),
(troop_remove_item, ":merchant_troop", ":haram"),
(store_random_in_range, ":halyal", itm_cheese,itm_chicken),
(troop_add_item,":merchant_troop",":halyal",0),
(try_end),
(try_end),
(try_end),
### cultural restriction end ###
(troop_ensure_inventory_space, ":merchant_troop", 80),