[5165] NPC help

04/23/2010 15:36 greasontim#1
I've tried following a guide [Only registered and activated users can see links. Click Here To Register...]
The NPC shows up on the map but doesn't say anything that im trying to get it to say, can someone help me out?

Trying to get it to sell MoonBoxs so i can stop haveing to changeing the Jobs for those testing stuff out for me on my server.

NPCDialog
Quote:
case 302030://Promotion
{
if (GC.MyChar.Inventory.Count <= 39)
{
GC.AddSend(Packets.NPCSay("Would you like to buy a MoonBox for 215 CP?"));
GC.AddSend(Packets.NPCLink("Yes.", 2));
GC.AddSend(Packets.NPCLink("No.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 2)
{
GC.MyChar.CPs -= 215;
GC.MyChar.AddSend(Packets.NPCSay("Heres your MoonBox"));
GC.MyChar.AddItem(721080);
GC.AddSend(Packets.NPCLink("Thank you.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
break;
}
#endregion
NPCs.txt
Quote:
302030 8099 2 28 1004 052 067
04/23/2010 17:17 xScott#2
Code:
case 302030://Promotion
{
[B][U]if (GC.MyChar.Inventory.Count <= 39)[/U][/B]
{
GC.AddSend(Packets.NPCSay("Would you like to buy a MoonBox for 215 CP?"));
GC.AddSend(Packets.NPCLink("Yes.", 2));
GC.AddSend(Packets.NPCLink("No.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 2)
{
GC.MyChar.CPs -= 215;
GC.MyChar.AddSend(Packets.NPCSay("Heres your MoonBox"));
GC.MyChar.AddItem(721080);
GC.AddSend(Packets.NPCLink("Thank you.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
break;
}
#endregion
NPCs should start with

Code:
If(Control == 0)
to check for inventory space i would do like
Code:
if (Control == 2 && GC.MyChar.Inventory.Count <= 39 )
{
}
You might also want to put a check on if the player has 215 or more CPs
04/23/2010 18:22 Paralyzer[GM]#3
Here it is fixed

Code:
#region MoonBox seller
     case 302030://Promotion
      {
        if (Control == 0)
        {
            if (GC.MyChar.Inventory.Count <= 39)
            {
                GC.AddSend(Packets.NPCSay("Would you like to buy a MoonBox for 215 CP?"));
                GC.AddSend(Packets.NPCLink("Yes.", 1));
                GC.AddSend(Packets.NPCLink("No.", 255));
                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                GC.AddSend(Packets.NPCFinish());
            }
            else
            {
                GC.AddSend(Packets.NPCSay("Please make some space in your inv"));
                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                GC.AddSend(Packets.NPCFinish());
            }
            if (Control == 1)
            {
                GC.MyChar.CPs -= 215;
                GC.MyChar.AddItem(721080, 1);
                GC.AddSend(Packets.NPCSay("Heres your MoonBox"));
                GC.AddSend(Packets.NPCLink("Thank you.", 255));
                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                GC.AddSend(Packets.NPCFinish());
            }
            else
            {
                GC.AddSend(Packets.NPCSay("You do not have enough CPs, You need 215CPs"));
                GC.AddSend(Packets.NPCLink("Ok.", 255));
                GC.AddSend(Packets.NPCSetFace(N.Avatar));
                GC.AddSend(Packets.NPCFinish());
            }
        }
          break;
      }
#endregion
04/23/2010 18:23 greasontim#4
still new to messing around with C# so yeah
so more the inventory count down to control 2
and change the first thing to control one
i'll change it once i get back on the other desktop
thank you
04/23/2010 19:24 Paralyzer[GM]#5
A +Thanks would be nice :D
04/24/2010 06:31 greasontim#6
Only thing left now to make it possible for people to play now is figure out why players lose all their skills and profs when they Reborn as well as why you don't get the reborn skills.

BTW is it even possible to setup a NPC to check your past classes?
04/24/2010 10:08 Paralyzer[GM]#7
erm I think it is becuase I was reading some code and there is atually a PreviousJob code but idk
04/24/2010 21:27 Arcо#8
Quote:
Originally Posted by greasontim View Post
Only thing left now to make it possible for people to play now is figure out why players lose all their skills and profs when they Reborn as well as why you don't get the reborn skills.

BTW is it even possible to setup a NPC to check your past classes?
if (gc.mychar.previousjob == )
04/24/2010 21:56 greasontim#9
can that check both previous jobs?