No use for this anymore, hope it helps someone else. If you use please thank.
Create a new file named Cerberus.java and add the below code. You'll have to add your imports.
Code:
public class Cerberus extends Mob {
/**
* Start of Cerberus
* @param player
* @param location
*/
public Cerberus(Player player, Location location) {
super(player, 5862, false, false, false, location);
if (getOwner() != null) {
getCombat().setAttack(getOwner());
getFollowing().setIgnoreDistance(true);
getUpdateFlags().faceEntity(getOwner().getIndex());
}
}
/**
* Cerberus' GFX
*/
private List<Mob> ghosts = new ArrayList<>();
public static final int CERBERUS = 5862;
public static final int SPECIAL_CHANCE = 20;
private boolean rocks = false;
private boolean spawnGhosts = true;
@Override
public int getRespawnTime() {
return 5;
}
@Override
public void onHit(Entity entity, Hit hit) {
if (entity == null) {
return;
}
int random = Utility.random(15);
if (random == 1) {
initRocks();
}
}
@Override
public void hit(Hit hit) {
if (getOwner() == null) {
return;
}
if (isDead()) {
ghosts.clear();
return;
}
super.hit(hit);
}
/***
*
* @param Checks For Damage inside the Location
*/
public void checkForDamage(Location a) {
for (Player player : getCombatants()) {
Location b = player.getLocation();
player.getLocation();
player.getLocation();
if ((Math.abs(a.getX() - b.getX()) <= 1) && (Math.abs(a.getY() - b.getY()) <= 1))
player.hit(new Hit(Utility.randomNumber(20)));
}
}
@Override
public void doAliveMobProcessing() {
if ((getCombat().getAttacking() != null) && (!rocks) && (Utility.randomNumber(20) == 0)) {
rocks = true;
initRocks();
}
if ((getCombat().getAttacking() != null) && (!spawnGhosts) && (Utility.randomNumber(20) == 0)) {
spawnGhosts = true;
isSpawnGhosts();
}
}
@Override
public void onDeath() {
setSpawnGhosts(false);
for (Mob ghosts : ghosts) {
if (!ghosts.isDead()) {
ghosts.remove();
}
}
ghosts.clear();
}
public boolean isSpawnGhosts() {
return spawnGhosts;
}
public void setSpawnGhosts(boolean spawnGhosts) {
this.spawnGhosts = spawnGhosts;
}
public void spawnGhosts() {
setSpawnGhosts(true);
for (int index = 0; index < 2; index++) {
Mob mob = new Mob(5867, true, new Location(1239, 1256, getOwner().getZ()));
Mob mob1 = new Mob(5869, true, new Location(1240, 1256, getOwner().getZ()));
Mob mob2 = new Mob(5868, true, new Location(1241, 1256, getOwner().getZ()));
mob.getUpdateFlags().faceEntity(getIndex());
mob.setFreeze(9999);
getUpdateFlags().sendForceMessage("Aaaarrrroooo");
TaskQueue.queue(new Task(1) {
byte Stage = 0;
@Override
public void execute() {
if (Stage == 0) {
if (!mob.isDead()) {
ghosts.add(mob);
mob.getCombat().setAttack(getOwner());
mob1.getAttackType();
}
} else if (Stage == 1) {
if (!mob1.isDead()) {
ghosts.add(mob1);
mob1.getCombat().setAttack(getOwner());
mob1.getAttackType();
}
} else if (Stage == 1) {
if (!mob2.isDead()) {
ghosts.add(mob2);
mob2.getCombat().setAttack(getOwner());
mob2.getAttackType();
}
}
if ((this.Stage = (byte) (Stage + 1)) == 3) {
spawnGhosts = false;
ghosts.clear();
stop();
}
}
@Override
public void onStop() {
}
});
}
}
public void initRocks() {
final Location a = new Location(1237, 1253, getOwner().getZ());
final Location b = new Location(1243, 1253, getOwner().getZ());
final Location c = new Location(1242, 1250, getOwner().getZ());
final Location d = new Location(1238, 1250, getOwner().getZ());
TaskQueue.queue(new Task(1) {
byte stage = 0;
@Override
public void execute() {
if (stage == 0) {
World.sendStillGraphic(1247, 0, a);
checkForDamage(a);
} else if (stage == 1) {
World.sendStillGraphic(1247, 0, b);
checkForDamage(b);
} else if (stage == 2) {
World.sendStillGraphic(1247, 0, c);
checkForDamage(c);
} else if (stage == 4) {
World.sendStillGraphic(1247, 0, d);
checkForDamage(d);
}
if ((this.stage = (byte) (stage + 1)) == 5) {
rocks = false;
stop();
}
}
@Override
public void onStop() {
}
});
}
}
Teleport handler spawning
Code:
case 250066://Cerb
TaskQueue.queue(new Task(5) {
@Override
public void execute() {
Cerberus mob = new Cerberus(player, new Location(1241, 1254, player.getIndex() << 2));
mob.face(player);
player.face(mob);
player.send(new SendMessage("Welcome to Cerberus"));
DialogueManager.sendStatement(player, "Welcome to Cerberus");
stop();
}
@Override
public void onStop() {
}
});
return true;
in slayer monsters add this
Code:
case "cerberus":
lvl = (byte) 91;
break;
then add this in slayer tasks
Code:
CERBERUS("Cerberus"),
Npc Definitions
Code:
<NpcDefinition>
<id>5862</id>
<name>Cerberus</name>
<walkAnimation>3183</walkAnimation>
<standAnimation>3183</standAnimation>
<turn180Animation>65535</turn180Animation>
<turn90CWAnimation>65535</turn90CWAnimation>
<turn90CCWAnimation>65535</turn90CCWAnimation>
<level>318</level>
<size>1</size>
<attackable>true</attackable>
</NpcDefinition>
Combat Definitions
Code:
<NpcCombatDefinition>
<!-- Cerberus -->
<id>5862</id>
<combatType>ALL</combatType>
<respawnTime>40</respawnTime>
<block>
<id>4489</id>
<delay>0</delay>
</block>
<death>
<id>4495</id>
<delay>0</delay>
</death>
<skills>
<skill>
<id>0</id>
<level>220</level>
</skill>
<skill>
<id>1</id>
<level>220</level>
</skill>
<skill>
<id>3</id>
<level>600</level>
</skill>
<skill>
<id>4</id>
<level>150</level>
</skill>
<skill>
<id>5</id>
<level>250</level>
</skill>
</skills>
<bonuses>
<int>75</int>
<int>75</int>
<int>75</int>
<int>40</int>
<int>40</int>
<int>40</int>
<int>40</int>
<int>75</int>
<int>75</int>
<int>75</int>
<int>75</int>
<int>75</int>
</bonuses>
<melee>
<melee>
<attack>
<hitDelay>1</hitDelay>
<attackDelay>6</attackDelay>
</attack>
<animation>
<id>4491</id>
<delay>0</delay>
</animation>
<max>15</max>
</melee>
</melee>
<magic>
<magic>
<attack>
<hitDelay>3</hitDelay>
<attackDelay>6</attackDelay>
</attack>
<animation>
<id>4490</id>
<delay>0</delay>
</animation>
<projectile>
<id>1242</id>
<size>1</size>
<delay>50</delay>
<duration>75</duration>
<startHeight>43</startHeight>
<endHeight>31</endHeight>
<curve>16</curve>
</projectile>
<max>50</max>
</magic>
</magic>
<ranged>
<ranged>
<attack>
<hitDelay>3</hitDelay>
<attackDelay>6</attackDelay>
</attack>
<animation>
<id>4490</id>
<delay>0</delay>
</animation>
<projectile>
<id>1245</id>
<size>1</size>
<delay>50</delay>
<duration>75</duration>
<startHeight>43</startHeight>
<endHeight>31</endHeight>
<curve>16</curve>
</projectile>
<max>13</max>
</ranged>
</ranged>
</NpcCombatDefinition>