Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (85,416 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

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

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

    2. Site Suggestions

Sign in to follow this  
Ezio Baggins

Help with GET_SCRIPT_TASK_STATUS and GET_IS_TASK_ACTIVE

Recommended Posts

Ezio Baggins

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.

Share this post


Link to post
Share on other sites
aimless

GET_SEQUENCE_PROGRESS

Share this post


Link to post
Share on other sites
Ezio Baggins

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

Share this post


Link to post
Share on other sites
Ezio Baggins

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

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