Animation Trigger on Key Press Issue [solved]

Users who are viewing this thread

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),
   ])
 
Probably because these lines don't do what you expect them to do. You can't call_script on an operation.
(call_script, agent_equip_item/agent_has_item_equipped, ":player_agent", "itm_tanto"),

Checking if an item is equipped should also be done in the condition block, not the consequence block.
 
I'm trying to do something simpler with a war cry in game, but my agent wont play the sound or do the animation. the war cry is defined everywhere it needs to be

Code:
common_warcry = (0.1, 0, 3, [(key_clicked, key_v),], 
  [
  (get_player_agent_no, ":cryer"),
  (agent_play_sound,":cryer", "snd_nordic_warcry"),
  (agent_set_animation, ":cryer", "anim_cheer"),
   ])


hehe, fixed it, turned out the .1 needed to be 0.
 
Back
Top Bottom