SA-MP Forums Archive
NPC Help - 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 Help (/showthread.php?tid=641479)



NPC Help - StrikerZ - 16.09.2017

Alright, so, how do we actually set the flying NPCS to the ground using ColAndreas?


Re: NPC Help - StrikerZ - 17.09.2017

Bump


Re: NPC Help - StrikerZ - 17.09.2017

Quote:
Originally Posted by DBZdabIt3Bro7
Посмотреть сообщение
I'd suggest to use FCNPC, and then use the native;


And the rest is relatively easy to solve.
PHP код:
new Float:xFloat:yFloat:z;
CA_FindZ_For2DCoord(xyz);
SetMyPos(npcidxyz);
// Or
FCNPC_SetPosition(npcidxyz); 
FCNPC gives you a lot bigger control over NPC's than what you already got.
Already using FCNPC, and if I use that everytime, I guess the zombie will go under ground, well let me check it out


Re: NPC Help - StrikerZ - 17.09.2017

PHP код:
new Float:xFloat:yFloat:znewFloat:z;
GetPlayerPos(npcidxyz);
CA_FindZ_For2DCoord(xyznew);
FCNPC_SetVelocity(npcid,x,y,znew); 
The zombie gets tped to somewhere else, a far away place tho.


Re: NPC Help - StrikerZ - 17.09.2017

Tried using FCNPC_GetPositon now but still the issue is same.


Re: NPC Help - StrikerZ - 17.09.2017

It still disappears.
PHP код:
new Float:xFloat:yFloat:zFloat:unused;
                
FCNPC_GetPosition(npcidxyz);
                new 
Float:zx,Float:zy;
                
GetXYInFrontOfPlayer(npcidzxzy5.0);
                new 
Float:angle;
                
GetPlayerFacingAngle(npcid,angle);
                new 
Float:newx 0.0Float:newy 0.0Float:znew;
                
CA_FindZ_For2DCoord(newxnewyznew);
                
FCNPC_SetVelocity(npcid,x,y,znew);
                
                if(
CA_RayCastLineAngle(xyzzxzyzunusedunusedunusedunusedunusedunused))
                {
                    
                    
FCNPC_Stop(npcid);
                    
printf("Wall"); //debug
                    
SetPVarInt(npcid,"Ignore",1);
                } 
Here's the full code, that raycast code is for avoiding walls but yeah that can be wrong too, because I'm new to ColAndreas