[NPC] Jeff the Paranoid - Grenade Dealer
#1

Hi guys, wrote an NPC, called Jeff the Paranoid, located in Willowfield, LS

The guy is selling grenades to player.

- Dialogs used for the shop;
- Shop opens on key pressing;
- NPC movements are recorded in parts to add some messages;
- Meant to be used with gl_chatbubble, If not, u should add specific chatbubble scripts by urself, so it wont spam the global chat;
- Some code used from taxitest and gl_actions;
- needs to be tested!!!

Known bugs:

- NPC responses only 1 player at once, looks like it cannot be fixed while current response method is used;
- I failed to record animations, so it can't smoke and perform some other actions;
- response method is still buggy, cuz it was taken from taxi_test npc and wasn't meant to be used like this

Video:

Download:
www.filehosting.org
www.mediafire.com
www.rapidshare.com

*IMPORTANT* Mirrors are welcome.

*IMPORTANT* You can use whatever you need with notifying me about it, except the name and style of my NPC. Create more MMO-style NPC's!!!

PS My English might not be perfect, excuse me


Reply
#2

Added a Video.
Reply
#3

looks nice
Reply
#4

I would consider completely re-writing the dialog portion and removing anything the NPC has to do on his own. All he should have to do is follow a recording and pause whenever someone is close enough. I don't see a reason for the NPC to tell the server if someone is able to buy or not, they should just have to be within range of the NPC.

A personal favorite method of Dialog use that I currently use.

pawn Код:
#define DIALOG_NONE 0
#define DIALOG_BUY 1
#define DIALOG_AFFIRM 2

pDialogID[MAX_PLAYERS];
pParameters[MAX_PLAYERS];

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  switch(pDialogID[playerid])
  {
    case DIALOG_NONE: return 1;
    case DIALOG_BUY:
    {
      if(!response)
      {
        pDialogID[playerid]=DIALOG_NONE;
        return SendClientMessage(playerid,0xFF0000FF,"See you around then.");
      }
      new string[128];
      format(string,sizeof(string),"Purchase %d grenades for $%d?",strval(inputtext),25*strval(inputtext));
      pParameters[playerid]=strval(inputtext);
      pDialogID[playerid]=DIALOG_AFFIRM;
      ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Purchase Grenades",string,"Accept","Nevermind");
    }
    case DIALOG_AFFIRM:
    {
      if(!response)
      {
        pDialogID[playerid]=DIALOG_BUY;
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Purchase Grenades","How many?","Purchase","Nevermind");
        return 1;
      }
      new string[128];
      GetPlayerName(playerid,string,sizeof(string));
      format(string,sizeof(string),"Thanks %s.   Purchased %d grenades for $%d",string,pParameters[playerid],25*pParameters[playerid]);
      SendClientMessage(playerid,0xFF0000FF,string);
      GivePlayerMoney(playerid,0-25*pParameters[playerid]);
      GivePlayerWeapon(playerid,16,pParameters[playerid]);
      pDialogID[playerid]=DIALOG_NONE;
    }
  }
  return 0;
}
To activate that you just do
pawn Код:
pDialogID[playerid]=DIALOG_BUY;
ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Purchase Grenades","How many?","Purchase","Nevermind");
You don't have to use that, but it should diminish your problem of single patron use.
Reply
#5

There's still one thing I didn't understood, looks like npc responces the same way? Actually that's the reason of 1-patron-at-time bug.

*UPDATE* Could you make an npc with your methods so I could watch the whole process step by step?
Reply
#6

I'm not sure what in your script would cause single player use, but my method is allowing for player specific dialogs and shouldn't interfere with any other players. IF it still does then it's not the dialogs that's causing the issue.
Reply
#7

It's not the dialog thing, I'm sure. But thank you anyway, u gave me some new ideas what to change to make Jeff better.
Reply
#8

Added a mirror link.
Reply
#9

Can you maybe add a pastebin link, please?
Reply
#10

Really nice
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)