Quote:
Originally Posted by n0mansland
Like ArtisanOu? I can't figure out how to make the NPC Check Items and Delete items but I do know how to make them add items though.. Think you could help me on that?
I'll help you try and figure out the socketing part.. I'm not sure what to put though but I'll try to figure it out..
Skills are too complicated :D
|
You don't know how to make it check and remove items?
Simple, just check how it's done in a met/db scroll maker or the met/db storage npc.
here's sample section of code I use for my met/db storage npc (it's modified from the one posted on here, it stores mets/db's as separate values in database and spits out how many you currently have stored
Code:
else if (LinkBack == 4)
{
int GMUID = 0;
int GMcount = 0;
foreach (Struct.ItemInfo Item in CSocket.Client.Inventory.Values)
{
if (Item.ItemID == 720028)
{
GMUID = Item.UID;
GMcount++;
}
}
if (GMcount >= 1)
{
DBPoint(+10, CSocket);
CSocket.Client.Inventory.Remove(GMUID);
CSocket.Send(ConquerPacket.ItemUsage(GMUID, 255, Struct.ItemUsage.RemoveItem));
Database.Database.DeleteItem(GMUID);
Database.Database.SaveMetPoint(CSocket);
Text("You know have " + CSocket.Client.DbPoint + " DbPoints", CSocket);
Link("Thanks", 255, CSocket);
Link("I have more", 5, CSocket);
End(CSocket);
}
else
{
Text("You Dont have the item", CSocket);
Link("Ok", 255, CSocket);
End(CSocket);
}
}
so the check part is simply
Code:
int GMUID = 0;
int GMcount = 0;
foreach (Struct.ItemInfo Item in CSocket.Client.Inventory.Values)
{
if (Item.ItemID == 720028)
{
GMUID = Item.UID;
GMcount++;
}
}
It's saying start with the id being 0 (so it gets the id during the foreach part) and count starts at 0
The item id is in there and it checks how many and counts them up.
The remove part of the code is simply
Code:
{
CSocket.Client.Inventory.Remove(GMUID);
CSocket.Send(ConquerPacket.ItemUsage(GMUID, 255, Struct.ItemUsage.RemoveItem));
Database.Database.DeleteItem(GMUID);
End(CSocket);
}
Notice it is still using the GMUID variable. You can have it set to whatever you need for the npc or add in if statements in the original, use a database, etc.