[Include] Controllable NPC - 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: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Controllable NPC (
/showthread.php?tid=301370)
Re: Controllable NPC -
TheArcher - 09.07.2012
The old plugin which was CNPC was deleted due to license violating. You can try the new one
HERE
Re: Controllable NPC -
Scarface34 - 24.08.2012
Thank You.
Re: Controllable NPC -
Lordzy - 08.12.2012
Nice one.
Re: Controllable NPC -
Sasino97 - 08.12.2012
One of the best includes ever
Re: Controllable NPC -
Sasino97 - 10.12.2012
EDIT: I found a bug in your code:
pawn Code:
stock Npc: GetClosestNPC(playerid) // This function contributes to the above, as said, to chase a player :D
{
new
Float: fDistance,
Float: fHighest,
Npc: iPlayer = INVALID_CNPC
;
foreachcnpc(npcid)
{
fDistance = GetDistanceBetweenPlayerAndNPC(playerid, npcid);
if(fDistance > fHighest) fHighest = fDistance, iPlayer = Npc: npcid;
}
return iPlayer;
}
It was getting the highest distance, not the lowest lol, I lost a lot of time with my GM, I was trying to understand what made my bot not to work good. However that code will work if someone has only 1 CNPC.
The good code is:
pawn Code:
new Float: fDistance,
Float: fLowest = 10000.0,
Npc: iPlayer = INVALID_CNPC
;
foreachcnpc(npcid)
{
fDistance = GetDistanceBetweenPlayerAndNPC(playerid, npcid);
if(fDistance < fLowest) fLowest = fDistance, iPlayer = Npc: npcid;
}
return iPlayer;
And will work also with 10 npcs
Re: Controllable NPC -
burnfire - 03.05.2013
This think is INCREDIBLE!The SA:MP team should replace the "a_npc" include with this one!!!I will test soon...Thanks!
Respuesta: Controllable NPC -
Swedky - 03.10.2013
Hello.
The Npc is created and everything, but when I order it to my position (SetNPCPos) it is as if it was invisible.
Regards.
Re: Controllable NPC -
xF4Life - 06.10.2013
an easy way to create NPC's nice job man
Re: Controllable NPC -
iBeast - 06.10.2013
Nice Job!
Re: Controllable NPC -
Weponz - 02.06.2014
The code is shocking, very sloppy, let alone no damage or death detection, and did you even think about NPC's attacking other players? lol...other than that good try.
Re: Controllable NPC -
Inn0cent - 02.06.2014
Thanks alot! I'll use this.