Adding NPC's and Adding Items in Shopping Mall

01/24/2012 21:53 pro4never#16
search

{ "/addnpc", Command_AddNpc },

That links to the Command_AddNpc method. Right click that and you see how it functions. In this case it takes 4 parameters.

UID Mesh Flag and Name
01/24/2012 22:25 warzie005#17
this is the command:

Code:
        private static bool Command_AddNpc(Player user, string[] data)
        {
            if (user.Permission < PlayerPermission.GM) return false;
            Npc npc = new Npc();
            npc.UID = uint.Parse(data[1]);
            npc.ID = npc.UID;
            npc.Name = data[4];
            npc.Mesh = ushort.Parse(data[2]);
            npc.Map = user.Map;
            npc.Location = user.Location;
            npc.Flag = byte.Parse(data[3]);
            user.Map.Insert(npc);
            Database.AddNpc(npc);
            return true;
So I need to use the UID, NAME, MESH and FLAG. I did that command. But that didn't worked.

Honestly I find that weird.

Now it is working. I don't know how it is possible but it is fixed. Thank you.

I only have one problem now. I want to let it speak, but when I add this into 300001.npc it isn't talking. I relogged in because otherwise it wouldn't work.

Mine Code:
Code:
def npc(Client, Option):
    if(Option == 0):
        Text("What? A group of Cattle Thieves Stole the Saddles of the cavalry! Without the")
		Text(" Saddles, they won't be able to hold any drills. If you can help get the saddles")
		Text(" from the Cattle Thieves, I might give you a Steed as reward!")
        Link("Here is the saddle.", 1)
		Link("Where are the thieves?", 255)
        Finish()
    if(Option == 1):
        Text("Thanks for bringing it back! Please choose from one of these steeds!")
		Link("Black Steed.", 255)
		Finish()
    return 0
Code of Already existing NPC:
Code:
def npc(Client, Option):
    if(Option == 0):
        Text("Do you want to leave the market? I can teleport you for free.")
        Link("Yeah. Thanks.", 1)
        Link("No, I shall stay here.", 255)
        Face(156)
        Finish()
    if(Option == 1):
        PreviousMap()
    return 0
What is wrong with mine code?
02/06/2012 03:54 Nyorai#18
Code:
def npc(Client, Option):
    if(Option == 0):
        Text("What? A group of Cattle Thieves Stole the Saddles of the cavalry! Without the")
        Text(" Saddles, they won't be able to hold any drills. If you can help get the saddles")
        Text(" from the Cattle Thieves, I might give you a Steed as reward!")
        Link("Here is the saddle.", 1)
        Link("Where are the thieves?", 255)
        Finish()
    if(Option == 1):
        if(Client.HasItem(723903)):
            Text("Thanks for bringing it back! Please choose from one of these steeds!")
            Link("Black Steed.", 2)
            Link("White Steed.", 3)
            Link("Maroon Steed.", 4)
            Finish()
        else:
            Text("I'm sorry but you don't have a Saddle!")
            Link("Ops, Sorry.", 255)
            Finish()
    if(Option == 2):
        Client.RemoveItem(723903)
        Client.AddItem(723859)
        Text("There you go, a you got a +1BlackSteedPack now!")
        Link("Thanks alot", 255)
        Finish()
    if(Option == 3):
        Client.RemoveItem(723903)
        Client.AddItem(723856)
        Text("There you go, you got a +1WhiteSteedPack now!")
        Link("Thanks alot!", 255)
        Finish()
    if(Option == 4):
        Client.RemoveItem(723903)
        Client.AddItem(723855)
        Text("There you go, you got a +1MaroonSteedPack now!")
        Link("Thanks alot!", 255)
        Finish()
    return 0
There you go, analyse it so you can see what you've done wrong please ;)

EDIT: By the way, it's adding +1 Packs since I was too lazy to make the +0Packs work ahah
03/17/2015 15:53 jschellekens#19
Wich table in the database i need to edit?
And is there and list with item id's?
03/17/2015 19:19 t0pr0#20
please be more specific. You can find all the id's that you need in the source.
03/17/2015 22:35 jschellekens#21
and if i edit shops? wich database table i need to edit?
03/19/2015 03:21 t0pr0#22
Editing the shops has to be done both client and server sided. What to edit, depends on the source. You have to set the cp price for the item in the shop in the itemtype table tho

Verstuurd van mijn P6-U06 met Elitepvpers, mogelijk gemaakt door appyet.com