Any way to get the animation name/dict a ped is playing?
-
@CamxxCore I see you do stuff in C#, is there any way you or any other person make some mem edit function that can give me the animation name and dict a ped is playing?
-
@AHK1221 Pretty sure you can't recover the string. Only the hash in the peds task manager instance.
-
@AHK1221 See? I told you
You'll need to access CPedTaskManager which has CTaskComplexControlMovement, CTaskScriptedAnimation, CTaskPlayerOnFoot, CTaskPlayerIdles, etc. but you can only get the hash.
-
@AHK1221 @Unknown-Modder On second thought... you actually could recover the animation name but not the dictionary. The "_.clip" file name is stored in the 'crClipAnimation' instance so you could just look up the dictionary in the internal asset store and get a substring which would in pretty much any case, be the actual name of the animation. 90% positive you can't get the dictionary name though. Ultimatley, that probably wouldn't matter since you could just use a dictionary/ map considering most of the dictionary names are public knowledge.
-
@CamxxCore what?
-
@Unknown-Modder what do you mean hash?
-
@CamxxCore Thought about something like that too but it wouldn't work in many cases since there are hundreds of anims with the same name but with a different dict.
-
Are the dictionaries hashed? If so you could just look up the animation from a manually hashed map of those, and retrieve the name for both the dictionary and the name.
-
@ikt That seems like a good idea. But isn't that the same as just doing IS_ENTITY_PLAYING_ANIM and passing in all the anims?
-
@Unknown-Modder But if you can get the dictionary hash and its string via a hashtable it wouldn't matter, right? You can map the dictionary names and get the animation name from the instance of the asset. Obviously mapping the animation names themselves would be a pain.
-
@CamxxCore So..... is it possible?
-
@CamxxCore Also, fun fact. For some reason, the native IS_ENTITY_PLAYING_ANIM doesn't return true for non-scripted animations, i.e. animations played by the game itself. So, I don't even have a plan B anymore
-
@AHK1221 Well, are you okay with just having the animation name? I can make a wrapper that lets you get that. But like I mentioned, you will only be able to get the dictionary in hashed form.
-
@CamxxCore If you could get me that hashed dictionary a ped is playing as well, that's great
I can make the dictionary map myself. Also, they are hashed using the JOAAT algorithm right?
-
@AHK1221 yeah, edited my response. We would be able to get the name and dictionary as a hash.
-
@CamxxCore yeah that's great!
-
Is it joaat (or some other known hash function)? If so, you can just dump some list of animation names and some list of dictionary names to have something to match with.
-
@ikt I already have a list of animations, I'm using the SceneAnimations.txt file provided in the scene director mod, by @elsewhat.
-
@ikt Yes it's joaat. It's just that there are so many animation names... making a dictionary would be somewhat of a pain.
-
@AHK1221 Give this a shot. Should be able to get the name like this:
var animationName = MemoryAccess.GetScriptedAnimationName(new IntPtr(ped.MemoryAddress));
Also updated with a method to get the dictionary hash..
-
@CamxxCore Will try, thanks a lot man! Really appreciate you taking the time out to do this stuff!!
-
@CamxxCore Didnt work, it returns "notask", not the animation name, although if I start the animation with something like a trainer, then it returns the animation name.
-
@AHK1221 It only returns the CTaskScriptedAnimation name. The function name is GetScriptedAnimationName.
-
@Unknown-Modder That's what I thought, is there not a way to get the "non"-scripted animation?
-
@AHK1221 Haven't looked into it yet but I think tasks like CTaskPlayerOnFoot don't store the name anywhere. (But that's just a first guess).