How to check if a critter object has a particular animation?

Magnus

Water Chip? Been There, Done That
Modder
I'm using the hs_deathanim2 hook script to change the death animations for melee weapons.
But since that script doesn't validate the animation, I need to check if the dying critter actually has the animation art (robots, for example, don't burn to death).

I'm doing something like this in the script:

Code:
if (target == dude_obj or art_exists((obj_art_fid(target) bwand 0xfff0ffff) bwor (ANIM_sliced_in_half * 0x10000))) then begin

where target is the critter pointer. But it's not working.
Anyone got any ideas why?

If it isn't obvious what I'm doing, I'm inserting the code for the animation (in this case 0x1C) into the corresponding bits of the critter's FID, according to this article: http://falloutmods.wikia.com/wiki/File_Identifiers_in_Fallout
The result should point to this death animation for that critter, but I guess maybe that's not how you're supposed to do it?
 
Last edited:
@Magnus, try this code instead of the one you're using (0xfff0ffff works just for weapon anims I think):

Code:
 #define anim_art_exists(anim_type, critter)                         art_exists((obj_art_fid(critter) bwand 0xff000fff) bwor (anim_type * 0x10000))
 
Last edited by a moderator:
@Magnus, try this code instead of the one you're using (0xfff0ffff works just for weapon anims I think):

Code:
 #define anim_art_exists(anim_type, critter)                         art_exists((obj_art_fid(critter) bwand 0xff000fff) bwor (anim_type * 0x10000))

Ah yes, I made a typo, I'm actually using 0xff00ffff as the critter mask, because I read that the anim ID is supposedly 8 bytes.

Does this work then? Why the three 0's?
 
Last edited by a moderator:
Hmm, it's just the way phobos showed it to me (you probably know more about it than I do tbh).

Funny thing is, when I tried it out with ANIM_sliced_in_half, it didn't work for me either, so I told him it didn't work... whereas I tested it later with ANIM_kick_leg, and that seems to work perfectly.

I need to do some extra testing I guess.

edit:

in the case of kicking, at least, it doesn't seem to matter whether you use two or three 0's:

Code:
    display_msg("" + art_exists((FID_MACLAW bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MALIEN bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MAMURT bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MASCP2 bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MAPLNT bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_NMMAXX bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_NMLTHR bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MAFEYE bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MAGKO2 bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));

returns

Code:
0
1
0
0
0
1
1
0
1

in both cases
 
Last edited:
Hmm, it's just the way phobos showed it to me (you probably know more about it than I do tbh).

Funny thing is, when I tried it out with ANIM_sliced_in_half, it didn't work for me either, so I told him it didn't work... whereas I tested it later with ANIM_kick_leg, and that seems to work perfectly.

I need to do some extra testing I guess.

edit:

in the case of kicking, at least, it doesn't seem to matter whether you use two or three 0's:

Code:
    display_msg("" + art_exists((FID_MACLAW bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MALIEN bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MAMURT bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MASCP2 bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MAPLNT bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_NMMAXX bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_NMLTHR bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MAFEYE bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));
    display_msg("" + art_exists((FID_MAGKO2 bwand 0xff00ffff) bwor (ANIM_kick_leg * 0x10000)));

returns

Code:
0
1
0
0
0
1
1
0
1

in both cases

Oh that's annoying. I've been slicing up those poor, innocent Slavers with a 200 damage wakizashi for no reason.

If I can't get this to work I'll have to restrict the anims on kill type. As far as I know it's only robots that don't have any of them, and for non-humanoids I'll have to change the fire dance to a fire "poof", plus some other things.

This is why I like your critter and item generator.
 
Last edited:
After some more testing, it does indeed seem that all the "regular" animations (anim code 0-19) work fine with the above code, but that all the death (and hit) animations simply return 0 all the time...

We need some separate address for them I guess, any idea @phobos2077?
 
Aha!

If you take a look at ANIMCOMD.H you'll see that the anims up to 20 are called "basic animations", separated from the rest.
Furthermore, in the table on this [strike]unintelligible mess[/strike]page it lists the death animations from 20 and up differently than the others.

So I'm guessing we have to fiddle a bit more with the FID rather than just splicing in the animation code into ID2 (the fifth and sixth hex digits from the right). Possibly we need to change ID1 (the fourth hex digit, i.e. the one you set to 0 when checking for weapon anims) as well.

Or maybe @phobos2077 has the answer...
 
Last edited by a moderator:
SUCCESS!!!! AHAHAHAHAH!

(obj_art_fid(target) bwand 0xff00ffff) bwor (ANIM_sliced_in_half * 0x10000 + 0x10000000)

:lmao:
The death animations are stored in FRX files (where X is a number), not FRM! And THAT means the four most significant bytes must contain an 1 according to that page I linked earlier! Since the death animations exist in all six orientations we only need to check for the 1.

AND NOW IT WORKS!
 
Last edited:
Yah, I'm testing using the Ama No Murakumo at the moment (wakizashi blade with sick damage and hit bonus, strictly for testing of course). I can make critters get sawn in half, exploded, have their torso punched out etc. with melee weapons now, and it'll safely return their standard animation if the critter doesn't have what I'm looking for. One step closer to greatness...
 
Back
Top