SA-MP Forums Archive
Fighting NPC`s ? - 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: Fighting NPC`s ? (/showthread.php?tid=407102)



Fighting NPC`s ? - demonarn - 12.01.2013

Is it possible to make a npc that if you come into a certain range fights you?

If possible how ?

I couldnt anything on the forum that wasnt 2 years old or didnt say i couldnt kill npcs.


Re: Fighting NPC`s ? - Mr.Anonymous - 12.01.2013

An example would be this: https://sampforum.blast.hk/showthread.php?pid=1979226#pid1979226


Re: Fighting NPC`s ? - demonarn - 12.01.2013

Quote:
Originally Posted by Mr.Anonymous
Посмотреть сообщение
Would it be possible to make them attack you with fists and the most important can they die ?


Re: Fighting NPC`s ? - papedo - 12.01.2013

they canґt die.. but you can try script Detecting damage for NPCs


Re: Fighting NPC`s ? - demonarn - 12.01.2013

Like a getNPChealth or something ?


Re: Fighting NPC`s ? - Mr.Anonymous - 12.01.2013

Quote:
Originally Posted by demonarn
Посмотреть сообщение
Would it be possible to make them attack you with fists and the most important can they die ?
I guess yes because we can set their weapon by
pawn Код:
// Set weapon
RNPC_SetWeaponID(22);
So maybe set the ID to 0, that is, fist.


Re: Fighting NPC`s ? - Kitten - 12.01.2013

Quote:
Originally Posted by Mr.Anonymous
Посмотреть сообщение
I guess yes because we can set their weapon by
pawn Код:
// Set weapon
RNPC_SetWeaponID(22);
So maybe set the ID to 0, that is, fist.
You forgot to note the RNPC Plugin.

Create a variable for the NPC, decrease it while they get shot if the variable is set where you want the npc to die, do the npc dead animation or whatever you do when the NPC dies.


Re: Fighting NPC`s ? - demonarn - 12.01.2013

Yea.. And then we need the npc to get health..

Would it then be possible to assign a variable to the npc like npchealth[npcid] = 100
and with every hit we assign damage with the weapons we have in the server?