Joe_ Posted April 24, 2012 Share Posted April 24, 2012 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. Link to comment
iFoReX Posted April 24, 2012 Share Posted April 24, 2012 if u want create a ped and spawn u need it ped = createPed( Skin, PosX, PosY, PosZ ) and if u have other script, post Link to comment
Joe_ Posted April 24, 2012 Author Share Posted April 24, 2012 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. Link to comment
iFoReX Posted April 24, 2012 Share Posted April 24, 2012 (edited) mm... u want Attach the ped on a object ? EDIT : if u want use it u need use it function attachElements( thePed, theObject ) Edited April 24, 2012 by Guest Link to comment
Joe_ Posted April 24, 2012 Author Share Posted April 24, 2012 No, the peds spawn, and sometimes they are stuck INSIDE a GTA SA world object. Link to comment
NextGenRP Posted April 24, 2012 Share Posted April 24, 2012 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. Link to comment
DiSaMe Posted April 24, 2012 Share Posted April 24, 2012 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. Link to comment
Joe_ Posted April 25, 2012 Author Share Posted April 25, 2012 Thanks everyone, that worked Slothman. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now