SA-MP Forums Archive
NPC bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: NPC bug (/showthread.php?tid=646815)



NPC bug - NealPeteros - 24.12.2017

Is there any way for NPCs to detect a building? I'm having this bug wherein if I'm being chased by NPCs and I'm below a building/any place I'm covered by a building, it teleports the NPC to the top of the building. Can this be avoided?

Preview of bug:

*******


Re: NPC bug - Ritzy2K - 24.12.2017

This isn't a bug. You're probably using MapAndreas, right? It gets the highest z from ground.
You can use ColAndreas for this.


Re: NPC bug - NealPeteros - 24.12.2017

Yeah, MapAndreas. So, I'll replace MapAndreas to ColAndreas?


Re: NPC bug - Ritzy2K - 24.12.2017

Yes, and you will also have to use the Raycast function.


Re: NPC bug - NealPeteros - 24.12.2017

Could you...like...help me out, send a small tutorial? Thanks.


Re: NPC bug - Ritzy2K - 24.12.2017

I haven't really worked with AI NPC's a lot either.

This is from ToiletDuck:

Use RayCastLine x y z , targetx, tagerty,targetz when it returns to true then it means there is a wall between of it or there is IsPlayerBlock function use that.

x y z > GetPlayerPos(playerid) then Targetx,y,z = GetPlayerPos(targetid)

I hope you understand. or use 3dtryg of abyss use IsElementBetweenwall I forgot what is that function again lol


Re: NPC bug - NealPeteros - 24.12.2017

I got it a little, might need more. Dw, I'll do sone research. Thanks!