Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Setting tasks for peds?

Featured Replies

Does anyone know how to set tasks for peds? Like telling them to do certain things?

You can use Ped.Tasks.<task>, but there are plenty more tasks than what are provided with the RAGE Hook. I use natives for most of my tasks, as a large amount of tasks, such as attacking peds or fleeing, aren't included in Ped.Tasks. You can use the GTA V Native DB, and expand the "AI" section, and find the tasks you want.

Example, to make a ped flee from the player, use the following (taken from the native db):

void TASK_REACT_AND_FLEE_PED(Ped ped, Ped fleeTarget)

The native db shows the parameters, and the name of the native. You'd then use this information to do the following:

 

Rage.Native.NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", <yourfleeingped>, Rage.Game.LocalPlayer.Character);

Hopefully this was pretty simple, I'm not the best at explaining things. Taking a look at that native db will be really useful.

 

Edited by Straysify
Added native db link

Developer of the original Bait Car for LSPDFR!

Download it here

 

 

  • Author

Thanks! That was a big help! @Straysify could you help me with one more thing? I have not figured out how to get a ped to do an animation.

Edited by nicedude80

The best LSPD officer in San Andreas.

Thanks! That was a big help! @Straysify could you help me with one more thing? I have not figured out how to get a ped to do an animation.

Check out the animations list in the Rage documentation: http://docs.ragepluginhook.net/html/62951c37-a440-478c-b389-c471230ddfc5.htm

And the PlayAnimation function of TaskInvoker: http://docs.ragepluginhook.net/html/4DB19EAA.htm

And a basic code example... 

(This is very rough, you'll want to add error checking and what not. And my project is in VB.NET, I've translated it into C#, so my C# syntax might be rusty)

Ped myPed = new Ped("ModelName", SpawnPoint);

if (myPed != null)
{
    if (myPed.Exists)
    {
        // Make the ped walk like he is drunk
        AnimationSet animSet = new AnimationSet("move_m@drunk@verydrunk");
        animSet.LoadAndWait();
        myPed.MovementAnimationSet = animSet;
        
        // Playing an animation
        // The list of hyperlinks on the Rage Anim list page is a list of Anim Dictionaries
        // Each one has a set of animation names underneath it
        // "amb@world_human_bum_standing@drunk@idle_a" is the dictionary name
        // And "idle_a" is the anim name
        // I'm not exactly sure how blend speed (not anim speed, but apparently its the speed that the anim blends in) affects anything, but I just set it to 1
        // Anim flags tells GTA to loop the anim, or ragdoll the ped when something hits it, etc.
        // The object browser or Rage docs can tell you all the AnimationFlags

        myPed.Tasks.PlayAnimation(New AnimationDictionary("amb@world_human_bum_standing@drunk@idle_a"), "idle_a", 1f, AnimationFlags.RagdollOnCollision);
    }
}

 

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

  • 4 weeks later...

If it works the way I think it does (haven't tested to verify, I'm basing this off of experience with other things using animation blending) low values like 0.1 would make the animation blend more slowly (and possibly extend duration of the overall animation, not sure how that works completely in GTA V) and values like 10 would pretty much get rid of noticeable blending and sort of snap between animations.

Unless there's good reason it's probably best to leave it at 1 like you did.

Edited by goigle

  • 2 weeks later...

You can use Ped.Tasks.<task>, but there are plenty more tasks than what are provided with the RAGE Hook. I use natives for most of my tasks, as a large amount of tasks, such as attacking peds or fleeing, aren't included in Ped.Tasks. You can use the GTA V Native DB, and expand the "AI" section, and find the tasks you want.

Example, to make a ped flee from the player, use the following (taken from the native db):

void TASK_REACT_AND_FLEE_PED(Ped ped, Ped fleeTarget)

The native db shows the parameters, and the name of the native. You'd then use this information to do the following:

 

Rage.Native.NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", <yourfleeingped>, Rage.Game.LocalPlayer.Character);

Hopefully this was pretty simple, I'm not the best at explaining things. Taking a look at that native db will be really useful.

 

Can you show the context as to how this would look in a complete script? I tried pasting it into the callout example verbatim and it crashed.

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

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.