Quantcast

Jump to content

» «
Photo

Help with GET_SCRIPT_TASK_STATUS and GET_IS_TASK_ACTIVE

3 replies to this topic
Ezio Baggins
  • Ezio Baggins

    Player Hater

  • Members
  • Joined: 07 Jun 2017
  • India

#1

Posted 4 weeks ago

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.
 
 
 

aimless
  • aimless

    Crackhead

  • Members
  • Joined: 30 Jul 2015
  • United-States

#2

Posted 4 weeks ago

GET_SEQUENCE_PROGRESS

  • Ezio Baggins likes this

Ezio Baggins
  • Ezio Baggins

    Player Hater

  • Members
  • Joined: 07 Jun 2017
  • India

#3

Posted 4 weeks ago Edited by Ezio Baggins, 4 weeks ago.

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.


Ezio Baggins
  • Ezio Baggins

    Player Hater

  • Members
  • Joined: 07 Jun 2017
  • India

#4

Posted 4 weeks ago Edited by Ezio Baggins, 4 weeks ago.

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users