How is your script being called? And from where?
If I understood right, my script is called "cf_replace_weapon_while_anim_is_active" and I wrote it myself, based on other scripts in module_scripts.py (again, I learned how to script all by myself and this script can be dumb, but on building module there are no errors. Here it is again.
("cf_replace_weapon_while_anim_is_active",
[
(store_script_param, ":agent_id", 1),
(agent_is_active,":agent_id"),
(agent_get_animation,":cur_anim",":agent_id",1), #if current animation is:
(this_or_next|eq,":cur_anim","anim_stand_staff"), # When player stands
(this_or_next|eq,":cur_anim","anim_turn_right_staff"), # When player turns right
(this_or_next|eq,":cur_anim","anim_turn_left_staff"), # When player turns left
(this_or_next|eq,":cur_anim","anim_walk_forward_staff"), # When player walks forward
(eq,":cur_anim","anim_walk_backward_staff"), # When player walks backward
(try_begin),
(agent_get_wielded_item,":item_id",":agent_id",0), #if agent has item
(this_or_next|is_between,":item_id","itm_french_mousquiton","itm_cannon_ball_dummy"), #item is a carbine or
(is_between,":item_id","itm_french_charleville","itm_french_art_off_sword"), #item is a musket
(agent_equip_item,":item_id","itm_flag_france_45e"), #give to the agent other item (flag for testing purposes)
(try_end)
]),
In theory, it must replace current weapon (if it is musket or carbine) to french flag, so I can distinctively see that weapon was indeed changed to something while one of selected animations is active, so later I can make the same mesh of musket with other coordinates.
Of course, the much better way is just rotate and move wielded weapon so it will be in needed position, but first of all in that case weapon must be attached to left hand to avoid bugs in animations, and it seems that flag "arf_stick_item_to_left_hand" doesn't work, and also I don't know how to specify in MBScript "move item/weapon", not just move something.