Sign in to follow this  
davedavy

Samp npc record

Recommended Posts

Is there a way to use samp npc records in mta? Because i need to make a automatic driving bus.

Sorry for bad english.

Share this post


Link to post

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.

Share this post


Link to post

Not at the moment because there is no script to do this and no informations about the samp .rec files structure =)

Share this post


Link to post

unfortunately nothing better can be found at the moment :(

Share this post


Link to post

One last question:

If a ped ride to some coordinates, does automatically follow the way?

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

Greetz

Share this post


Link to post

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

Share this post


Link to post

I want a server side script. But if i need to script all coordinates, that takes hours? Right?

Share this post


Link to post

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

Share this post


Link to post
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:

Share this post


Link to post

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

Share this post


Link to post
you can create a EDF and add them using map editor

Very good Idea

Share this post


Link to post

I can help you for your own system

:D

So the ped drives into markers? ( If i understand it right )

Share this post


Link to post

Drives ? lol not walk ?

Yes you can make this system for drivers too so yes you have understand :lol:

Share this post


Link to post

Can you to create a code for a vehicle ( so not a walking ped :P )

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

Share this post


Link to post

Personaly I don't need a code for a vehicle :lol:

Try to make it yourself then I can help you.

I help for free but I don't work for free :mrgreen:

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.