Creating NPCs with RNPC.inc
#1

Most of the time, you can not figure out how to completely control the npcs and they often face discussions like, "which includes should I use, what is better than another .. etc". Just recently, I've tried several different includes and asked for opinions, and many more that others have suggested it includes. So I did my own research, and I just could not figure out how to connect with a npcs it includes. Someone who has experience in this regard, it might be courteous and do a basic explanation of how to use this includes ..?!

Thank you.

edit, here you can see all that regard this .inc

https://sampwiki.blast.hk/wiki/Rnpc
Reply
#2

well you could find alot of filterscripts,which create NPCs ingame,and keep this in mind,the easiest way to get npcs is to use npc_record filterscript,just load it and go ingame,write /record [filename]and do whatever you want the npc to do,when you finish do /finishrecord ,then go to scriptfiles and copy the filename you wrote and paste it at npcmodes/records
then go to pawno and make a new .pwn folder and put this in it:
pawn Код:
#define RECORDING "the filename you saved" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
then compile it and save it in npcmodes,and under ongamemodeinit:
pawn Код:
public OnGameModeInit()
{
  ConnectNPC("name of the npc","filename");
  return 1;
}
and OnPlayerSpawn,detect if the player is npc which means if it's the npc you created:
pawn Код:
public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
    if(!strcmp(npcname, "npcname", true)) //Checking if the NPC's name is the name of your npc,the one you created
    {
      // this is the npc,do whatever to him,if you want him to drive a car put him in the car.. or do anything you want
    }
    return 1;
  }
  return 1;
}
Reply
#3

...why don't read ?! I have write about RNPC include, i know how connect NPCs with a_npc.
Reply
#4

well,even if you want RNPC,i am telling you about what is the best to use,and showed you a small tutorial,thats all
Reply
#5

You have copied an tutorial that i have already read. In my topic i have write about a full controllable npc..

Meh.
Reply
#6

Well i didnt say that i made the tutorial,i just pasted it here to explain for you,btw most if these npc includes dont work,by the way good luck finding one
Reply
#7

Quote:
Originally Posted by XK
Посмотреть сообщение
Well i didnt say that i made the tutorial,i just pasted it here to explain for you,btw most if these npc includes dont work,by the way good luck finding one
Thanks anyways for your help..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)