TaskCombatPed

Hello members. I am having issues getting the following function/Event to trigger in my program. Here is the list of commands that am using:

 local ped = 1

 fighterPed = CreatePed(
                        -- pedType -- Unused --[[ integer ]],
                        pedtypes,

                        -- modelHash -- Model of the ped to spawn --[[ Hash ]],
                        GetHashKey(model),

                        -- x coordinates --[[ number ]],
                        posx,

                        -- y coordinates --[[ number ]],
                        posy,

                        -- z coordinates --[[ number ]],
                        posz,

                        -- heading -- heading to face towards, in degrees --[[ number ]],
                        heading,

                        -- isNetwork -- affects duplicate peds. Online dups Offline no dupes --[[ boolean ]],
                        false,

                        -- bScriptHostPed -- whether to register the ped as pinned to the script host in the R* network model --[[ boolean ]]
                        false
                )
TaskCombatPed(fighterPed, ped, 0, 16)

What happens is that the NPC drops in fine. But it never moves or attempts to attack the player. I thought that it may be an issue with client.lua. vs server.lua. So I set up an event handler for the server side using server.lua. Got the same result. Nothing… Now when I tried other client side Tasks* functions like hands up. It works fine. See that command below.

TaskHandsUp(fighterPed, 10000, ped, -1, 1000)

Hey,

At the top of your script i see local ped = 1,
Have you tried to replace it with local ped = PlayerPedId()?

Thanks, I figured it out. I messed up the order of the peds.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.