[Include] ARNPC - Advanced Recordfree NPC
#1

Advanced Recordfree NPC (ARNPC) -
Introduction

Hey everybody. Today I'm going to release my ARNPC (Advanced Recordfree NPC). I think this is going to be useful specialy for who is going to use NPC on their servers.
This include has many features and very simple to use. This include is based on Mauzen's RNPC plugin!


Why this?
Since many people (mostly the newbie) has a lot of problems on using the RNPC plugin itself, this include gives you a simple way to manage your NPCs.

How to install?
This include is very simple to install, you just need very basic knowlage of how SA-MP Server package is structured.
  • Copy "a_rnpc.inc & YSI folder" to "pawno\include" directory
  • Copy "rnpc.dll or rnpc.so" to your "plugins" directory
  • Copy "RNPC.amx and RNPC.pwn (optional)" to your "npcmodes" directory
That's all. Now just go to your Gamemode/Filterscript and include the library using
pawn Code:
#include <a_rnpc>
on the top as any other include.



Changelog
Code:
  • 02/02/2013 - 1.0 Beta release
  • 02/02/2013 - 1.0 RC1 release: - Fixed bug when npc moves the guns disappear.
  • 05/02/2013 - 1.0 RC2 release:
    - Fix: SetRNPCHealth and SetRNPCArmour works perfectly
    - Add: SetRNPCSkillLevel function
    - Add: OnRNPCDeath callback
    - Fix: RNPC_StopPlayback is now WORKING!
    NOTE: Re-download RNPC.pwn & RNPC.amx and put them on npcmodes folder if you're running RC1 or less.
  • 14/02/2013 - 1.1 Stable release
    - Add: RNPCFollowPlayer
    - Add: RNPCShotAt / RNPCAimAt
    - Add: SetRNPCVehicleSiren / GetRNPCVehicleSiren
    - Fix: Fixed problem when a NPC connect with a previous ID it starts with the previous record.
    - Fix: Fixed npc angle on spawn point
    - Add: RNPCStopUseWeapon
  • 21/08/2013 - 1.1 R2 Review version
    - Now NPCs can connect even on loop (remember that npcs will connect itself after all them load)
    - Fixed when OnPlayerConnect gets called once on multiple connections
    - Added a simply Virtualworld for NPCs
Functions & Callbacks
pawn Code:
Functions
/*
// core
native CreateRNPC(npcname[])
native DestroyRNPC(npcid)
native IsPlayerRNPC(npcid)
native GetRNPCID(npcid)
native GetRNPCState(npcid)
native GetRNPCName(npcid)
native SetRNPCVirtualWorld(npcid, worldid)
native GetRNPCVirtualWorld(npcid)

// vehicle controls
native PutRNPCInVehicle(npcid, vehicleid, seatid) // not working with 0.2.1 plugin
native RemoveRNPCFromVehicle(npcid) // not working with 0.2.1 plugin
native SetRNPCVehicleSiren(npcid,vstate)
native GetRNPCVehicleSiren(npcid)

// on foot controls
native SetRNPCSkin(npcid, skin)
native SetRNPCPos(npcid, Float:x, Float:y, Float:z)
native GetRNPCPos(npcid, &Float:x, &Float:y, &Float:z)
native MoveRNPC(npcid, Float:x, Float:y, Float:z, Float:speed) // taken from the original rnpc include
native SetRNPCFacingAngle(npcid, Float:angle)
native SetRNPCHealth(npcid, health) // remember the health value must be an integer and not working with 0.3 plugin
native GetRNPCHealth(npcid)
native SetRNPCArmour(npcid, armour) // remember the armour value must be an integer and not working with 0.3 plugin
native GetRNPCArmour(npcid)
native SetRNPCWeapon(npcid, weaponid)
native GetRNPCWeapon(npcid)
native SetRNPCSkillLevel(npcid, skill, level)

// npc actions
native RNPCWalkTo(npcid,Float:X,Float:Y,Float:Z);
native RNPCRunTo(npcid,Float:X,Float:Y,Float:Z);
native RNPCSprintTo(npcid,Float:X,Float:Y,Float:Z);
native RNPCAimAt(npcid,Float:X,Float:Y);
native RNPCShotAt(npcid,Float:X,Float:Y);
native RNPCStopUseWeapon(npcid);
native RNPCDriveTo(npcid,Float:X,Float:Y,Float:Z,Float:speed);
native RNPCFollowPlayer(npcid, targetid, movemode = RNPC_SPEED_SPRINT)

// .rec part
native RNPC_StartPlayback(npcid, rec[])
native RNPC_StopPlayback(npcid)
native RNPC_StartBuildPlayback(npcid, slot=0, vehicleid=0)

*/


Callbacks
forward OnRNPCCreated(npcid);
forward OnRNPCDestroyed(npcid);
forward OnRNPCSpawn(npcid);
forward OnRNPCPlaybackFinished(npcid); // it's usable but already called so DO NOT uncomment this
forward OnRNPCDeath(npcid);
Download
Click here to download 1.1 R2 Package (includes, RNPC Plugin 0.3.1, YSI package)
Click here to watch the gamemode tested with this include - pastebin. (GM edited as with 1.1R2 version

Bugs
PutRNPCInVehicle works only with driver sits.

Notes
  • IF YOU USE A TIMER WITH ANY FUNCTION KILL THEM BEFORE USING A NEW ONE!
  • THIS INCLUDE WAS TESTED ONLY WITH 0.3e and (not R2) and 0.3x SERVER.
  • THIS INCLUDE NEEDS y_hooks.
  • DO NOT USE RNPC PLUGIN BELOW 0.3 VERSION.
  • SOMETIMES THE NPCS MAY NOT BE SYNCED WELL.
  • THE GAMEMODE .pwn FILE REQUIRES EXTRA INCLUDES THAT THE PACKAGE DOESN'T INCLUDE.
  • PLEASE DO NOT REMOVE ANY CREDITS FROM THE INCLUDE.
Sserver Notes
  • Use "RemoveRNPCFromVehicle" if a NPC is in a car, before using another function.
  • When multiple npcs get connected the order of connection may be wrong
  • Since this include and the plugin either have not a damage system whatsoever I can't/ I have not time for a good one. You can take a look HERE.. - Thanks to [uL]Pottus

Credits
Me for the include
Mauzen for his RNPC Plugin and Joe Staff's code based.
****** for y_hooks.
Reply
#2

Nice.
Reply
#3

Good work. Whenever I see the RNPC function, I mistook it with the RPC function on network(Remote Procedure Call).
Reply
#4

Awesome release, just what I was looking for! Great job!!
Reply
#5

Nice.
Reply
#6

YES!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ......... THIS IS WHAT I BEEN WAITING FOR
Reply
#7

Really useful i may be converting my functions to this.
Reply
#8

Nice
Reply
#9

SuperB Script!
Reply
#10

It's nice but I'd wait for Kalcor to introduce a revamped NPC system in the future than use the plugin. The CPU level with the plugin is unless you can memory edit the samp-server (which would need consent from sa-mp team) and make it not use the samp-npc.

Nice job anyway.
Reply
#11

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
It's nice but I'd wait for Kalcor to introduce a revamped NPC system in the future than use the plugin. The CPU level with the plugin is unless you can memory edit the samp-server (which would need consent from sa-mp team) and make it not use the samp-npc.

Nice job anyway.
Indeed, anyone here wants something more than this limited standard functions for NPCs. However CNPC does the job but you have to pay for it :/ ...
Reply
#12

Please update to the new version, it's more stable than the previous one.
Reply
#13

Why I didn't saw this topic before D: I'm gonna test this today Good work.
Reply
#14

Yeah, good work.
Reply
#15

Okay, @TheArcher: I noticed some functions didn't worked, i mean; RNPCAimAt, RNPCDriveAt, .. doesn't compile in your script. It says it's undefined, but i have

pawn Код:
#include <a_rnpc>
Or did i forgot something ?

I'm trying to make a police backup

[ame]http://www.youtube.com/watch?v=chV8ZQitPOA[/ame]
Reply
#16

DriveAt and Aim/Shot At are not implemented yet :/ , I did an update these days and in few hours I'll update the include . The features will be:

add: RNPCFollowPlayer
add: RNPCShotAt / RNPCAimAt / RNPCStopAim
add: SetRNPCVehicleSiren
Reply
#17

Include just updated, please update it I changed many things in the script so it's gonna be stable

P.S Sorry for double posting I just wanted to announce the new update
Reply
#18

Good job
Reply
#19

Okay What about "RNPCStopFollowPlayer" and "RNPCDriveTo(Player)", "RNPCStopDrive"
Reply
#20

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Okay What about "RNPCStopFollowPlayer" and "RNPCDriveTo(Player)", "RNPCStopDrive"
Well I guess now I'm going to develop vehicle functions, the bad thing is that since I don't have Path calculation DriveTo will go straight to the point no better of the obstacles or if the car is on the road. I'll might planning to use GPS Plugin.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)