Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Contract
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Help with GET_SCRIPT_TASK_STATUS and GET_IS_TASK_ACTIVE


Ezio Baggins
 Share

Recommended Posts

I am creating a Ped and making it follow a TaskSequence.

 

List<Vector3> Locations = GetLocationToRunTo();//returns list of vectors that i want my Ped to follow

TaskSequence sequence = new TaskSequence();

sequence.AddTask.TurnTo(Locations[0],1000);

sequence.AddTask.FollowPointRoute(Locations.ToArray());

sequence.Close(false);

Ped.Task.PerformSequence(sequence);

 

Now I want to know at what all times the player is doing the Task "FollowPointRoute",

so that when it ends, I want to make some calculations and make the Ped follow another PointRoute and so on.

 

 

----------------------------

What I tried, (GET_IS_TASK_ACTIVE)

bool flag = Function.Call<bool>(Hash.GET_IS_TASK_ACTIVE, Ped, (int)209);
(from natives description : https://pastebin.com/2gFqJ3Px: 209 - CTaskMoveFollowPointRoute)
But it always returns false.
Just to check if this native function is working I tried,
added additional tasks, like jump or hands up.
and tried,
for (int value = 0; value <= 1000; ++value)
{
bool flag2 = Function.Call<bool>(Hash.GET_IS_TASK_ACTIVE, Ped, (int)value);
if (flag2 == true)
UI.Notify("Flag2 : " + flag2.ToString() + " : " + value.ToString());
}
Just as expected, it returned true for values 0,420,421.(0 for hands up, 420,421 for jump)
--------------
What I tried, (GET_SCRIPT_TASK_STATUS)
int nextflag = Function.Call<int>Hash.GET_SCRIPT_TASK_STATUS, Ped, 0xb232526f);
(from natives description : https://pastebin.com/R9iK6M9W: 0xb232526f - TASK_FOLLOW_POINT_ROUTE )
But this always returns '7', meaning the specified task is not assigned to the ped.
Similarly to last try, I added Hands up and Jump tasks to check if this native function is working properly,
TASK_HANDS_UP - 0xa573b67c
TASK_JUMP - 0x24415046
But it always returns 7, irrespective of GET_SCRIPT_TASK_STATUS task hashes.
So, there is something wrong in what I am trying to do, or the native function is not working properly or task hashes or not updated ?.
-------------
Note : the above functions are used "OnTick", to check in every frame for the specified task is running or not.
Please help.
Thank you.
Link to comment
Share on other sites

GET_SEQUENCE_PROGRESS

Thank you, this definitely works to my needs.

But in anycase,

we need more clarity on GET_SCRIPT_TASK_STATUS and GET_IS_TASK_ACTIVE and how to use these functions.

At least GET_IS_TASK_ACTIVE is returning values according to tasks,

but GET_SCRIPT_TASK_STATUS always returns "7". :p

I hope someone knows, so that it would be helpful for other modders regarding the same.

Edited by Ezio Baggins
Link to comment
Share on other sites

Previously, I was using ScriptHookDotNet v2.10.1

I shifted to ScriptHookDotNet v3 and tried again.

And functions started working, idk why.

 

These are my results under the newer scripthook version.

Edit : MY understanding of these functions

 

I am performing the ped task using a TaskSequence class.

 

For "GET_IS_TASK_ACTIVE"

when my player was doing

task "hands up" :

CTaskHandsUp : True :: 0 : Flag number

CTaskUseSequence : True :: 32 : Flag number

task "turn to coord"

CTaskDoNothing : True :: 15 : Flag number
CTaskUseSequence : True :: 32 : Flag number

CTaskComplexControlMovement : True :: 35 : Flag number
CTaskTurnToFaceEntityOrCoord : True :: 225 : Flag number

task "follow point route"

CTaskDoNothing : True :: 15 : Flag number
CTaskUseSequence : True :: 32 : Flag number
CTaskComplexControlMovement :: True : 35 : Flag number

(according to what i expected CTaskMoveFollowPointRoute(209) should also be true, maybe that flag is for something else)

 

For "GET_SCRIPT_TASK_STATUS"

When performing task using Ped.Task.PerformSequence(sequence);

Only flag "TASK_PERFORM_SEQUENCE = 0x0e763797" was != 7 during the sequence.

Rest of all the flags returned 7.

Reason : Initially I thought a sequence was just a combination of tasks individually, so I thought that native functions of each task are called one after another. But that is not the case.

(however for "GET_IS_TASK_ACTIVE" it returns true for both CTaskUseSequence and CTaskHandsUp/or any other task.)

 

To confirm,

I just created a Ped, and made him perform a task, not a task sequence.

For "hands up" only flag "TASK_HANDS_UP = 0xa573b67c" was !=7 as expected.

For "jump" only flag "TASK_JUMP = 0x24415046" was !=7 as expected.

"TASK_PERFORM_SEQUENCE = 0x0e763797" was == 7, when calling the Ped.Tasks individually as expected.

 

Hope this helps other modders also.

Edited by Ezio Baggins
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.