Quantcast

Jump to content

» «
Photo

Ped Subtasks (Knowing if a ped is doing something specific)

5 replies to this topic
Eddlm
  • Eddlm

    Newie

  • Members
  • Joined: 24 Aug 2015
  • Spain

#1

Posted 07 May 2016 - 05:01 PM Edited by Eddlm, 07 May 2016 - 05:30 PM.

I figured out a lot of ped subtasks, and some of them are really useful. Here's what I've coded to know if a ped is doing something specific, like entering a car, aiming from cover, driving, etc.

 

I've found this knowedge specially useful to avoid tasking peds to do something they're already doing, like following the player or driving to a destination.

 

Written in C#.

    public enum Subtask
    {
        AIMED_SHOOTING_ON_FOOT = 4,
        GETTING_UP = 16,
        MOVING_ON_FOOT_NO_COMBAT = 35,
        MOVING_ON_FOOT_COMBAT = 38,
        USING_LADDER = 47,
        CLIMBING = 50,
        GETTING_OFF_SOMETHING = 51,
        SWAPPING_WEAPON = 56,
        REMOVING_HELMET = 92,
        DEAD = 97,
        MELEE_COMBAT = 130,
        HITTING_MELEE = 130,
        SITTING_IN_VEHICLE = 150,
        DRIVING_WANDERING = 151,
        EXITING_VEHICLE = 152,

        ENTERING_VEHICLE_GENERAL = 160,
        ENTERING_VEHICLE_BREAKING_WINDOW = 161,
        ENTERING_VEHICLE_OPENING_DOOR = 162,
        ENTERING_VEHICLE_ENTERING = 163,
        ENTERING_VEHICLE_CLOSING_DOOR = 164,

        EXIING_VEHICLE_OPENING_DOOR_EXITING = 167,
        EXITING_VEHICLE_CLOSING_DOOR = 168,
        DRIVING_GOING_TO_DESTINATION_OR_ESCORTING = 169,
        USING_MOUNTED_WEAPON = 199,
        AIMING_THROWABLE = 289,
        AIMING_GUN = 290,
        AIMING_PREVENTED_BY_OBSTACLE = 299,
        IN_COVER_GENERAL = 287,
        IN_COVER_FULLY_IN_COVER = 288,

        RELOADING = 298,

        RUNNING_TO_COVER = 300,
        IN_COVER_TRANSITION_TO_AIMING_FROM_COVER = 302,
        IN_COVER_TRANSITION_FROM_AIMING_FROM_COVER = 303,
        IN_COVER_BLIND_FIRE = 304,

        PARACHUTING = 334,
        PUTTING_OFF_PARACHUTE = 336,

        JUMPING_OR_CLIMBING_GENERAL = 420,
        JUMPING_AIR = 421,
        JUMPING_FINISHING_JUMP = 422,
    }

    public static bool IsSubttaskActive(Ped ped, Subtask task)
    {
        return Function.Call<bool>(Hash.GET_IS_TASK_ACTIVE, ped, (int)task);
    }

    public static bool IsDriving(Ped ped)
    {
        return (IsSubttaskActive(ped, Subtask.DRIVING_WANDERING) || IsSubttaskActive(ped, Subtask.DRIVING_GOING_TO_DESTINATION_OR_ESCORTING));
    }

If you're interested in finding more, simply do a for (0, 1000) and print all subtasks active in a subtitle or helptext, referencing your player or a ped of your choice, and then seeing what tasks are active when the ped does X.

That's how I did it.

 

There's a LOT of subtasks, but I couldn't figure out most of them, only these.

 

Warnings:

 

- Tasks that imply AI (MOVING_ON_FOOT_COMBAT, DRIVING_WANDERING) are always false for the player, but if the player is actually tasked to do them, they will be true. For example, all ENTERING_VEHICLE subtasks are applicable to the player, because it uses NPC AI to perform that action.

 

- DRIVING_GOING_TO_DESTINATION_OR_ESCORTING is always true for peds flying an helicopter. And planes probably, too.

  • jedijosh920, Jitnaught, frodzet and 2 others like this

Ivanno
  • Ivanno

    Player Hater

  • Members
  • Joined: 02 Apr 2016
  • Poland

#2

Posted 16 May 2016 - 01:00 PM Edited by Ivanno, 17 May 2016 - 04:41 PM.

Hi, thank you for the research.

I'm currently working on how we can execute a subtask to a PED. I can not find a specific function .. did you find it?


jedijosh920
  • jedijosh920

    ⭐⭐⭐⭐⭐

  • Members
  • Joined: 01 Mar 2012
  • United-States

#3

Posted 16 May 2016 - 09:28 PM

What the hell is a soustache?


Ivanno
  • Ivanno

    Player Hater

  • Members
  • Joined: 02 Apr 2016
  • Poland

#4

Posted 17 May 2016 - 04:44 PM

subtask, sorry

 

I looking for a way to apply a subtask on PED. (such as making him only to a slight attack, heavy attack)


PeterTheHacker
  • PeterTheHacker

    Player Hater

  • Members
  • Joined: 17 Oct 2015
  • Afghanistan

#5

Posted 19 May 2016 - 05:19 AM

http://pastebin.com/EirNYfrcthat seems to be a similar list. It's linked under the native's description on nativedb.


Eddlm
  • Eddlm

    Newie

  • Members
  • Joined: 24 Aug 2015
  • Spain

#6

Posted 11 June 2016 - 11:57 AM

http://pastebin.com/EirNYfrcthat seems to be a similar list. It's linked under the native's description on nativedb.

Yeah, these were my original findings (Check the paste's author).





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users