I'm doing the same thing to test the animations in the critter packs. I discovered that if you simply use the wield_obj or wield_obj critter and try to run the fire animations, the game crashes. However, if you do the following it works:
variable item;
item:=obj_carrying_pid_obj(self_obj,PID_VINDICATOR_MINIGUN);
wield_obj(item);
sound := sfx_build_weapon_name(snd_weapon_attack, item, hit_left_weapon_primary, self_obj);
reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate(self_obj, ANIM_fire_burst, -1);
reg_anim_play_sfx(self_obj, sound, 0);
reg_anim_end();
The
obj_carrying_pid_obj returns a pointer to an instance of the minigun. If you only do wield_obj you don't have the pointer and the game crashes when it runs the animation. However, if you edit the critter's instance (in the mapper), do an add to inventory, and place the minigun in a weapon slot, then it works without needing the obj_carrying_pid_obj and wield (since critter already has gun in hand). They did it the latter way in the cut scene (ecbdygrd.ssl). In my testing I want to be able to wield and unwield dynamically though, to test the melee and ranged weapons, and the above code seems to work. BTW the
sfx_build_weapon_name command is not in the mapper documentation, I guess they forgot to add that one.
Note however that dude_obj is a special case, it behaves differently than all the others. Not sure why you want to use dude_obj but your results may be different with that object. I created an instance of a male hero (dude_obj clone) and that seems to work. You want to make dude_obj fire this animation without the player controlling it? Are you making a cut scene or what?
I have a script that cycles through all of the animations (you can find a list of all of the animations in the mapper's \scripts\headers\animcomd.h). In my script, each time you click on (default action talk to) a critter, it plays the next animation in sequence. I will post the script source code later, still working on the other animations. I have the burst fire working.
I noticed that there are some jump suit animations that work with the FO1 FRMs but not FO2.
These are stair climbing animations:
ANIM_up_stairs_right
ANIM_up_stairs_left
ANIM_down_stairs_right
ANIM_down_stairs_left
If I copy the FO1 hmjmps/hfjmps FRMs to my patch, these stair animations work
(but I'm assuming the game engine doesn't use them in its movement routines).
The following animations don't seem to work with the hero characters:
ANIM_jump_begin
ANIM_jump_end
ANIM_falling
ANIM_magic_hands_up
ANIM_bad_landing
ANIM_bad_landing_sf
I also noticed that the female hero (hfjmps) doesn't have some of the animations that the male (hmjps) has.
I haven't figured out which types are missing but I have an FRM file comparison in this
spreadsheet.
EDIT: The above code worked for a single weapon type, but when I tried to switch between various weapons, I got errors unless I manually added the weapons to the critter instance using the Edit "Add to Inventory" function. The code below works for any weapon without requiring manual inventory editing:
variable item;
item:=create_object(PID_VINDICATOR_MINIGUN,0,0);
add_mult_objs_to_inven(dude_obj,item,1);
wield_obj(item);
sound := sfx_build_weapon_name(snd_weapon_attack, item, hit_left_weapon_primary, self_obj);
reg_anim_begin();
reg_anim_animate(self_obj,ANIM_fire_burst,-1);
reg_anim_play_sfx(self_obj, sound, 0);
reg_anim_end();