SA-MP Forums Archive
Making NPCs shoot people. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Making NPCs shoot people. (/showthread.php?tid=107753)



Making NPCs shoot people. - KKashimia - 10.11.2009

I've almost done it. I've created a function where npc is given a weapon, he is turned to the player direction and shooting animation is applied. There is also a tiny explosion for the shot and if a player is close enough to the bot, server will decrease his health and add a blood coming out object for a second. Looks pretty realistic. The only problem yet is that my bot won't hold a gun when I give it to it. (GivePlayerWeapon). How do I make it hold the gun? Don't tell me the only way to do this is to create an object with a gun model...


Re: Making NPCs shoot people. - Gergo1352 - 10.11.2009

Give the weapon to the NPC before you start recording the .rec file.


Re: Making NPCs shoot people. - KKashimia - 10.11.2009

You see.. this is not actually a NPC playing back a record. If it was playing a record, I wouldn't be able to turn it (Set it's facing angle) and I really need that. Also these bots are moved dynamicly (with setplayerpos and animations) and if I start playing the recording, the bot will automaticly snap to the place where it was recorded. I don't need that.


Re: Making NPCs shoot people. - Gergo1352 - 10.11.2009

Right, then I must say the only way is attaching a gun object to the NPC.