PDA

View Full Version : [508] - Bow Stringing



Sceptylos
September 1st, 2010, 00:06
Okay, To start off I want to let you guys know I did this from a scratch so please don't flame...

Things to know.
What are you making? A bow stringing system for your 508 Server.
Difficulty 1/10 - This is easy.
What to do? Copy and Paste, Search, Fixing Errors [If Needed]
What files are being modified? ItemOnItem.java, Commands.java, Frames.java
Base used Bulby
Credits 100% me

First, Open ItemOnItem.java and search for something that should say =====FLETCHING===== or so, under it you should see ===FIREMAKING=== well right above firemaking add this code


// ====================================== FLETCHING - STRINGING ================================== Made by Sceptylos

if (itemUsed == 1777 && usedWith == 50 || itemUsed == 50 && usedWith == 1777) {
player.FletchID = 50;
player.FletchGet = 841;
pi.deleteItem(player, 1777, pi.getItemSlot(player, 1777), 14);
player.FletchXP = 35;
player.FletchAmount = 14;
player.FletchThat(player, player.FletchXP, player.FletchID, player.FletchGet);

}

if (itemUsed == 1777 && usedWith == 54 || itemUsed == 54 && usedWith == 1777) {
if(player.skillLvl[9] >= 15)
{
player.FletchID = 54;
player.FletchGet = 843;
pi.deleteItem(player, 1777, pi.getItemSlot(player, 1777), 14);
player.FletchXP = 40;
player.FletchAmount = 14;
player.FletchThat(player, player.FletchXP, player.FletchID, player.FletchGet);
}
else
{
player.frames.sendMessage(player, "You need level 15 fletching to string this bow.");
}
}
if (itemUsed == 1777 && usedWith == 60 || itemUsed == 60 && usedWith == 1777) {
if(player.skillLvl[9] >= 30)
{
player.FletchID = 60;
player.FletchGet = 849;
pi.deleteItem(player, 1777, pi.getItemSlot(player, 1777), 14);
player.FletchXP = 60;
player.FletchAmount = 14;
player.FletchThat(player, player.FletchXP, player.FletchID, player.FletchGet);
}
else
{
player.frames.sendMessage(player, "You need level 30 fletching to string this bow.");
}
}

if (itemUsed == 1777 && usedWith == 64 || itemUsed == 64 && usedWith == 1777) {
if(player.skillLvl[9] >= 45)
{
player.FletchID = 64;
player.FletchGet = 853;
pi.deleteItem(player, 1777, pi.getItemSlot(player, 1777), 14);
player.FletchXP = 100;
player.FletchAmount = 14;
player.FletchThat(player, player.FletchXP, player.FletchID, player.FletchGet);
}
else
{
player.frames.sendMessage(player, "You need level 45 fletching to string this bow.");
}
}

if (itemUsed == 1777 && usedWith == 68 || itemUsed == 68 && usedWith == 1777) {
if(player.skillLvl[9] >= 65)
{
player.FletchID = 68;
player.FletchGet = 857;
pi.deleteItem(player, 1777, pi.getItemSlot(player, 1777), 14);
player.FletchXP = 150;
player.FletchAmount = 14;
player.FletchThat(player, player.FletchXP, player.FletchID, player.FletchGet);
}
else
{
player.frames.sendMessage(player, "You need level 65 fletching to string this bow.");
}
}
if (itemUsed == 1777 && usedWith == 72 || itemUsed == 72 && usedWith == 1777) {
if(player.skillLvl[9] >= 75)
{
player.FletchID = 72;
player.FletchGet = 861;
pi.deleteItem(player, 1777, pi.getItemSlot(player, 1777), 14);
player.FletchXP = 250;
player.FletchAmount = 14;
player.FletchThat(player, player.FletchXP, player.FletchID, player.FletchGet);
}
else
{
player.frames.sendMessage(player, "You need level 75 fletching to string this bow.");
}
}

Now that the bows can be strung how do players get them? Well now open Commands.java and search for "runes" exactly what I put even with the "" and under it add


else if(cmd[0].equals("strings")) {
Engine.playerItems.addItem(p, 1778, 10000);
}

Basicly that spawns them bow strings, noted. Now you just added this and your players might not know yet...So open up Frames.java and search for


setString(p, "Message of the week!", 17, 0);
}

Under that should be the login message of your server simply change it with


setString(p, "Bow Stringing now works 100% do ::strings for strings!",
17, 3);

There! All done. Here's a vid proof of how it works, I would also like to remind you it might not be looking 100% fine I made this off a scratch.

Only the registered members can see the link. (Only the registered members can see the link.)

Faab234
September 1st, 2010, 07:25
Use a method for it like this:



public void fletch(Player player, int id, int get, int xp, int amount) {
player.FletchID = id;
player.FletchGet = get;
pi.deleteItem(player, 1777, pi.getItemSlot(player, 1777), 14);
player.FletchXP = xp;
player.FletchAmount = amount;
player.FletchThat(player, player.FletchXP, player.FletchID, player.FletchGet);

}

Steve
September 1st, 2010, 21:21
You should have it delete the bowstring when it strings the bow, not all of them at once.

Sceptylos
September 1st, 2010, 21:26
I tried but I want the stringing to be automatic so it does 14 at a time, if I do that it deletes all strings but if I make it one by one witch means massive clicking it'll be more clicking and harder, Anyways thanks for the suggestion I might do that.

Steve
September 1st, 2010, 21:40
No i mean if you use one bow string on a bow, and you have multiple bows and strings, it does one by one automatically. And your missing the "FletchThat" method, or you didn't paste it here, unless it was included in Bulby sources.

Perry
September 2nd, 2010, 20:15
u schould work on it,
"not telling u its bad ofc"

d3mons dead
September 20th, 2010, 21:06
use a boolean method to declare in fletching and then make a simple event to add a bow and delete the 2 old items
every 3 seconds. when it reaches 0 make it check if u have the items ,which you would use a void. if not reset your boolean to false
and your int to - 1,which u would the make the event stop in the event in container by using the stop method or if player is null etc. If you have the items make it set it back to 3,and and when it goes to 3 it automatically does it by itself
until you run out of items.

You have 2 options for event manager so people cant mass click,make a authentication system like i did with my
event manager or use boolean methods. either way works,but it saves time and is neater for the future.

Note* dont forget to make isfletching to false if you walk or anything like that.

also these repeative codes could be put into a void to save time and space,also make it alot neater.
Just a word of advice for the future.

Dodge'
October 1st, 2010, 21:32
taken right out of Bulby. anything changed? dont see any difference

Sceptylos
October 1st, 2010, 21:34
I haven't seen any other 508 with stringing yet so gtfo? Just cuz you hated your server doesn't mean you gotta hate on mine.

Dodge'
October 1st, 2010, 21:36
yea but my server had this.

Sceptylos
October 1st, 2010, 21:37
I don't have files to your server so I couldn't of "Taken out of Bulby"

Dodge'
October 1st, 2010, 21:38
Im pretty sure MOST servers have ths for full fletching.


and all you do is leech