PDA

View Full Version : [508] Dragonfire Shield Fully [Like Runescape]



UnitedScape
July 17th, 2010, 22:51
You can’t operate it when you’re not in combat (to prevent null-pointers), you can’t operate it when it’s not charged, you need to w8 2 minutes till you can use the special again.

This includes perfect emotes/gfx/ and hits, so you need to have Graham’s eventmanager to complete the tut without any errors.

Warning: to be 100% sure that you don't mess up, take a backup of your server first

And now I’ll start the tut in the correct format.

Purpose: Adding a fully working DFS special o a 508 server

Difficulty: 3/10 you just need to copy/paste and have the ability to read

Tested On: Palidino76’s 508 server (but highly edited by me), with a little bit of Java knowledge you should be able to use it with any other source

Step one:

Open Player.java and declare these variables:


/**
*DFS special
*/
public boolean isDoingDfsSpecial = false;
public int dfsCharges = 0;
public boolean canPerformDfsSpecial = true;
public int secondsTillNextDfsSpecial = 0;

Close and save Player.java

Step two:

Open PlayerCombat.java

Find this:



if (p.combatDelay > 0) {
return;
}

Change it to this:



if (p.isDoingDfsSpecial) {
return;
}
if (p.combatDelay > 0) {
return;
}

Close and save PlayerCombat.java


Step three:

Open ItemOperate.java

Add this import with your other imports:



import Palidino76.rs2.Players.combat.*;

Now under


public class ItemOperate implements Packet {

Add this:


DfsSpecial DfsSpecial = new DfsSpecial();

Under



switch (itemId) {

Add this:



case 11284:
if (p.attackingNPC || p.attackingPlayer) {
p.frames.sendMessage(p, "Your Dragonfire Shield is not charged.");
} else {
p.frames.sendMessage(p, "You need to be in combat to operate this item.");
}
break;
case 11283:
if (p.attackingNPC) {
p.isDoingDfsSpecial = true;
DfsSpecial.dfsSpecialAttackNPC(p);
} else if (p.attackingPlayer) {
p.isDoingDfsSpecial = true;
DfsSpecial.dfsSpecialAttackPlayer(p);
} else {
p.frames.sendMessage(p, "You need to be in combat to operate this item.");
}
break;

Save and close ItemOperate.java






Step four:

Open NPCPlayerCombat.java

Add this import with your other imports:



import Palidino76.rs2.Players.combat.*;

Under



public class NPCPlayerCombat {

Add:



DfsSpecial DfsSpecial = new DfsSpecial();

Under



if (Misc.getDistance(p.absX, p.absY, n.absX, n.absY) <= 1) {

Add:

Code:


if (n.npcType == 841) {

n.requestGFX(1, 100);
p.appendHit(maxHit, 0);
if (p.equipment[5] == 11283 || p.equipment[5] == 11284) {
DfsSpecial.absorbFireBreath(p);
}
}

Save and close NPCPlayerCombat.java

Step five:

Now create a new java file called DfsSpecial.java in players/combat folder

And paste this in it:











/*
* Class DfsSpecial
*
* Version 1.0
*
* Saterday, 7 January 2009
*

*/

package Palidino76.rs2.players.combat;

import Palidino76.rs2.players.Player;
import Palidino76.rs2.*;
import Palidino76.rs2.npcs.*;
import Palidino76.rs2.util.*;

public class DfsSpecial {

public void absorbFireBreath(Player p) {
if (p.dfsCharges == 0) {
p.equipment[5] = 11283;
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.updateReq = p.appearanceUpdateReq = true;
}
if (p.dfsCharges != 50) {
p.dfsCharges++;
p.requestAnim(6695, 0);
p.requestGFX(1164, 0);
updateBonuses(p);
} else {
p.frames.sendMessage(p, "You can't absorb more fire breath because your Dragonfire shield is fully charged.");
}
}

public void updateBonuses(Player p) {
if (p.dfsCharges != 50) {
p.frames.sendMessage(p, "You absord the fire breath and charge your Dragonfire shield.");
for (int i = 5; i < 10; i++) {
p.equipmentBonus[i] += 1;
}
}
}

public void dfsSpecialAttackPlayer(final Player p) {

final Player p2 = Engine.players[p.attackPlayer];

final int offsetX = (p.absX - p2.absX) * -1;
final int offsetY = (p.absY - p2.absY) * -1;

if (p.canPerformDfsSpecial) {
if (p.dfsCharges == 0) {
p.frames.sendMessage(p, "Your Dragonfire Shield is not charged.");
p.equipment[5] = 11284;
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.updateReq = p.appearanceUpdateReq = true;
p.isDoingDfsSpecial = false;
} else {
p.dfsCharges--;
p.combatDelay = 6;
p.isDoingDfsSpecial = false;
p.canPerformDfsSpecial = false;
p.requestAnim(6696, 0);
p.requestGFX(1165, 0);
EventManager.getSingleton().addEvent( new Event() {
public void execute(EventContainer c) {
p.frames.createGlobalProjectile(p.absY, p.absX, offsetY, offsetX, 1166, 43, 31, 70, p2.playerId);
c.stop(); // stops the event from running
}
}, 950); // in ms (1 second = 1000 ms)
EventManager.getSingleton().addEvent( new Event() {
public void execute(EventContainer c) {
p2.appendHit(Misc.random(25), 0);
c.stop(); // stops the event from running
}
}, 1300); // in ms (1 second = 1000 ms)
p.secondsTillNextDfsSpecial = 120;
EventManager.getSingleton().addEvent( new Event() {
public void execute(EventContainer c) {
p.secondsTillNextDfsSpecial--;
if (p.secondsTillNextDfsSpecial == 0) {
p.canPerformDfsSpecial = true;
c.stop(); // stops the event from running
}
}
}, 1000); // in ms (1 second = 1000 ms)
}
} else {
p.isDoingDfsSpecial = false;
p.frames.sendMessage(p, "You need to wait " + p.secondsTillNextDfsSpecial + " seconds till you can perform another special attack");
}
}

public void dfsSpecialAttackNPC(final Player p) {

final NPC n = Engine.npcs[p.attackNPC];

final int offsetX = (p.absX - n.absX) * -1;
final int offsetY = (p.absY - n.absY) * -1;

if (p.canPerformDfsSpecial) {
if (p.dfsCharges == 0) {
p.frames.sendMessage(p, "Your Dragonfire Shield is not charged.");
p.equipment[5] = 11284;
p.frames.setItems(p, 387, 28, 94, p.equipment, p.equipmentN);
p.updateReq = p.appearanceUpdateReq = true;
p.isDoingDfsSpecial = false;
} else {
p.combatDelay = 6;
p.isDoingDfsSpecial = false;
p.canPerformDfsSpecial = false;
p.requestAnim(6696, 0);
p.requestGFX(1165, 0);
EventManager.getSingleton().addEvent( new Event() {
public void execute(EventContainer c) {
p.frames.createGlobalProjectile(p.absY, p.absX, offsetY, offsetX, 1166, 43, 31, 70, n.npcId);
c.stop(); // stops the event from running
}
}, 950); // in ms (1 second = 1000 ms)
EventManager.getSingleton().addEvent( new Event() {
public void execute(EventContainer c) {
n.appendHit(Misc.random(25), 0);
c.stop(); // stops the event from running
}
}, 1300); // in ms (1 second = 1000 ms)
p.secondsTillNextDfsSpecial = 120;
EventManager.getSingleton().addEvent( new Event() {
public void execute(EventContainer c) {
p.secondsTillNextDfsSpecial--;
if (p.secondsTillNextDfsSpecial == 0) {
p.canPerformDfsSpecial = true;
c.stop(); // stops the event from running
}
}
}, 1000); // in ms (1 second = 1000 ms)
}
} else {
p.isDoingDfsSpecial = false;
p.frames.sendMessage(p, "You need to wait " + p.secondsTillNextDfsSpecial + " seconds till you can perform another special attack");
}
}

}

Step six:

Compile and run your server, have fun.

End of tutorial

Some notes:

There's no anti-leech, and it normally compile perfectly.

Fight to green dragons (id = 941) to charge your dfs.

if you don’t want to wait 2 minutes till you can do the special attack again, then just find 120 in DfsSpecial.java and lower it to another number in seconds 60 = 1 minute.

Credits To me

Canownueasy`
July 17th, 2010, 22:52
What about the waiting of the projectile?

Magic™
July 18th, 2010, 07:52
Video please would help people see.

Faab234
July 18th, 2010, 10:22
Whata Fack Credits to you? Credits to Nathan from R - S, If i'm right?

Canownueasy`
July 18th, 2010, 13:06
Whata Fack Credits to you? Credits to Nathan from R - S, If i'm right?

You probably are. Every1 leeches from other communitys to here.

fail brid`
July 18th, 2010, 13:08
Hmmm? i think Post of the current 508's/508 has dragonfire shield special/wield. some 317s do but this would be better if it was a 317 guide.

Canownueasy`
July 18th, 2010, 13:09
Hmmm? i think Post of the current 508's/508 has dragonfire shield special/wield. some 317s do but this would be better if it was a 317 guide.

There's no DFS spec in 317.

fail brid`
July 18th, 2010, 13:10
Ive Seen People With 474s With the DFS special, but i now 317s dont has special, most 508s have them. am i Right?

Canownueasy`
July 18th, 2010, 13:11
Ive Seen People With 474s With the DFS special, but i now 317s dont has special, most 508s have them. am i Right?
Lol every 459+ has them because they were added in 459

0r4nge ownz
July 18th, 2010, 13:16
this wouldnt be too hard to convert to 508/525 would it? D:

is it just the p.frames i change :o?

fail brid`
July 18th, 2010, 13:16
yes. i now. but why would he create a post with DFS on 508 without spec?

0r4nge ownz
July 18th, 2010, 13:19
why dont it have spec lol?

fail brid`
July 18th, 2010, 13:35
bcz it sucks lolz? idk?

Faab234
July 19th, 2010, 08:38
this wouldnt be too hard to convert to 508/525 would it? D:

is it just the p.frames i change :o?

Lol, Converting isn't hard.

Sceptylos
August 28th, 2010, 08:57
.\RH\players\combat\DfsSpecial.java:72: cannot find symbol
symbol : class Event
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {

^
.\RH\players\combat\DfsSpecial.java:72: cannot find symbol
symbol : variable EventManager
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {
^
.\RH\players\combat\DfsSpecial.java:78: cannot find symbol
symbol : class Event
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {

^
.\RH\players\combat\DfsSpecial.java:78: cannot find symbol
symbol : variable EventManager
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {
^
.\RH\players\combat\DfsSpecial.java:84: cannot find symbol
symbol : variable secondsTillNextDfsSpecial
location: class RH.players.Player
p.secondsTillNe
xtDfsSpecial = 120;
^
.\RH\players\combat\DfsSpecial.java:85: cannot find symbol
symbol : class Event
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {

^
.\RH\players\combat\DfsSpecial.java:85: cannot find symbol
symbol : variable EventManager
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {
^
.\RH\players\combat\DfsSpecial.java:97: cannot find symbol
symbol : variable secondsTillNextDfsSpecial
location: class RH.players.Player
p.frames.sendMessage(p, "You ne
ed to wait " + p.secondsTillNextDfsSpecial + " seconds till you can perform anot
her special attack");

^
.\RH\players\combat\DfsSpecial.java:121: cannot find symbol
symbol : class Event
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {

^
.\RH\players\combat\DfsSpecial.java:121: cannot find symbol
symbol : variable EventManager
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {
^
.\RH\players\combat\DfsSpecial.java:127: cannot find symbol
symbol : class Event
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {

^
.\RH\players\combat\DfsSpecial.java:127: cannot find symbol
symbol : variable EventManager
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {
^
.\RH\players\combat\DfsSpecial.java:133: cannot find symbol
symbol : variable secondsTillNextDfsSpecial
location: class RH.players.Player
p.secondsTillNe
xtDfsSpecial = 120;
^
.\RH\players\combat\DfsSpecial.java:134: cannot find symbol
symbol : class Event
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {

^
.\RH\players\combat\DfsSpecial.java:134: cannot find symbol
symbol : variable EventManager
location: class RH.players.combat.DfsSpecial
EventManager.ge
tSingleton().addEvent( new Event() {
^
.\RH\players\combat\DfsSpecial.java:146: cannot find symbol
symbol : variable secondsTillNextDfsSpecial
location: class RH.players.Player
p.frames.sendMessage(p, "You ne
ed to wait " + p.secondsTillNextDfsSpecial + " seconds till you can perform anot
her special attack");

^
16 errors

Any help? I'm using Bulby

han717
November 9th, 2010, 00:15
Yea could you or anyone convert the DfsSpecial.java to Bulby since Bulby doesnt use EventManager?

riches321
November 30th, 2010, 16:44
Thank you, i'm adding it to my server now :)

TheSacredServer
February 21st, 2011, 18:26
Any chance for a bulby please?