Jump to content

[c]How to get a random ped and attach a blip?


Recommended Posts

I've tried with this

 

 

[...]ped1 = World.GetRandomPed(Player.Character.Position, 20.0f);blip1 = ped1.AttachBlip();[...]

 

 

With this code i get a "blipped" random ped for 2 seconds....then the blip disappears. Don't know why. Moreover when i quit the game there's a kind of freeze....i've to quit with ctrl+alt+canc.....I'm sure the entire code is not wrong because if i change just the random ped part with a World.CreatePed etc. the script works fine and the game quits normally.

 

I'd like to get a random ped in a random position in one of the 4 islands.....so 20 as radius is low i know....but if i increase it then i don't see the blip even for a second. I think it's because the game try to pick a ped in some parts of the city that haven't been loaded yet....but that's just my guess.

 

 

 

Thanks in advance.

Link to comment
https://gtaforums.com/topic/468743-chow-to-get-a-random-ped-and-attach-a-blip/
Share on other sites

Thats right, there is 'no life' in the parts that you are not.... Otherwise the game would be unplayable. The game streams 'life' into view when you drive through the streets. It calculates in a sphere around you.

So there's no way?

Well i think it should work atleast until the ped get removed by the game > when you get to far away from it. Dont know if the code is right (not coding for a while now), but looks good.

 

What i would do is just place a Blip at a coord on a other island/part of the city, and when you get close switch it to a ped.

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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.