[Release] NPC that gives stuff

05/14/2009 08:39 ih8you#1
Don't flame me for this

I coded this with a little help from pete ninja

This goes in Client.cs search for 7500 :
Code:
                                                        if (CurrentNPC == 4008)
                            {
                                if (Status == 8)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Hello i give you Full sets of +12 -15 2 soc super gems. Which class do you want."));
                                    SendPacket(General.MyPackets.NPCLink("Trojan.", 1));
                                    SendPacket(General.MyPackets.NPCLink("Warrior.", 2));
                                    SendPacket(General.MyPackets.NPCLink("Archer.", 3));
                                    SendPacket(General.MyPackets.NPCLink("Taoist.", 4));
                                    SendPacket(General.MyPackets.NPCLink("I dont need any, bye.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());

                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("You ain't no GM"));
                                    SendPacket(General.MyPackets.NPCLink("oh ok, bye", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
Now for the control

This goes in Client.cs search for 7500 again
Code:
                                                        if (CurrentNPC == 4008)
                            {
                                if (Control == 1)
                                {

                                    MyChar.AddItem("137310-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("410339-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("480339-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("420339-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("160249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("120249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("150249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("117399-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("2100025-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("191305-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("181755-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    SendPacket(General.MyPackets.NPCSay("Here you go enjoy your knew items =D"));
                                    SendPacket(General.MyPackets.NPCLink("Thanks alot, bye", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 2)
                                {

                                    MyChar.AddItem("137310-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("561339-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("530339-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("480339-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("160249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("120249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("150249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("117399-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("900499-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("2100025-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("191305-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("181755-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    SendPacket(General.MyPackets.NPCSay("Here you go enjoy your knew items =D"));
                                    SendPacket(General.MyPackets.NPCLink("Thanks alot, bye", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 3)
                                {

                                    MyChar.AddItem("137310-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("500329-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("160249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("120249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("150249-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("117399-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("2100025-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("191305-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("181755-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    SendPacket(General.MyPackets.NPCSay("Here you go enjoy your knew items =D"));
                                    SendPacket(General.MyPackets.NPCLink("Thanks alot, bye", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 4)
                                {

                                    MyChar.AddItem("137310-12-15-255-3-3", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("421339-12-15-255-3-3", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("121249-12-15-255-3-3", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("112649-12-15-255-3-3", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("152259-12-15-255-3-3", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("160249-12-15-255-3-3", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("2100025-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("191305-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    MyChar.AddItem("181755-12-15-255-13-13", 0, (uint)General.Rand.Next(36457836));
                                    SendPacket(General.MyPackets.NPCSay("Here you go enjoy your knew items =D"));
                                    SendPacket(General.MyPackets.NPCLink("Thanks alot, bye", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
I dont know how to make it so you can only get them once. it saves GMS typing them seperatly.

if (Status == 8) <---- Change the 8 to what ever the GM status is on your server

press thanks if u like my 2nd code ^^

EDIT

Where should i go from NPC's becuase this is only my 2nd release, and i just started learning
05/14/2009 10:21 2coolforu2#2
I"ll give you +k because you are trying contribute and help other members.
05/14/2009 12:09 PeTe Ninja#3
ok you have a few problems there you are doing the else for the controls so it wont read it at all....do the else for the status and if i was you i would do the else at the beginning for the main dialog so like... here...

Code:
if (CurrentNPC == 4008)
                            {
                                if (Status == 8)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Hello i give you Full sets of +12 -15 2 soc super gems. Which class do you want."));
                                    SendPacket(General.MyPackets.NPCLink("Trojan.", 1));
                                    SendPacket(General.MyPackets.NPCLink("Warrior.", 2));
                                    SendPacket(General.MyPackets.NPCLink("Archer.", 3));
                                    SendPacket(General.MyPackets.NPCLink("Taoist.", 4));
                                    SendPacket(General.MyPackets.NPCLink("I dont need any, bye.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());

                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("You ain't no PM!"));
                                    SendPacket(General.MyPackets.NPCLink("SORRY!", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }

and that way you can take out all the if status == 8 and else or just fix the elses
05/14/2009 17:08 ih8you#4
Quote:
Originally Posted by PeTe Ninja View Post
ok you have a few problems there you are doing the else for the controls so it wont read it at all....do the else for the status and if i was you i would do the else at the beginning for the main dialog so like... here...

Code:
if (CurrentNPC == 4008)
                            {
                                if (Status == 8)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Hello i give you Full sets of +12 -15 2 soc super gems. Which class do you want."));
                                    SendPacket(General.MyPackets.NPCLink("Trojan.", 1));
                                    SendPacket(General.MyPackets.NPCLink("Warrior.", 2));
                                    SendPacket(General.MyPackets.NPCLink("Archer.", 3));
                                    SendPacket(General.MyPackets.NPCLink("Taoist.", 4));
                                    SendPacket(General.MyPackets.NPCLink("I dont need any, bye.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());

                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("You ain't no PM!"));
                                    SendPacket(General.MyPackets.NPCLink("SORRY!", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }

and that way you can take out all the if status == 8 and else or just fix the elses
Thanks,i only added the else and status when i was posting it =] i'll fix it

@2coolforu2 thanks =D
@pete could u help me with making it so u can only get one set of items once, because i made a similiar npc to this for normal players, and rite now they can get them over and over again
05/14/2009 21:23 PeTe Ninja#5
Quote:
Originally Posted by ih8you View Post
Thanks,i only added the else and status when i was posting it =] i'll fix it

@2coolforu2 thanks =D
@pete could u help me with making it so u can only get one set of items once, because i made a similiar npc to this for normal players, and rite now they can get them over and over again
sure just PM me