Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lance_usage = [
- # LANCE USAGE BEGIN
- # Force mounted NPCs to switch to their lance. This is called once at the
- # start of the battle. If you want lancers to ALWAYS use lances on horseback,
- # replace ti_once with 1. Otherwise they may switch to sword if bogged down
- (0, 0, 5, [],
- [
- # Run through all active NPCs on the battle field.
- #(display_message, "@DEBUG -- lance usage"),
- #(eq, 0,1),
- (get_player_agent_no, ":p_agent"),
- (try_for_agents, ":agent"),
- # Isn't a horse.
- (agent_is_human, ":agent"),
- # Isn't a player.
- #(agent_is_non_player, ":agent"),
- (neq, ":p_agent", ":agent"),
- (agent_slot_eq, ":agent", slot_possessed, 0), #not a player spawn
- # Hasn't been defeated.
- (agent_is_alive, ":agent"),
- # They riding a horse?
- (agent_get_horse, ":horse", ":agent"),
- # Is riding a horse.
- #(gt, ":horse", 0), #TOM SPEAR
- (agent_slot_eq, ":agent", slot_agent_is_running_away, 0), #Isn't routing.
- (agent_get_troop_id, ":troop_id", ":agent"),
- (agent_get_ammo, ":ammo_left", ":agent"),
- (le, ":ammo_left", 0),
- #(store_troop_faction, ":troop_faction", ":troop_id"),
- (try_begin),
- (gt, ":horse", 0), #Mounted
- (neg | troop_is_guarantee_ranged, ":troop_id"),
- # Get wielded item.
- (agent_get_wielded_item, ":wielded", ":agent", 0),
- # Is it a lance?
- (neg|is_between, ":wielded", "itm_light_lance","itm_spear_a"), # adjust as needed
- # Force the NPC to wield the lance, but this will only happen if they
- # actually have a lance in their inventory. Otherwise this does
- # nothing.
- (try_for_range,":item","itm_light_lance","itm_spear_a"), # adjust as needed
- (agent_set_wielded_item, ":agent", ":item"),
- (try_end),
- (else_try), #WIELD FLAG
- (eq, "$tom_use_banners", 1),
- (try_for_range,":item",itm_flag_pole_1,itm_cross +1), # adjust as needed
- (agent_set_wielded_item, ":agent", ":item"),
- (try_end),
- (agent_get_wielded_item, ":item", ":agent", 0),
- (is_between, ":item", itm_flag_pole_1, itm_cross + 1),
- (else_try),#no lance on foot
- (neg | troop_is_guarantee_ranged, ":troop_id"),
- (le, ":horse", 0),
- (agent_get_wielded_item, ":wielded", ":agent", 0),
- (is_between, ":wielded", "itm_light_lance","itm_spear_a"),
- (try_for_range, reg0, 0, 4),
- (agent_get_item_slot, ":item", ":agent", reg0),
- (is_between, ":item", 1, "itm_items_end"),
- #(gt, ":item", 0),
- (neg|is_between, ":item", "itm_light_lance","itm_bamboo_spear"),
- (item_get_type, ":item_type", ":item"),
- (this_or_next|eq, ":item_type", itp_type_two_handed_wpn),
- (this_or_next|eq, ":item_type", itp_type_polearm),
- (eq, ":item_type", itp_type_one_handed_wpn),
- (agent_set_wielded_item, ":agent", ":item"),
- (try_end),
- (else_try), #TOM - SPEAR USSAGE
- (neg | troop_is_guarantee_ranged, ":troop_id"),
- #(agent_get_horse, ":horse", ":agent"),
- (le, ":horse", 0), #unmounted
- (agent_get_wielded_item, ":wielded", ":agent", 0),
- (neg|is_between, ":wielded", "itm_bamboo_spear","itm_wooden_shield"),
- #(neg|is_between, ":wielded", "itm_flag_pole_1","itm_items_end"), #not a flag
- (try_for_range,":item","itm_bamboo_spear","itm_wooden_shield"), # adjust as needed
- #(gt, ":item", 0),
- #(agent_equip_item, ":agent", ":item"),
- (agent_set_wielded_item, ":agent", ":item"),
- (try_end),
- (else_try), #tom - range usage
- (troop_is_guarantee_ranged, ":troop_id"),
- (agent_get_team, ":team", ":agent"),
- (agent_get_division, ":division", ":agent"),
- (team_get_hold_fire_order, ":order", ":team", ":division"),
- (neq, ":order", 1), #mordr_hold_fire
- #(gt, ":wielded", 0),
- (is_between, ":wielded", 1, "itm_items_end"),
- (item_get_type, ":type", ":wielded"),
- (this_or_next|le, ":wielded", -1),
- (this_or_next|neq, ":type", itp_type_thrown),
- (this_or_next|neq, ":type", itp_type_crossbow),
- (neq, ":type", itp_type_bow),
- (call_script, "script_get_closest_enemy_distance_new", ":agent", ":team", 300),
- (assign, ":nearest_enemy", reg1),
- (gt, ":nearest_enemy", 300), #7meters.
- (assign, ":top", 4),
- (try_for_range, reg0, 0, ":top"),
- (agent_get_item_slot, ":item_no", ":agent", reg0),
- (is_between, ":item_no", 1, "itm_items_end"),
- #(gt, ":item_no", 0),
- (item_get_type, ":type", ":item_no"),
- (this_or_next|eq, ":type", itp_type_thrown),
- (this_or_next|eq, ":type", itp_type_bow),
- (eq, ":type", itp_type_crossbow),
- (agent_set_wielded_item, ":agent", ":item_no"),
- (assign, ":top", -1),
- (try_end),
- (try_end),
- (try_end),
- ]),
- ]
- # LANCE USAGE END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement