LordChrom
Veteran
Hi, I'm having a minor problem with my code for a suicide animation I've added. So the way I want it to work is that when you press the z key, your character commits suicide using an animation. Now the code works fine and when I press the key it triggers the animation. However, I want it to only occur when the player has a dagger equipped but for some reason when I put in the code, the key press does nothing now. I was hoping I could get some thoughts on what I'm doing wrong in my code.
Code:
suicide = (0, 0, 5, [(key_clicked, key_z),
(this_or_next|multiplayer_is_server),
(neg|game_in_multiplayer_mode),
],
[
(get_player_agent_no, ":player_agent"),
(assign, ":tanto_equipped", 0),
(try_begin),
(call_script, agent_has_item_equipped, ":player_agent", "itm_tanto"),
(assign, ":tanto_equipped", 1),
(try_end),
(try_begin),
(eq, ":tanto_equipped", 1),
(agent_set_animation, ":player_agent", "anim_suicide"),
(else_try),
(eq, ":tanto_equipped", 0),
(call_script, agent_equip_item, ":player_agent", "itm_tanto"),
(agent_set_animation, ":player_agent", "anim_suicide"),
(try_end),
])