[FS/INC] Attacking NPCs -
Tannz0rz - 01.11.2009
For those of you whom like to complain that NPCs don't have the potential to attack, stop complaining. You might want to edit your own script to place stationary NPCs around the server. The default way to set a NPC's position is with "/getnpc". Also, if you wish to throw off his accuracy a bit, just go to line 89 and change the dOffset value to whatever you want.
EDIT: Players can now shoot at and kill the NPC, though be warned, he has a nice chunk of hp.
What he does: he faces the closest player that is within 30 units to him, and shoots at said player.
It was requested that I simply turn this into a function, and so I did such. I've also left up the old one for those of you whom don't want to bother with the include.
Function-
CreateAttackingNPC
Create an attacking npc at a specific location.
Parameters-
npcname, the NPC you wish to make an attacking NPC
Float
, the NPC's X position
Float:y, the NPC's Y position
Float:z, the NPC's Z position
Float:AttackRadius (default: 60 units), the npc's firing distance
Float:Accuracy (default: 10 degrees), the npc's firing accuracy
Example on how to use it (you MUST use a timer):
pawn Код:
#include <a_samp>
#include <attacking_npc>
#define FILTERSCRIPT
public OnFilterScriptInit()
{
ConnectNPC("Attack_NPC", "1");
return 0;
}
//We make sure that the NPC spawns before we make it an attacking NPC
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
if(playerid == GetPlayerID("Attack_NPC")) SetTimer("AttackNPC", 5000, 0);
}
return 0;
}
forward AttackNPC();
public AttackNPC()
{
CreateAttackingNPC("Attack_NPC", 0.0, 0.0, 0.0);
return 0;
}
Video (sorry, no audio!):
SAMP Attacking NPC
Download (old):
Download (new):
You also need this include (a_angles):
EDIT: some people have had some problems regarding the creation of their own attacking NPCs, due to the lack of a NPC file, so I'll provide you all with one here:
Have any suggestions for any future updates? Post em' here.
Enjoy.
Re: [FS] Attacking NPCs -
joemomma53 - 01.11.2009
damn dude, this is awesome.
It's great to see people are using NPC's to their full advantages
Re: [FS] Attacking NPCs -
SergiKirov - 01.11.2009
Sexy job! i likie
Re: [FS] Attacking NPCs -
[TG]Chase - 01.11.2009
Good job!! Now we need a way to kill npcs with guns.
Re: [FS] Attacking NPCs -
Tannz0rz - 01.11.2009
Quote:
Originally Posted by Chaser98
Good job!! Now we need a way to kill npcs with guns.
|
Good suggestion. I'll begin working on that.
Re: [FS] Attacking NPCs -
Tannz0rz - 01.11.2009
Main post updated, the NPC is now killable as well.
Re: [FS] Attacking NPCs -
Striker_Moe - 02.11.2009
FUCK! EPIC!
Iґll be using THAT for sure. Thanks!
Re: [FS] Attacking NPCs -
mini-d - 02.11.2009
Dude you are an epic scripter you should consider selling your scripts
Re: [FS] Attacking NPCs -
Striker_Moe - 02.11.2009
Quote:
Dude you are an epic scripter you should consider selling your scripts
|
True, I would have bought that.
Re: [FS] Attacking NPCs -
Matthew_Murdoch - 02.11.2009
Can someone mirror this please
Re: [FS] Attacking NPCs -
Tannz0rz - 02.11.2009
Thanks for the comments all.
Re: [FS] Attacking NPCs -
Striker_Moe - 02.11.2009
Iґve made one working a bit different, but acting pretty similar to yours. Thanks for the idea!
Re: [FS] Attacking NPCs -
Burridge - 02.11.2009
Hmm, I MUST look into this, this looks very interesting. Nice work, indeed.
Would you like a mirror?
Re: [FS] Attacking NPCs -
[03]Garsino - 02.11.2009
Gonna use this =)
Re: [FS] Attacking NPCs -
Zigulys400 - 02.11.2009
this is awesome. nice job
Re: [FS] Attacking NPCs -
SpiderPork - 02.11.2009
Awesome! I'm downloading this now.
Re: [FS] Attacking NPCs -
Tez2k7 - 02.11.2009
Wow great work, maybe this script could be edited to see if a certain player is near that they may pass him without him attacking... hmm. RP IDEA!
Re: [FS] Attacking NPCs -
Tannz0rz - 02.11.2009
Quote:
Originally Posted by Tez
Wow great work, maybe this script could be edited to see if a certain player is near that they may pass him without him attacking... hmm. RP IDEA!
|
Its doable. Shouldn't take more than 1 line of code, lol. Could be used for guards at police departments and so forth.
Re: [FS] Attacking NPCs -
lolumadd - 02.11.2009
You mind making a new link and taking away a .7z file so I may download?
Kthanx.
Re: [FS] Attacking NPCs -
Evoturk - 02.11.2009
Great job! It is very good! Thank you!
But Link is dead Upload
www.solidfiles.com please