Native that get the task/actions a ped is currently using

Can you guys point me into any usefull NATIVE to get the task or action an npc and player is doing ?

If a player is sitting… if an npc is walking… if an npc is smoking… dancing… whatever…

I want to interfer with the npc in a script and then do something smarter than just “dismiss as no longer usefull”. like if the npc was smoking… i task him again to keep smoking after the script…

ultimatly… in a multi char server i got… i would leave the char #3 as a cloned npc doing the last action he was doing at the switching time… while i spawn char#4 (who can see the clone char #3 where i left it)

If you know any usefull native that could help, you are more than welcome to help… i already tried multiple night to read “everything” in the native… task… get_ped_* played with GetPedConfigFlag… i cant find it…

This allows you to check for tasks (including a list of available ones) GetIsTaskActive - FiveM Natives @ Cfx.re Docs

And this is just for animations: IsEntityPlayingAnim - FiveM Natives @ Cfx.re Docs

2 Likes

I guess i could experiment… quickly looking at the native… IS_ENTITY_PLAYING_ANIM… i would have to know the dict and animName of the ped im scanning…

I am trying to make a fonction that will return me … this ped current dict and current anim is X or Y… to reaaply later the same action to the ped once im done with other commands…

maybe i could list a lot of “supported” dict and anim and only scan for those actions that fits my needs…

Thanks a lot for your input Kiminaze… could be the answer i was looking for… i just dont know yet without experimenting… and its 1000x more than what i have left to test on my own… good shit. thank you

Rockstar usually gives TaskWander to the peds that are no longer needed. It’s a more lore-friendly way of getting rid of the NPCs.
Kiminaze’s way will allow to make more seamless interactions tho.

Agreed, that is what i want to replace… and what i use now… but if if enter the Vanilla Unicorn and start to sell drugs to everybody that are “watching” the show… they all get out of the club “wandering” untill a smooth deletion…

the more i think about it… seem to be a working solution (Kimi suggestion)
I was expecting a pie in the sky solution like GetPedTask(ped) that would return the currently use actions…

Just hope to not get a TaskIndex == 12, lol

According to the list…

    CTaskAimGun = 12,
    CTaskComplex = 12,
    CTaskFSMClone = 12,
    CTaskMotionBase = 12,
    CTaskMove = 12,
    CTaskMoveBase = 12,
    CTaskNMBehaviour = 12,
    CTaskNavBase = 12,
    CTaskScenario = 12,
    CTaskSearchBase = 12,
    CTaskSearchInVehicleBase = 12,
    CTaskShockingEvent = 12,
    CTaskTrainBase = 12,
    CTaskVehicleFSM = 12,
    CTaskVehicleGoTo = 12,
    CTaskVehicleMissionBase = 12,
    CTaskVehicleTempAction = 12,

Lol!

Btw… have you tried using GetScriptTaskStatus - FiveM Natives @ Cfx.re Docs? It might spam you you TASK_ANY, but who knows