Jump to content

Ped/bot spawning


Joe_

Recommended Posts

Posted

Hi guys,

I've came across a problem with bots that I cannot find a way around with my limited LUA knowledge.

I am spawning X number of peds/bots around a player and then making them attack/hunt the player they spawned within radius of, but the problem is, some peds will get stuck in objects such as trees and sharp hills. Is there any way to detect when this happens and fix it? I've looked over the wiki and can't see any function that could help, but as I said, I only have limited knowledge of LUA.

Thanks in advance.

Posted

I already have a custom, fully working spawning system, but the problem is, the bots like to get stuck (or shall I say spawned) into/on objects.

Posted (edited)

mm... u want Attach the ped on a object ?

EDIT : if u want use it u need use it function

attachElements( thePed, theObject ) 

:D

Edited by Guest
Posted

Im not sure of all the MTA functions but i suppose this is probably the noob way around it, create markers where the peds are spawning that you dont want them too and if the ped is in the marker then destroyElement(pedvariable) or maybe you should use a col shape. I don‘t know if this is the best option but it can work. Another way would be to create an edf for the spawn points of the peds then they will only spawn in places you choose, Take a look at the zombie resource by slothman if your not sure.

Posted

You can try using:

isLineOfSightClear 
processLineOfSight 

to detect obstacles. When the obstacle is blocking the way, change ped's direction. That should be enough for a simple obstacle-avoiding AI.

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