Ok, so this is something I made up on my own, and its really simple, yes, but I though it would probably bring some new ideas to your head.
Mmk..Soo:
Codes will be in the tags, be sure to read everything. Also watch out for methods and stuff, if you need to make changes, make sure you do. Not all servers use the same methods. Example: Some servers will use sendMessage("Blah blah"); or sM("Blah blah"); It varies.
The red is things you'll need to change, and things you'll want to be careful about.
In all the codes, I have not filled out the NPC ID near the top of each code, which is the NPC ID that is the shop. The WanneShop ID I have also not filled out, it will be the shop ID usually found in Shops.cfg.
In client.java, where your wanneshop codes that look like this are:
Code:
- Quote :
- else if (NPCID == $$$) {
// Throwing shop
PutNPCCoords = true;
WanneShop = ##; // Shop number.
}
Ok, so now we add one that needs a requirement. When I did this, I made it so it required a quest. (Was delta :/)
For a quest requirement, use this template:
Code:
- Quote :
- else if (NPCID == 1083) {
// NPC
PutNPCCoords = true;
if(q4 == 15){ WanneShop = @@; // Shop
}
else {
sM("You must complete 'Quest Namer' to buy from *NPC Name*");
}
}
sM You might have to change to whatever your send message method is.
- Quote :
- q4 == 15
For that, q4 is the quest identifier, making it require whatever is next from quest number 4. Change this if you must. The 15 is for the quest step, you'll have a similar code inside your quest steps. Whatever the finished step is, in most cases, 15, change it here.
To make it so you need a certain player right to do this:
Code:
- Quote :
- else if (NPCID ==####) {
// NPC
PutNPCCoords = true;
if (playerRights == 1) { WanneShop = ##; // Shop
}
else {
sM("You must be a 'Rank' to use this shop.");
}
}
- Code:
-
if (playerRights == 1)
That is obviously, what playerRight the user must have. Change the method/number as you must/wish.
To make an item requirement:
Code:
- Quote :
- else if (NPCID == ####) {
// NPC
PutNPCCoords = true;
if(playerHasItem(####, $) { WanneShop = ##; // Shop
}
else {
sM("You musthave a 'Item' to use this shop.");
}
}
if(playerHasItem(####, $)
The #### is the item ID, the $ is the amount, usually being '1'.
Optional for that: To make the item be deleted (a good idea would be maybe to give donators tickets that allow you to use a shop one time, use your imagination!) use this layout:
Code:
- Quote :
- else if (NPCID == ####) {
// NPC
PutNPCCoords = true;
if(playerHasItem(####, $) {
WanneShop = ##; // Shop
deleteItem(####, getItemSlot(####), $);
}
else {
sM("You musthave a 'Item' to use this shop.");
}
}
deleteItem(####, getItemSlot(####), $);
#### Both times is the item ID. The must be the same. $ is the amount to be deleted.
THAT'S ALL FOR THIS TUTORIAL!
REMEMBER THAT DELTA SOURCES USES
- Code:
-
sM
INSTEAD OF
- Code:
-
sendMessage