Kennelz
September 8th, 2011, 08:38
Hello and welcome to Kennelz Kreations, the posts that pertain to adding unique features to your server in an easy, spoon-fed way. In this tutorial, you will hopefully be able to add working clue scrolls in a basic manner.
KEEP IN MIND:
-My tutorials could be shortened/extended due to my skill in java compared to others.
-My tutorials may have been redone in the past by others, I may have improved it detail-wise.
-I try to make useful, unique tutorials of things I made myself and have rarely seen posted.
-I am no pro, I still consider myself a rookie.
How to add Clue Scrolls:
Purpose: To have a Treasure Trails minigame in an easy way to code and understand.
Difficulty: **/***** (Easy)
Tested on: Pur3zscape source, but any 508-525 should do, maybe even higher/lower.
Files modified: ItemSelect.java, ItemonObject.java, NpcDrops.java, Items.java, ObjectOption1.java
Procedure: Copy and Paste, Text changing, User inputting.
Step 1.
Before you even start opening any files, you might want to either make or get a list of clue scroll IDs. Some quick examples of ones I use:
2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693...
You may also want to find some casket IDs which will serve as the reward/end of the clue scroll trail, you wont need as many depending on how long your trail will be. Once again, here are the few I use:
2714, 2715, 2717, 2718, 2781
Step 2.
While we are in the process of looking up IDs of items, lets work on the reward items given after each trail. Open NpcDrops.java. You should see some drop lists of NPCs. Under a previous list, add this blank template:
public static int randomclue[] = {
your item IDs here, seperate with commas (ex: 995, 4151, ...)
};
public static int getclueDrop() {
return randomclue[(int)(Math.random()*randomclue.length)];
}
Its up to you if you want to one giant listing or divide it up by clue scroll difficulties. If you decide to make more than one item list, copy this line and insert it again. Be sure to change the "clue" name to something like "clue1" or "clueeasy".
Next, you'll want to add the first part of specific clue scroll trail to a current NPC monster drop list. For example, if you have a Bandos drop list and clue scroll ID 2677 is the start of the "easy" trail, you can add 2677 to Bando's drop list so that players have the ability to start the trail.
Save and close NpcDrops.java.
Step 3.
Open ObjectOption1.java, here we will add an easy way of finding Object IDs before we move onto their usage. Scroll all the way to the bottom and look for "default:", Add this line after that:
if (p.username.equals("asdf")) {
p.getActionSender().sendMessage(p, "[" + p.username + "] Unhandled object 1: " + p.clickId);
}
-Change asdf to your username in-game. This will now tell you the Object's ID number to use for Step 5.
Save and Exit ObjectOption1.java.
Step 4.
Open ItemSelect.java, here you will come up with your puzzles/riddles/etc for each of your clues. This simply uses an interface screen and pre-set text. When the scrolls are clicked, a screen will appear, with your set text, hinting the player about what to do or where to go with the clue. If you want to make a special section in ItemSelect.java for all your clue scroll interfaces, do so by making a comment line. Copy in this example line.
//start of clue scrolls
case ####: //Clue scroll part 1
p.getActionSender().showInterface(p, 255);
p.getActionSender().setString(p, "<col=000033> your text here."255, 3);
break;
-Case #### is the item ID, change the #s to the clue scroll's ID number.
-Change "your text here" to whatever you want your clue scroll to tell your player.
-<col=000033> is a HTML color code, change it or remove it.
-You may want to put an indication of how far along the player is to completing the clue.
My example:
case 2677:
p.getActionSender().showInterface(p, 255);
p.getActionSender().setString(p, "<col=FF0000>Bless this clue to see the light to continue the trail. [Easy clue part 1/3]", 255, 3);
break;
Compose different challenges for each clue scroll. Next, the reward caskets need to be made. When players click the casket, they will recieve their item loots for completing the trail. Copy this line and paste it under your section of your completed clue scrolls:
case ####: //easy reward chest
p.getActionSender().sendMessage(p, "Treasure Trail completed.");
Engine.playerItems.deleteItem(p, itemId, itemSlot, 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
break;
-Case #### is once again the item's ID number, change it to one of the casket's IDs.
-Each addItem line gives 1 random item from the "clue" droplist.
-Change "clue" to what you named your specific drop list.
-add/delete the addItem lines to give more/less items.
My example:
case 2714: //easy reward chest
p.getActionSender().sendMessage(p, "Treasure Trail completed.");
p.serverpoints += 4;
p.getActionSender().sendMessage(p, "<col=336600>You get +4 points for finishing the trail.");
Engine.playerItems.deleteItem(p, itemId, itemSlot, 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getpageDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getpageDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclue2Drop(), 10);
break;
Save but DON'T close ItemSelect.java.
Step 5.
Open ItemonObject.java, here is where players will use their clue scrolls to continue the trail and recieve the next clue or reward casket. You may want to use your coding in ItemSelect.java as a reference when setting item IDs for deleting, adding and using. Copy this template and paste it after a previous section:
//Clue scroll advances
if (itemId == #### && objectId == %%%%%) {
Engine.playerItems.deleteItem(player, ####, Engine.playerItems.getItemSlot(player, ####), 1);
player.getActionSender().sendMessage(player, "Correct! Heres your next part.");
Engine.playerItems.addItem(player, @@@@, 1);
}
-#### is the clue scroll ID number of the clue the player currently has.
-%%%%% is the object ID number in which the #### is used on.
-@@@@ is the clue scroll ID number of the clue the player will get from completing this part of the trail.
-@@@@ could also be the casket ID number for the final reward.
-Make sure that the itemId number is also in the deleteItem line twice so players can't dupe the clue scrolls.
-Make sure that the description for each clue scroll mentions the correct object that the clue scroll is intended for.
My examples:
First - Recieving the next clue in a trail:
if (itemId == 2677 && objectId == 36972) {
Engine.playerItems.deleteItem(player, 2677, Engine.playerItems.getItemSlot(player, 2677), 1);
player.getActionSender().sendMessage(player, "Correct! Heres your next part.");
Engine.playerItems.addItem(player, 2678, 1);
}
Second - Recieving the reward casket at the end of a trail:
if (itemId == 2679 && objectId == 5551) {
Engine.playerItems.deleteItem(player, 2679, Engine.playerItems.getItemSlot(player, 2679), 1);
player.getActionSender().sendMessage(player, "Clear some space its time for your reward!");
Engine.playerItems.addItem(player, 2714, 1);
}
As I mentioned, make sure that the description of each clue's use on an object MATCHES in the code. In my examples, clue scroll 2677 says about "blessing the clue", in my source, Prayer alters work and the closest one is in Lumberidge. So players need to use the clue scroll on the alter. In my code, 2677 is set to be used on object 36972, the Lumberidge alter. So it gives 2678, part 2 and deletes the first clue, 2677.
Save and Exit ItemonObject.java and ItemSelect.java.
Step 6.
Open Items.java and search for:
private int untradable[]
After any other id, add the IDs of all clue scrolls and caskets you've used for your treasure trails. This makes it so that the clues and caskets can't be traded to other players, just like they can't be in runescape.
Save and Exit Items.java.
Step 7.
Compile. Test out the clues by trying all of them one at a time, assuring the interfaces come up, the usage on objects works and gives the correct clue.
~Special notes for advanced coders~
You can use other files to make treasure trails, such as ItemSelect.java, ObjectOption1.java, ItemonItem.java, ItemonNPC.java. This way players can solve puzzles in other ways than object related. An example being in ItemSelect.java, using a spade on a specific coordinate area described by the clue scroll. You could also search for clue scroll map interfaces and base it off runescape. This can be as creative as you can do yourself.
~END OF TUTORIAL~
Thanks for viewing!
KEEP IN MIND:
-My tutorials could be shortened/extended due to my skill in java compared to others.
-My tutorials may have been redone in the past by others, I may have improved it detail-wise.
-I try to make useful, unique tutorials of things I made myself and have rarely seen posted.
-I am no pro, I still consider myself a rookie.
How to add Clue Scrolls:
Purpose: To have a Treasure Trails minigame in an easy way to code and understand.
Difficulty: **/***** (Easy)
Tested on: Pur3zscape source, but any 508-525 should do, maybe even higher/lower.
Files modified: ItemSelect.java, ItemonObject.java, NpcDrops.java, Items.java, ObjectOption1.java
Procedure: Copy and Paste, Text changing, User inputting.
Step 1.
Before you even start opening any files, you might want to either make or get a list of clue scroll IDs. Some quick examples of ones I use:
2677, 2678, 2679, 2680, 2681, 2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2691, 2692, 2693...
You may also want to find some casket IDs which will serve as the reward/end of the clue scroll trail, you wont need as many depending on how long your trail will be. Once again, here are the few I use:
2714, 2715, 2717, 2718, 2781
Step 2.
While we are in the process of looking up IDs of items, lets work on the reward items given after each trail. Open NpcDrops.java. You should see some drop lists of NPCs. Under a previous list, add this blank template:
public static int randomclue[] = {
your item IDs here, seperate with commas (ex: 995, 4151, ...)
};
public static int getclueDrop() {
return randomclue[(int)(Math.random()*randomclue.length)];
}
Its up to you if you want to one giant listing or divide it up by clue scroll difficulties. If you decide to make more than one item list, copy this line and insert it again. Be sure to change the "clue" name to something like "clue1" or "clueeasy".
Next, you'll want to add the first part of specific clue scroll trail to a current NPC monster drop list. For example, if you have a Bandos drop list and clue scroll ID 2677 is the start of the "easy" trail, you can add 2677 to Bando's drop list so that players have the ability to start the trail.
Save and close NpcDrops.java.
Step 3.
Open ObjectOption1.java, here we will add an easy way of finding Object IDs before we move onto their usage. Scroll all the way to the bottom and look for "default:", Add this line after that:
if (p.username.equals("asdf")) {
p.getActionSender().sendMessage(p, "[" + p.username + "] Unhandled object 1: " + p.clickId);
}
-Change asdf to your username in-game. This will now tell you the Object's ID number to use for Step 5.
Save and Exit ObjectOption1.java.
Step 4.
Open ItemSelect.java, here you will come up with your puzzles/riddles/etc for each of your clues. This simply uses an interface screen and pre-set text. When the scrolls are clicked, a screen will appear, with your set text, hinting the player about what to do or where to go with the clue. If you want to make a special section in ItemSelect.java for all your clue scroll interfaces, do so by making a comment line. Copy in this example line.
//start of clue scrolls
case ####: //Clue scroll part 1
p.getActionSender().showInterface(p, 255);
p.getActionSender().setString(p, "<col=000033> your text here."255, 3);
break;
-Case #### is the item ID, change the #s to the clue scroll's ID number.
-Change "your text here" to whatever you want your clue scroll to tell your player.
-<col=000033> is a HTML color code, change it or remove it.
-You may want to put an indication of how far along the player is to completing the clue.
My example:
case 2677:
p.getActionSender().showInterface(p, 255);
p.getActionSender().setString(p, "<col=FF0000>Bless this clue to see the light to continue the trail. [Easy clue part 1/3]", 255, 3);
break;
Compose different challenges for each clue scroll. Next, the reward caskets need to be made. When players click the casket, they will recieve their item loots for completing the trail. Copy this line and paste it under your section of your completed clue scrolls:
case ####: //easy reward chest
p.getActionSender().sendMessage(p, "Treasure Trail completed.");
Engine.playerItems.deleteItem(p, itemId, itemSlot, 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
break;
-Case #### is once again the item's ID number, change it to one of the casket's IDs.
-Each addItem line gives 1 random item from the "clue" droplist.
-Change "clue" to what you named your specific drop list.
-add/delete the addItem lines to give more/less items.
My example:
case 2714: //easy reward chest
p.getActionSender().sendMessage(p, "Treasure Trail completed.");
p.serverpoints += 4;
p.getActionSender().sendMessage(p, "<col=336600>You get +4 points for finishing the trail.");
Engine.playerItems.deleteItem(p, itemId, itemSlot, 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclueDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getpageDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getpageDrop(), 1);
Engine.playerItems.addItem(p, NpcDrops.getclue2Drop(), 10);
break;
Save but DON'T close ItemSelect.java.
Step 5.
Open ItemonObject.java, here is where players will use their clue scrolls to continue the trail and recieve the next clue or reward casket. You may want to use your coding in ItemSelect.java as a reference when setting item IDs for deleting, adding and using. Copy this template and paste it after a previous section:
//Clue scroll advances
if (itemId == #### && objectId == %%%%%) {
Engine.playerItems.deleteItem(player, ####, Engine.playerItems.getItemSlot(player, ####), 1);
player.getActionSender().sendMessage(player, "Correct! Heres your next part.");
Engine.playerItems.addItem(player, @@@@, 1);
}
-#### is the clue scroll ID number of the clue the player currently has.
-%%%%% is the object ID number in which the #### is used on.
-@@@@ is the clue scroll ID number of the clue the player will get from completing this part of the trail.
-@@@@ could also be the casket ID number for the final reward.
-Make sure that the itemId number is also in the deleteItem line twice so players can't dupe the clue scrolls.
-Make sure that the description for each clue scroll mentions the correct object that the clue scroll is intended for.
My examples:
First - Recieving the next clue in a trail:
if (itemId == 2677 && objectId == 36972) {
Engine.playerItems.deleteItem(player, 2677, Engine.playerItems.getItemSlot(player, 2677), 1);
player.getActionSender().sendMessage(player, "Correct! Heres your next part.");
Engine.playerItems.addItem(player, 2678, 1);
}
Second - Recieving the reward casket at the end of a trail:
if (itemId == 2679 && objectId == 5551) {
Engine.playerItems.deleteItem(player, 2679, Engine.playerItems.getItemSlot(player, 2679), 1);
player.getActionSender().sendMessage(player, "Clear some space its time for your reward!");
Engine.playerItems.addItem(player, 2714, 1);
}
As I mentioned, make sure that the description of each clue's use on an object MATCHES in the code. In my examples, clue scroll 2677 says about "blessing the clue", in my source, Prayer alters work and the closest one is in Lumberidge. So players need to use the clue scroll on the alter. In my code, 2677 is set to be used on object 36972, the Lumberidge alter. So it gives 2678, part 2 and deletes the first clue, 2677.
Save and Exit ItemonObject.java and ItemSelect.java.
Step 6.
Open Items.java and search for:
private int untradable[]
After any other id, add the IDs of all clue scrolls and caskets you've used for your treasure trails. This makes it so that the clues and caskets can't be traded to other players, just like they can't be in runescape.
Save and Exit Items.java.
Step 7.
Compile. Test out the clues by trying all of them one at a time, assuring the interfaces come up, the usage on objects works and gives the correct clue.
~Special notes for advanced coders~
You can use other files to make treasure trails, such as ItemSelect.java, ObjectOption1.java, ItemonItem.java, ItemonNPC.java. This way players can solve puzzles in other ways than object related. An example being in ItemSelect.java, using a spade on a specific coordinate area described by the clue scroll. You could also search for clue scroll map interfaces and base it off runescape. This can be as creative as you can do yourself.
~END OF TUTORIAL~
Thanks for viewing!