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

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

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

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

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. 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. 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. News

    2. Forum Support

    3. 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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 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.