Jump to content

Samp npc record


davedavy

Recommended Posts

If you make a script which reads rec files, then yes, but it looks like there's no rec file format description. But why to use it rather than making your own recording/playing script with your own format?

And you can also make the NPC perform real actions with setPedControlState. When bot is playing the recording in SA-MP, it cannot be physically affected (for example, hitting the car won't change its speed). In MTA, bots can be physically affected, so it's more realistic.

Link to comment
  • Moderators

No he never follows the way himself, YOU have to tell him other coordinates before if you want that your ped stay on the road.

And what script should I use? ( I mean; like setElementVelocity )

You want to make this script in server-side or client-side ?

In server-side, all players can see this ped if you want or only one

In client-side, only 1 player can see this ped

Link to comment

for the coordinates you can create a EDF and add them using map editor, yours script will read it from the map file.

to made it full server side you need to attach vehicle to an obiect and move the obiect, it will be synced but it will ignore the world physics.

example:

using controlle states on element syncer client is a better way(moving element on syncer client wil synchronize it for all clients).

example:

Both methods require the creation of simple AI, obstacle detection is a different story...

Link to comment
for the coordinates you can create a EDF and add them using map editor, yours script will read it from the map file.

to made it full server side you need to attach vehicle to an obiect and move the obiect, it will be synced but it will ignore the world physics.

example:

using controlle states on element syncer client is a better way(moving element on syncer client wil synchronize it for all clients).

example:

Both methods require the creation of simple AI, obstacle detection is a different story...

Woow thanks, is there any tutorial how to create carbots or edf files? Or is there any edf file downloadable?

Sorry for bad english :oops:

Link to comment
  • Moderators

Yeah that takes a very long time and 428 ( It's the real number of marker positions that I have ) doesn't cover entire LS

You need:

  
createPed 
setElementID 
createMarker 
setPedAnimation(pedwalk, "ped", "WALK_civi", -1, 1, 1, 0) -- Anim Walk 
onMarkerHit 
setElementRotation or setPedRotation 

a lot of positions ^^

and this useful function ( it set the rotation of the specified ped ):

function pedIARot(thePed, x, y, z) 
    x = tonumber(x) 
    y = tonumber(y) 
    local px, py, pz = getElementPosition( thePed ) 
    X = math.abs( x - px ) 
    Y = math.abs( y - py ) 
    faceM = math.deg( math.atan2( Y , X ) ) 
    if ( x >= px ) and ( y > py ) then      -- north-east 
        faceM = 90 - faceM 
    elseif ( x <= px ) and ( y > py ) then  -- north-west 
        faceM = 270 + faceM 
    elseif ( x >= px ) and ( y <= py ) then -- south-east 
            faceM = 90 + faceM 
    elseif ( x < px ) and ( y <= py ) then  -- south-west 
        faceM = 270 - faceM 
    end 
    setPedRotation(thePed,(360-faceM)) 
end 

I can help you for your own system

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...