kalitonchik

Whot about pursue ped?

Recommended Posts

I offer you develope pursue ped script.

To my mind this is poppy-proof function.

Can you imagine?

-You are ped enemy and you need escape from infuriated pedestrians to survive.

-Crazy chase.

-Avoid from ped, and take fun.

Just first step - creating vehicle and warp ped into it

function setupForPed ( ) 
local APed = createPed ( 282, 2327, 1394.5, 43 ) 
local AVehicle = createVehicle ( 598, 2327.5, 1394.5, 43 ) 
warpPedIntoVehicle ( APed, AVehicle ) 
end 
addCommandHandler ( "getin", setupForPed ) 

i tryed use that event - but this don't work

addEventHandler ( "onResourceStart", getRootElement(), setupForPed ) 

Whot functions need to make ped fallow the player?

-setPedControlState?

-some PedTarget function?

That is real for embodiment?

-I think this is exciting topic...

Share this post


Link to post

You want a ped in a vehicle to chase you? You don't need a pedTarget function, you do need some freak ass calculations though.

- You need to see where objects are, so you don't collide with em

- You need to see where the player is, and at what angle the vehicle should drive

- You need to see the rotation of the car, to make sure you're correcting him correctly and if he didn't already drive past you

- You need some other stuff

I can tell ya this will not be easy. Although there was a snippet for scripted ped driving on the scripting board somewhere... Try to find it, and see what you can use from it.

Share this post


Link to post

okey but

after all

i need know how move pedestrian vehicle from poit A to point B

some thing like that

function setupForPed ( ) 
local APed = createPed ( 282, 2327, 1394.5, 43 ) 
local AVehicle = createVehicle ( 598, 2327.5, 1394.5, 43 ) 
warpPedIntoVehicle ( APed, AVehicle ) 
[color=#BF00FF]moveVehicle(AVehicle, 1000, 2327.5, 1513, 43 )[/color] 
end 
addCommandHandler ( "getin", setupForPed ) 

some thing licke that

Share this post


Link to post

Just keep in mind that the math used in this example is really rough and dirty. I am sure most of it can be done in less lines of script. But it may help you anyway.

Share this post


Link to post

Thanks i cheanged vehicle to ngr and tuped another posX and Y but ngr dont drive 100% straight ahead

but it okey

Share this post


Link to post
Thanks i cheanged vehicle to ngr and tuped another posX and Y but ngr dont drive 100% straight ahead

but it okey

The reason it doesn't go in a straight line is because the update interval is not fast enough to correct the turn velocity. The vehicle is constantly "pushed" in the right direction but it "overshoots" the facing angle because it can't correct the heading fast enough. Ideally you would do this client-side every time a new frame is rendered. But because there is no such thing server-side it looks as if it's swinging from left to right.

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

  • Recently Browsing   0 members

    No registered users viewing this page.