Hello Again,
Working on a leaping charge attack. I've got the behavior and animation part down, I think, but I'm not actually entirely sure how to impart z-velocity to the leaping agent.
I've thought of a pretty inelegant solution, using another trigger and just moving him along the Z-axis so long as he's got the jump animation enabled, but do you guys know of anything else?
Working on a leaping charge attack. I've got the behavior and animation part down, I think, but I'm not actually entirely sure how to impart z-velocity to the leaping agent.
I've thought of a pretty inelegant solution, using another trigger and just moving him along the Z-axis so long as he's got the jump animation enabled, but do you guys know of anything else?
Code:
AI_jump_attack = (
3, 0, 0,
[], [
(get_player_agent_no,":player"),
(try_for_agents, ":agent"),
(neq, ":agent", ":player"),
(agent_is_alive, ":agent"),
(agent_is_human, ":agent"),
(agent_is_active, ":agent"),
#position_get_distance_to_ground_level, dest, pos1
(agent_slot_eq, ":agent", slot_agent_is_running_away, 0),#Isn't fleeing the battle.
##He's an eligible human. Now see if he's in a position to jump-attack!
(agent_get_attack_action, ":attack_action", ":agent"), #returned values: free = 0, readying_attack = 1, releasing_attack = 2, completing_attack_after_hit = 3, attack_parried = 4, reloading = 5, after_release = 6, cancelling_attack = 7
(eq,":attack_action",1),#About to strike!
(agent_get_team, ":team", ":agent"),
(assign, ":maximum_distance", 300),
(assign, ":minimum_distance", 100),
#Target Acquisition
(agent_ai_get_look_target,":suspect",":agent"),
(gt,":suspect",0),#Make sure there is someone.
(agent_is_alive, ":suspect"),
(agent_get_team, ":suspect_team", ":suspect"),
(neq, ":suspect_team", ":team"),
(agent_get_position, pos1, ":agent"),#Distance check
(agent_get_position, pos2, ":suspect"),
(neg|position_is_behind_position, pos2, pos1), #Suspect can't be behind leaper.
(get_distance_between_positions, ":distance", pos1, pos2),
(le, ":distance", ":maximum_distance"),#Make sure he's close enough, but has enough room to leap
(ge, ":distance", ":minimum_distance"),
#Check chance
(store_random_in_range,":jumpchance", 1,5),
#(eq,":jumpchance",1), #20% chance per check
(display_message, "@Agent-jump attack!"),
(agent_set_animation, ":agent", "anim_jump"),# Jump!
(agent_set_attack_action, ":agent", 0, 0),#Downward slash attack
(agent_get_position, pos1, ":agent"),
#(position_get_z, ":z", pos1),
#(val_add, ":z", 5),#Move up 5 meter?
#(position_set_z, pos1, ":z"),
(position_move_z, pos1, -500),
(agent_set_position,":agent",pos1),
#(agent_get_position, ":agent", ":start_pos"),
#(agent_set_position, ":agent_no", pos1),
#(agent_set_position, ":agent", ":start_pos"),#Snap into the air a bit
(try_end),])