PDA

View Full Version : [508] Firemaking



SiniSoul
July 27th, 2010, 15:38
Created 100% By SiniSoul
L33chers Beware...
Base: Palidino

|| Introduction ||

Im releasing this tutorial because the community seems dull and this is a skill I really don't care that you have. Its not like my Fishing or Barbarian Fishing but this is pretty l33t. I converted this from my Infinity base to Palidino so that people can use it.

IF I SEE THIS ANYWHERE ELSE OTHER THEN RUNELOCUS I WILL HAVE THIS TOPIC REMOVED.

IF PEOPLE TAKE CREDIT FOR THIS I WILL REMOVE IT, NO QUESTIONS ASKED.

Want a video of it in action (a little outdated but...): VIDEO (Only the registered members can see the link.)

Im pretty sure this is the best FireMaking out there. It will delete the fire and spawn all the FireObjects within a array that is classified with the player. I set the max array to 5000 to Minimize lag but you can change it if you wish.

|| Acknowledgments ||

My imports are not the same as yours. CHANGE THEM TO FIT YOURS.

package Yoursource.Skills.Firemaking.Firemaking; WRONG

package Yousource.Skills.Firemaking; RIGHT

On imports you do need to specify the specific file, just not on packages.

import Yoursource.Skills.Firemaking.Firemaking; RIGHT

Yea its a bit messy, get over it.

NO ANNOTATIONS D: i really...yea I know what my stuff does.


|| STEP ONE ||

INSERT THIS CODE


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package Yousource.Skills.Firemaking;

import Yousource.players.Player;
import Yousource.io.Frames;
import Yousource.Engine;
import Yousource.players.items.PlayerItems;
import Yousource.util.Misc;

/**
*
* @author SiniSoul
*/
public class Firemaking {

public PlayerItems pi = new PlayerItems();

private int XPRATE = 1;

public final FireObject[] FireObjects = new FireObject[5000];

private final Frames Frames = new Frames();

private final int[] LOGS = {1511, 1521, 1519, 1517, 1515, 1513};

private final int[] REQ = {1, 15, 30, 45, 60, 75};

private final int TINDERBOX = 590;

private final int ASH = 592;

private final int EMOTE = 733;

private int TYPE = -1;

private int ATTEMPT = 0;

public Firemaking() {
}

public void playerProcess(Player p) {
FiremakingPlayerProcess(p);
FireSpotsProcess();
}

@SuppressWarnings("static-access")
public void Fire(Player p, int log, int tinder) {
System.out.println("STEP A");
if(p.FM.ATTEMPT == 0) {
System.out.println("STEP A1");
if(tinder == TINDERBOX) {
System.out.println("STEP A2");
for(int i = 0; i < LOGS.length; i ++) {
System.out.println("STEP A3");
if(LOGS[i] == log) {
if(levelCheck(p, i)) {
System.out.println("STEP A4");
p.FM.TYPE = i;
} else {
p.FM.TYPE = -1;
}
} else {
continue;
}
}
}
}
}

private boolean levelCheck(Player p, int i) {
if(p.skillLvl[11] >= REQ[i]) {
return true;
} else {
Frames.sendMessage(p, levelCheckString(i));
return false;
}
}

private String levelCheckString(int i) {
switch (i) {
case 0:
return "If You Get This Tell SiniSoul";
case 1:
return "You Need 15 Firemaking To Do This.";
case 2:
return "You Need 30 Firemaking To Do This.";
case 3:
return "You Need 45 Firemaking To Do This.";
case 4:
return "You Need 60 Firemaking To Do This.";
case 5:
return "You Need 75 Firemaking To Do This.";
}
return null;
}

@SuppressWarnings("static-access")
private void FiremakingPlayerProcess(Player p) {
if(p.FM.ATTEMPT == 0) {
if(p.FM.TYPE > -1) {
System.out.println("STEP B");
attempt(p);
}
if(p.FM.ATTEMPT == -10) {
p.FM.ATTEMPT = 0;
}
}
}

@SuppressWarnings("static-access")
private void attempt(Player p) {
p.FM.ATTEMPT = 1;
int a = p.skillLvl[11];
double b = ((a * .25)-TYPE);
double c = Misc.random(30) + b;
if(c > 20) {
System.out.println("STEP C");
succeed(p);
} else {
System.out.println("STEP D");
p.requestAnim(EMOTE, 0);
fail(p);
}
}

@SuppressWarnings("static-access")
private void fail(Player p) {
System.out.println("STEP E");
p.FM.ATTEMPT = 0;
}

@SuppressWarnings("static-access")
private void succeed(Player p) {
System.out.println("STEP F");
pi.deleteItem(p, LOGS[p.FM.TYPE], pi.getItemSlot(p, LOGS[p.FM.TYPE]), 1);
xp(p, p.FM.TYPE);
p.frames.resetAnimations(p);
p.reqWalkQueue(p.absX -1, p.absY);
CreateFireSpot(p);
p.FM.TYPE = -1;
p.FM.ATTEMPT = 0;
p.frames.resetAnimations(p);
}

private void CreateFireSpot(Player p) {
for(int i = 0; i < FireObjects.length; i++) {
if(FireObjects[i] != null) {
continue;
}
if(FireObjects[i] == null) {
FireObjects[i] = new FireObject(p, p.absX, p.absY, p.heightLevel, 50);
break;
}
}
}

public void FireSpotsProcess() {
for(FireObject FO: FireObjects) {
if(FO == null) {
continue;
}
if(FO.TIMER == -1) {
continue;
}
if(FO.TIMER > 0) {
FO.TIMER --;
System.out.println(FO.TIMER);
}
if(FO.TIMER == 0) {
Engine.items.createGlobalItem(ASH, 1, FO.x, FO.y, FO.h);
Frames.deleteStaticObject(FO.h, FO.x, FO.y);
FO.TIMER = -1;
FO = null;
}
}
}

private void xp(Player p, int i) {
switch (i) {
case 0:
p.addSkillXP(40 * XPRATE, 11);
break;

case 1:
p.addSkillXP(60 * XPRATE, 11);
break;

case 2:
p.addSkillXP(90 * XPRATE, 11);
break;

case 3:
p.addSkillXP(135 * XPRATE, 11);
break;

case 4:
p.addSkillXP(202.5 * XPRATE, 11);
break;

case 5:
p.addSkillXP(303.75 * XPRATE, 11);
break;

}
}
}


INTO A FOLDER CALLED:

Yousource.Skills.Firemaking.*

Save it as Firemaking.java

|| STEP TWO ||

Put this code in to the folder too:



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package Yoursource.Skills.Firemaking;

import Yoursource.players.Player;

/**
*
* @author SiniSoul
*/
public class FireObject {

public Player p;

private int OBJECT = 2732;

public int TIMER = -1;

public int x = 0;

public int y = 0;

public int h = 0;

private int TYPE = 10;

private int FACE = 0;

public FireObject (Player _p, int _x, int _y, int _h, int _TIMER) {
p = _p;
x = _x;
y = _y;
h = _h;
TIMER = _TIMER;
createFireObject();
}

private void createFireObject() {
p.frames.deleteObject(p, x, y);
p.frames.createGlobalObject(2733, h, x, y, FACE, TYPE);
p.frames.createGlobalObject(OBJECT, h, x, y, FACE, TYPE);
}
}



Save it as FireObject.java

|| STEP THREE ||

Open Player.java

add this import...


import Yousource.Skills.Firemaking.Firemaking;


And put this anywhere something isn't called.



public Firemaking FM = new Firemaking();


Ctrl + F ( process() )
And in the process() {

Add this:



this.FM.playerProcess(this);


|| STEP FOUR ||

Open Frames.java

Insert This.



public void resetAnimations(Player p) {
p.stream.createFrame(114);
}

public void deleteObject(Player p, int objectX, int objectY) {
sendCoords(p, (objectX - ((p.mapRegionX - 6) * 8)), (objectY - ((p.mapRegionY - 6) * 8)));
p.stream.createFrame(196);
p.stream.writeByteC(0);
p.stream.writeByteC(0);
}

public void deleteGlobalObject(int objectX, int objectY) {
for(Player p: Engine.players) {
if (p == null) continue;
sendCoords(p, (objectX - ((p.mapRegionX - 6) * 8)), (objectY - ((p.mapRegionY - 6) * 8)));
p.stream.createFrame(196);
p.stream.writeByteC(0);
p.stream.writeByteC(0);
}
}

public void deleteStaticObject(int height, int objectX, int objectY) {
for (Player p : Engine.players) {
if (p == null)
continue;
if (p.heightLevel == height)
createObject(p, 6951, height, objectX, objectY, -1, 10);
}
}



Well...I think thats it...If I missed anything I will be on all day today and just drop me a PM or contact me at SiniSoul@live.com.

Thanks, Please...Don't Leech.

Sceptylos
August 17th, 2010, 09:47
So, This is like custom firemaking like the normal one or does it make the player actually move while burning a log?

Emily
August 17th, 2010, 09:50
So, This is like custom firemaking like the normal one or does it make the player actually move while burning a log?

Obviously this:


p.reqWalkQueue(p.absX -1, p.absY);

Means its similar to real fire making.

Faab234
August 17th, 2010, 09:58
No


private int XPRATE = 1;

Yes


private int xpRate = 1;

Naming conventions.

Sceptylos
August 17th, 2010, 09:59
Yeh, Well I just finished this and


.\RH\Skills\Firemaking.java:6: package RH.Skills.Firemaking clashes with class o
f same name
package RH.Skills.Firemaking;
^
.\RH\players\Player.java:9: cannot access RH.Skills.Firemaking
bad class file: .\RH\Skills\Firemaking.java
file does not contain class RH.Skills.Firemaking
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
import RH.Skills.Firemaking.Firemaking;
^
Appuyez sur une touche pour continuer...

Emily
August 17th, 2010, 10:02
Yeh, Well I just finished this and


.\RH\Skills\Firemaking.java:6: package RH.Skills.Firemaking clashes with class o
f same name
package RH.Skills.Firemaking;
^
.\RH\players\Player.java:9: cannot access RH.Skills.Firemaking
bad class file: .\RH\Skills\Firemaking.java
file does not contain class RH.Skills.Firemaking
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
import RH.Skills.Firemaking.Firemaking;
^
Appuyez sur une touche pour continuer...

You already have a file with the same directory/name...

Sceptylos
August 17th, 2010, 10:08
package Yoursource.Skills.Firemaking.Firemaking; WRONG

package Yousource.Skills.Firemaking; RIGHT

On imports you do need to specify the specific file, just not on packages.


You already have a file with the same directory/name...

Yeah Figured out that one...Now

.\RH\players\Player.java:9: cannot access RH.Skills.Firemaking
bad class file: .\RH\Skills\Firemaking.java
file does not contain class RH.Skills.Firemaking
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
import RH.Skills.Firemaking;
^
Appuyez sur une touche pour continuer...

Emily
August 17th, 2010, 10:15
Yeah Figured out that one...Now

.\RH\players\Player.java:9: cannot access RH.Skills.Firemaking
bad class file: .\RH\Skills\Firemaking.java
file does not contain class RH.Skills.Firemaking
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
import RH.Skills.Firemaking;
^
Appuyez sur une touche pour continuer...


Obviously that import is not the proper directory to the file, should i get a baby bottle along with the spoon feeding?

Sceptylos
August 17th, 2010, 10:16
God, Flame starting off of a help question...What is the world becoming to flame is everywhere

Emily
August 17th, 2010, 10:18
God, Flame starting off of a help question...What is the world becoming to flame is everywhere

Your post is irrelevant to the thread, please learn to read your compiler, then come back later.

P.S. Its the fucking teaching section, not the help section dumb ass.

Ontopic: Nice job with the teaching, even though its more copy and paste then teaching...

Sceptylos
August 17th, 2010, 10:37
What ever, I figured it out, Next time if you don't have anything better to do but flame just put your fingers in your mouth
Only the registered members can see the link.

pivotgamer84
August 17th, 2010, 23:29
Meh..... It could of been done alot better. I'm gonna release one in a sec.

It has:
- Deleting logs
- Giving Exp
- Dropping the logs on the ground
- Lighting the logs animation
- Creating the fire
- Decaying the fire
- Dropping ashes

The timing on mine is pretty much perfect, and it doesn't use arrays and process. It uses Event Manager.

Emily
August 17th, 2010, 23:41
Meh..... It could of been done alot better. I'm gonna release one in a sec.

It has:
- Deleting logs
- Giving Exp
- Dropping the logs on the ground
- Lighting the logs animation
- Creating the fire
- Decaying the fire
- Dropping ashes

The timing on mine is pretty much perfect, and it doesn't use arrays and process. It uses Event Manager.

You do realize that events happen for every "click" instance you set it at, example for every "log" on "tinder box" it process's an event. If the player mass clicks "does fast" it creates glitches, and is not "considered" proper. The best way for "perfect" firemaking is using timers...

Faab234
August 18th, 2010, 09:15
You do realize that events happen for every "click" instance you set it at, example for every "log" on "tinder box" it process's an event. If the player mass clicks "does fast" it creates glitches, and is not "considered" proper. The best way for "perfect" firemaking is using timers...

No Process, Please.

Emperor
August 18th, 2010, 09:32
You do realize that events happen for every "click" instance you set it at, example for every "log" on "tinder box" it process's an event. If the player mass clicks "does fast" it creates glitches, and is not "considered" proper. The best way for "perfect" firemaking is using timers...

You can declare a boolean as in;
if (startFiremaking) {
return;
}

When calling the firemaking skill again, that way the event only runs once and is better then timers.

pivotgamer84
August 19th, 2010, 16:37
You can declare a boolean as in;
if (startFiremaking) {
return;
}

When calling the firemaking skill again, that way the event only runs once and is better then timers.

Exactly. You can also set a click delay.Events can be used for all skill, you just need to know how to use the event correctly.

Here's a little chart I made comparing Process and Event Manager.

____________________
Process | Event Manager
1) Yes__|___No_______ ............... 1) Mass lag
2) Yes__|___No_______ ............... 2) All over the place
3) Yes__|___No_______ ............... 3) Unnecessary variables
4) Yes__|___Yes______ ............... 4) Noob friendly
5) No___|___Yes______ .............. 5) Flexible



Also, process is every 600 ms, so you always have to calculate your seconds (1000 ms) into 600 ms fragments.
Event Manager, you can choose the tick count (in ms) so you don't have to do a bunch of calculating.

SiniSoul
August 19th, 2010, 17:05
This Firemaking I AM SURE is 100%, it has deleteing logs and everything. XP Giving ect. If it doesn't let me know and I will send u guys the final files. I'm past 508s so IDC :) Ill give u my source if u wanted it.

pivotgamer84
August 19th, 2010, 17:18
If it's just deleting logs, doing anim, creating fire object, walking west, and decaying the fire to get ashes, it's only 90%

You still need facing the fire, dropping the logs on the ground before lighting them, and having a random amount of time before the logs catch fire, depending on your firemaking level.

Mine has all listed above, except for facing, and the random amount of time before catching.

The lighting timing is perfect, the logs drop and other people can steal your logs and stop you from lighting them (I don't know if it should be like that, can be set so only you can see them).

Alos, I think you should use event manager instead of process. Even if it's "easier for the noobs" to use process, you will be doing them a favor by using event manager. Less unnecessary variables are needed too.

Aaron
August 19th, 2010, 17:22
Very nice Tutorial:)

SiniSoul
August 19th, 2010, 17:23
If it's just deleting logs, doing anim, creating fire object, walking west, and decaying the fire to get ashes, it's only 90%

You still need facing the fire, dropping the logs on the ground before lighting them, and having a random amount of time before the logs catch fire, depending on your firemaking level.

Mine has all listed above, except for facing, and the random amount of time before catching.

The lighting timing is perfect, the logs drop and other people can steal your logs and stop you from lighting them (I don't know if it should be like that, can be set so only you can see them).

Alos, I think you should use event manager instead of process. Even if it's "easier for the noobs" to use process, you will be doing them a favor by using event manager. Less unnecessary variables are needed too.

MMM all the variables are necessary. I used the process because thats what 99% of noobs use. Just modify my fail and succeed formula to get the firemaking formula right.

And if you can do it better, please do just don't say you can on my thread because I am betting that you can't.


OMG thnx aaron :D I am going to release barbarian/100% fishing here in a sec. Might as well release my source.

pivotgamer84
August 19th, 2010, 17:43
Ill post my FM class right now.

EDIT:



/**
* @author pivotgamer84 <wipe.out@live.com> <runelocus.com>
*/
package palidino76.rs2.players.skills.Firemaking;

import palidino76.rs2.*;
import palidino76.rs2.players.Player;
import palidino76.rs2.players.items.PlayerItems;
import palidino76.rs2.EventManager.*;
import palidino76.rs2.util.*;

public class Firemaking {

PlayerItems pi = new PlayerItems(); // for deleting logs

double getXP(int logTypes) {
switch(logTypes) {
case 1511: // reg logs
return 40;
case 1521: // oak
return 60;
case 1519: // willow
return 90;
case 1517: // maple
return 135;
case 1515: // yew
return 202.5;
case 1513: // magic
return 303.8;
default:
return 0;
}
}

int getLvlReq(int logTypes) {
switch(logTypes) {
case 1511: // reg logs
return 1;
case 1521:
return 15;
case 1519:
return 30;
case 1517:
return 45;
case 1515:
return 60;
case 1513:
return 75;
default:
return 1;
}
}


public void createFire(final Player p, final int logTypes){
if (p == null) {
return;
}

if (p.skillLvl[11] < getLvlReq(logTypes)) {
p.frames.sendMessage(p, "You need a Firemaking level of "+getLvlReq(logTypes)+" to make this burn");
return;
}
pi.deleteItem(p, logTypes, pi.getItemSlot(p, logTypes), 1);
EventManager.getSingleton().addEvents(100, new Event() {
final int fireX = p.absX;
final int fireY = p.absY;
final int fireH = p.heightLevel;
int fireTime = 650+Misc.random(400); // Between 1:05 and 1:45
int fireStage = 2;
int depleteDelay = 20;

public void execute(EventContainer Firemaking) {
if (fireStage == 2) {
if (p.absX != fireX || p.absY != fireY) {
Firemaking.stop();
return;
}
p.requestAnim(10011, 0);
p.frames.sendMessage(p, "You attempt to light the logs.");
Engine.items.createGroundItem(logTypes, 1, fireX, fireY, fireH, "");
fireStage--;
return;
}
if (fireStage == 1) {
if (p.absX != fireX || p.absY != fireY) {
Firemaking.stop();
return;
}
if (depleteDelay == 0) {
p.frames.sendMessage(p, "The logs catch fire.");
p.addSkillXP(getXP(logTypes), 11);
Engine.items.removeGlobalItem(logTypes, fireX, fireY, fireH);
p.frames.createGlobalObject(2732, fireH, fireX, fireY, 1, 10);
p.reqWalkQueueBack(fireX-1, fireY);
fireStage--;
return;
}
if (depleteDelay > 0) {
depleteDelay--;
}
}
if (fireStage == 0) {
if (fireTime > 0) {
fireTime--;
}
if (fireTime == 0) {
Engine.items.createGroundItem(592, 1, fireX, fireY, fireH, "");
p.frames.deleteGlobalObject(fireH, fireX, fireY);
Firemaking.stop();
}
}
}
});


}

}



Itemonitem:


if (itemUsed == 590 && usedWith == 1511 || itemUsed == 1511 && usedWith == 590) {
firemaking.createFire(p, 1511);
}
if (itemUsed == 590 && usedWith == 1521 || itemUsed == 1521 && usedWith == 590) {
firemaking.createFire(p, 1521);
}
if (itemUsed == 590 && usedWith == 1513 || itemUsed == 1513 && usedWith == 590) {
firemaking.createFire(p, 1513);
}
if (itemUsed == 590 && usedWith == 1515 || itemUsed == 1515 && usedWith == 590) {
firemaking.createFire(p, 1515);
}
if (itemUsed == 590 && usedWith == 1517 || itemUsed == 1517 && usedWith == 590) {
firemaking.createFire(p, 1517);
}
if (itemUsed == 590 && usedWith == 1519 || itemUsed == 1519 && usedWith == 590) {
firemaking.createFire(p, 1519);
}

It's just missing fire lighter logs

SiniSoul
August 19th, 2010, 18:13
Ew. It looks gross.

pivotgamer84
August 19th, 2010, 20:09
You look gross. It's 90% complete.

The only thing it really needs is conventions, but anyone can add conventions, so who cares?

It's a hell of alot shorter than yours too.


Now, back to the topic, instead of contrasting.

berka
October 22nd, 2010, 10:45
Only to compile worked, but when I click it does nothing...