Triggering animations when a specific key is pressed

Users who are viewing this thread

Can you explain how you got the animation to work George? I'm still learning MP coding (but this is something I've literally never tried before)
 
You mean me? I am still a learner like you :smile: Sure I can explain, here what I did.

First I did a new animation code in module animations named "crouch_d". This is an animation that the character sits, then gets up a few seconds later.

By searching on this forum, I prepared a code to trigger my crouching animation when clicked the key "left ctrl". I put it in module mission templates. Here it is:

Code:
multiplayer_crouch_2 = ( 0, 0, 0, [],

       [

         (multiplayer_get_my_player, ":i"),

         (player_get_agent_id, ":agent_1", ":i"),

         (ge, ":agent_1", 0),

         (try_begin),

           (key_clicked, key_left_control),

           (display_message,"@Comelme Deneme."), #Crouching Test.
         
           (multiplayer_send_2_int_to_server, multiplayer_event_animation_server, "anim_crouch_d", ":i"),

         (try_end),

         ])

I am sure you know that you should put the ID line
Code:
multiplayer_crouch_2,
under to where you want to use this code. I put it under multiplayer_tdm so I can only crouch in team deathmatch mode.

To do server and client stuff, check this link:

http://forums.taleworlds.com/index.php/topic,94641.msg2492972.html#msg2492972

Scroll down and find "Animation Syncing", then apply to module scripts.

Now in game when I click left ctrl, I crouch for a few seconds then get up automatically. During crouching I can do everything like swinging sword, firing rifle etc. (upper body is free but lower body is locked)

Hope it helps you.

 
I know this thread has been inactive for a while but here what it says when I try to export, it says this. I dont know what it means but could someone help me. I wonder if this even works with mount and blade.

Error: Invalid object:cheer.Variables should start with $ sign and references should start with a tag
ERROR: Illegal Identifier:cheer
 
Caba`drin said:
Code:
  (0, 0, 1, [(key_clicked, key_q)], [
       (get_player_agent_no, ":agent"),
       (agent_set_animation, ":agent", "anim_WHATEVER-THE-CHEER-ANIM-IS"),
  ]),

Did you use that and just dub in your animation? Also, unless you added it, I don't believe the animation name is "cheer", so check that. For the variable, I don't see why it would need a variable, since this doesn't use one.
 
Well it is called cheer in the module animations.

["cheer", 0,
##  [2.5, "anim_human", 70000, 70045, arf_blend_in_5],
##  [3.0, "anim_human", 70100, 70150, arf_blend_in_5],
  [6.0, "man_cheer", 0, 185, arf_blend_in_5],
  [3.0, "man_cheer", 200, 289, arf_blend_in_5],
  [4.5, "man_cheer", 300, 437, arf_blend_in_5],
  [5.5, "man_cheer", 450, 617, arf_blend_in_5],
],

When I put it the animation named in the brf it comes up like this.
Error: Unrecognized tag:manin object:man_cheer
ERROR: Illegal Identifier:man_cheer
 
Yea I did that and it works, thanks for that. I wouldnt have ever thought to put anim_ before the name of the animation.
 
Cheers. Glad that's all it was.
xPearse said:
I wouldnt have ever thought to put anim_ before the name of the animation.
Always need to use the file prefix when referencing things around the module system (trp_*, itm_*, script_*, anim_*, etc...see the complete list in any of the mod sys documentations or my syntax link).
 
hey y'all

Adam could you pls help me with a code I'm trying to implement? In that link you posted I can't figure where do I have to put the codes in module scripts

thx!
 
Back
Top Bottom