WB Other Adding custom animation keys

Users who are viewing this thread

How would I go about adding more custom animations, like the cheer animation, or whatever for my multiplayer server. I successfully added animations for the b key and v key (those already have some sort of template), but when I attempted to add one for 'h' copying the same format I got an error saying h was not defined : "NameError: name 'player_action_key_h' is not defined"
What could I be missing? Thank you
 

RecursiveHarmony

How would I go about adding more custom animations, like the cheer animation, or whatever for my multiplayer server. I successfully added animations for the b key and v key (those already have some sort of template), but when I attempted to add one for 'h' copying the same format I got an error saying h was not defined : "NameError: name 'player_action_key_h' is not defined"
What could I be missing? Thank you
NameError is explained in python documentary as:
exception NameError
Raised when a local or global name is not found. This applies only to unqualified names. The associated value is an error message that includes the name that could not be found.
I guess there are variables named as "player_action_key_b" and "player_action_key_v" in those templates and you changed one of them to "player_action_key_h". You should find those where those variables are defined and create a new one for the "h" key.
For example if they're defined like this somewhere:
player_action_key_b = key_b
player_action_key_v = key_v
You should add
player_action_key_h = key_h
below them. Key codes are stored at the "header_triggers.py" file. You can check it for extra info.
 
Upvote 0

RecursiveHarmony

It makes no sense to declare someplaces new constants for the keys if there are already all keys given as constants. You can even choose between keys and game keys, you only need to fit the used operations to them as well.
I assume if they created custom variables they must have a good reason :smile: Maybe creates a little bit of distinction.
 
Upvote 0

RecursiveHarmony

If you use "key_h", when you want to change the key then you have to find each usage of the key and change only the ones related to this animation (cause you can't change what's stored in the key code). If you use a custom variable, you can just use notepad++'s search and replace function to do the job. I don't think it's a requires-a-big-brain kind of rare situation.
 
Upvote 0

RecursiveHarmony

In my opinion there went a lot of things wrong in regard of concept design if you have multiple stuff assigned to the same key :razz:
Maybe. We can talk about it later if he posts the related code.
@free_pc_virus_removal post the code up samurai, we have an argument to settle :cool:

Edit:
@Eärendil Ardamírë I thought about it a little bit and i guess variable names are what make you find this weird. Let's make some better names up for the variables.
player_action_key_custom_action_1= key_b
player_action_key_custom_action_2 = key_v
You can easily change the assigned variables without changing anything else.
player_action_key_custom_action_1= key_c
player_action_key_custom_action_2 = key_z
and you can rename them too.
player_action_key_kneel= key_c
player_action_key_stand_up = key_z
I hope it's more clear.
 
Last edited:
Upvote 0
Two locations I assumed were relevant in scripts:

Code:
(else_try),
            (eq, ":mod_variable_type", mod_variable_enable_custom_action_h),
            (assign, "$g_enable_action_h", ":value", 1),
            (multiplayer_send_2_int_to_server,multiplayer_event_send_player_action,player_action_key_h),
          (else_try),
            (eq, ":mod_variable_type", mod_variable_enable_custom_action_v),
            (assign, "$g_enable_action_v", ":value", 1),
            (multiplayer_send_2_int_to_server,multiplayer_event_send_player_action,player_action_key_v),
          (else_try),
            (eq, ":mod_variable_type", mod_variable_enable_custom_action_b),
            (assign, "$g_enable_action_b", ":value", 1),
            (multiplayer_send_2_int_to_server,multiplayer_event_send_player_action,player_action_key_b),

added a new line for h copying the others


Code:
  (eq, ":action_type", player_action_key_v),
  (store_script_param, ":action", 4),
  (agent_get_animation,":cur_anim",":player_agent",1),
  (try_begin),
      (eq,":cur_anim","anim_sitting"),
      (agent_set_animation,":player_agent","anim_freeze_player",1),
  (else_try),
      (agent_set_animation,":player_agent","anim_freeze_player",1),
  (try_end),

(else_try),
  #action on H## key
  (eq, ":action_type", player_action_key_h),
  (store_script_param, ":action", 4),
  (agent_get_animation,":cur_anim",":player_agent",1),
  (try_begin),
      (eq,":cur_anim","anim_sitting"),
      (agent_set_animation,":player_agent","anim_drum",1),
  (else_try),
      (agent_set_animation,":player_agent","anim_drum",1),
  (try_end),

(same deal here) ^

In mission templates:
Code:
multiplayer_client_custom_action_b = (
0, 0, 1.0, [   
  (neg|multiplayer_is_dedicated_server),
  (eq, "$g_enable_action_b", 1),
  (neg|is_presentation_active, "prsnt_multiplayer_admin_chat"),
  (neg|is_presentation_active, "prsnt_multiplayer_custom_chat"),
  (key_clicked,key_b),
],
[
  (multiplayer_get_my_player, ":player_id"),
  (player_is_active, ":player_id"),
  (multiplayer_send_string_to_player, ":player_id", multiplayer_event_return_admin_chat, "[USER=318733]@Praise[/USER] Aut."),
  (call_script, "script_show_multiplayer_message", multiplayer_message_type_admin, 0),

  (try_begin),
      (call_script,"script_client_get_my_agent"),
      (assign,":agent_id",reg0),
      (agent_is_active,":agent_id"),
      (agent_is_alive,":agent_id"),
      (agent_set_animation,":agent_id","anim_fall_chest_front",1),
      # (multiplayer_send_2_int_to_server, multiplayer_event_send_player_action, player_action_surrender,music_type_start),
  (try_end),
  (multiplayer_send_2_int_to_server,multiplayer_event_send_player_action,player_action_key_b),
])
multiplayer_client_custom_action_h = (
0, 0, 1.0, [    
  (neg|multiplayer_is_dedicated_server),
  (eq, "$g_enable_action_h", 1),
  (neg|is_presentation_active, "prsnt_multiplayer_admin_chat"),
  (neg|is_presentation_active, "prsnt_multiplayer_custom_chat"),
  (key_clicked,key_h),
],
[
  (multiplayer_get_my_player, ":player_id"),
  (player_is_active, ":player_id"),
  (multiplayer_send_string_to_player, ":player_id", multiplayer_event_return_admin_chat, "@Autistic Seat"),
  (call_script, "script_show_multiplayer_message", multiplayer_message_type_admin, 0),

  (try_begin),
      (call_script,"script_client_get_my_agent"),
      (assign,":agent_id",reg0),
      (agent_is_active,":agent_id"),
      (agent_is_alive,":agent_id"),
      (agent_set_animation,":agent_id","anim_drum",1),
      # (multiplayer_send_2_int_to_server, multiplayer_event_send_player_action, player_action_surrender,music_type_start),
  (try_end),
  (multiplayer_send_2_int_to_server,multiplayer_event_send_player_action,player_action_key_h  ),
])
(copied format for b key but with different animation ofc)

Also added a constant for h key in the module_constants. No idea if that is relevant just trying things.

Code:
player_action_key_v = 17
player_action_key_b = 18
player_action_key_h = 888

I am new to scripting still so bare with me. But both v and b key animations work. I still get the error " NameError: name 'mod_variable_enable_custom_action_h' is not defined"

Forgive me if I overlooked something that was already the answer. It is quite late here haha
Thanks for the help
 
Last edited by a moderator:
Upvote 0

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
I am new to scripting still so bare with me. But both v and b key animations work. I still get the error " NameError: name 'mod_variable_enable_custom_action_h' is not defined"
You need to figure out where the other two variables got declared (mod_variable_enable_custom_action_v and b) and copy paste the behaviour as RecursiveHarmony has pointed out at his first point too. It seems to be the only thing missing.
Code:
Code:
player_action_key_v = 17
player_action_key_b = 18
player_action_key_h = 888
A specific reason why you set such an odd number for the constant here?
 
Upvote 0
@free_pc_virus_removal Yeah, you could have used 19 :smile:
Lol cause there was already a 19 all the way to like 200 something and didnt know if there could be two 19's. And I like the number 8 so I figured it would grant good luck kek.

I found every instance of action_b and v in both mission templates and scripts and transposed their format for h and it still says it is undefined. Is there another folder I should be searching in?
 
Upvote 0
Top Bottom