[ADVISE]Is this a correct start for NPC code?

12/05/2009 07:56 airborne.#1
The point of the NPC: If you have 40 Bronze Prizes, it takes them away, and then gives you Silver Prize. Is this a good start? I know it may not be and yes I know some stuffs missing, but can anyone finish it or tell me what do to next? I'm so tired 2 am I will check tomorrow sorry if this didn't make sense.

Code:
                            #region
                            case 300009:
                                {
                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("If you give me 40 Bronze Prizes, I can give you 1 Silver prize, deal?"));
                                        GC.AddSend(Packets.NPCLink("Sure", 1));
                                        GC.AddSend(Packets.NPCLink("Just passing by.", 255));
                                        GC.AddSend(Packets.NPCSetFace(30));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 1)
                                    {
                                        if (GC.MyChar.InventoryContains(2100055, 40)) // Checks if you have 40 Bronze Prizes
                                        {
                                        GC.MyChar.AddItem(2100065, 0); //Adds Silver Prize
                                        GC.MyChar.RemoveItem(GC.MyChar.NextItem(2100055)); // Removes the 40 Bronze Prizes from inventory
                                    }
                                    break;
                                }        
                            #endregion
12/05/2009 11:30 ~*NewDuuDe*~#2
Well, it would work.
What would you want done next? All you gotta do is add for example:

Code:
GC.AddSend(Packets.NPCSay("Congratulations! You have successfully purchased a SilverPrize"));
                                        GC.AddSend(Packets.NPCLink("Thank you!", 255));
                                        GC.AddSend(Packets.NPCSetFace(30));
                                        GC.AddSend(Packets.NPCFinish())
I suppose you could do a little quest about it, but if you are panning on having them get 40 BronzePrices, that might be a lot of trouble, lol.

But if you are planning to do so you may do something like add a random item to the inventory as a quest item then make another NPC which has the inventorycontains check and then do another dialoge, add a new item and go back to the first guy.
12/05/2009 12:03 Korvacs#3
Code:
                            case 300009:
                                {
                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("If you give me 40 Bronze Prizes, I can give you 1 Silver prize, deal?"));
                                        GC.AddSend(Packets.NPCLink("Sure", 1));
                                        GC.AddSend(Packets.NPCLink("Just passing by.", 255));
                                        GC.AddSend(Packets.NPCSetFace(30));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 1)
                                    {
                                        if (GC.MyChar.InventoryContains(2100055, 40)) // Checks if you have 40 Bronze Prizes
                                        {
                                            GC.MyChar.AddItem(2100065, 0); //Adds Silver Prize
                                            GC.MyChar.RemoveItem(GC.MyChar.NextItem(2100055)); // Removes the 40 Bronze Prizes from inventory
                                        [COLOR="Red"][B]}[/B][/COLOR]
                                    }
                                    break;
                                }
You missed a bracket. (The one marked in red)
12/05/2009 13:31 Basser#4
Quote:
Originally Posted by Korvacs View Post
Code:
                            case 300009:
                                {
                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("If you give me 40 Bronze Prizes, I can give you 1 Silver prize, deal?"));
                                        GC.AddSend(Packets.NPCLink("Sure", 1));
                                        GC.AddSend(Packets.NPCLink("Just passing by.", 255));
                                        GC.AddSend(Packets.NPCSetFace(30));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 1)
                                    {
                                        if (GC.MyChar.InventoryContains(2100055, 40)) // Checks if you have 40 Bronze Prizes
                                        {
                                            GC.MyChar.AddItem(2100065, 0); //Adds Silver Prize
                                            GC.MyChar.RemoveItem(GC.MyChar.NextItem(2100055)); // Removes the 40 Bronze Prizes from inventory
                                        [COLOR="Red"][B]}[/B][/COLOR]
                                    }
                                    break;
                                }
You missed a bracket. (The one marked in red)
First thing I noticed as well.
12/05/2009 15:31 airborne.#5
Quote:
Originally Posted by BERGHUIS1 View Post
Well, it would work.
What would you want done next? All you gotta do is add for example:

Code:
GC.AddSend(Packets.NPCSay("Congratulations! You have successfully purchased a SilverPrize"));
                                        GC.AddSend(Packets.NPCLink("Thank you!", 255));
                                        GC.AddSend(Packets.NPCSetFace(30));
                                        GC.AddSend(Packets.NPCFinish())
I suppose you could do a little quest about it, but if you are panning on having them get 40 BronzePrices, that might be a lot of trouble, lol.

But if you are planning to do so you may do something like add a random item to the inventory as a quest item then make another NPC which has the inventorycontains check and then do another dialoge, add a new item and go back to the first guy.
Yeah it is, a quest.

Anyway lmao, I tested the quest for the first time and when I talk to it with 40 Bronze Prizes it leaves a blank space in my inventory and when I relog, then it shows it's a Silver Prize.