|
Hello I am currently working on a custom sliske boss for my server. I have all the attacks finished except for one. I would like to add it so when he reaches half health( 5000/10000) he spawns the barrows brothers to help him (note these brothers are different and have higher stats I already added them.) Can anyone please help ?
Keep in mind I also tried changing the getHitpoints method to npc.getHitpoints with no luckCode:package com.rs.game.npc.combat.impl; import com.rs.game.Animation; import com.rs.game.Entity; import com.rs.game.ForceTalk; import com.rs.game.Hit; import com.rs.game.Hit.HitLook; import com.rs.game.Graphics; import com.rs.game.npc.NPC; import com.rs.game.npc.combat.CombatScript; import com.rs.game.npc.combat.NPCCombatDefinitions; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.game.player.Player; import com.rs.game.player.Skills; import com.rs.utils.Utils; import com.rs.game.player.Appearence; import com.rs.cores.CoresManager; import com.rs.game.World; import com.rs.game.player.content.Magic; import com.rs.game.WorldTile; import com.rs.utils.Utils.EntityDirection; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; public class ZemouregalCombat extends CombatScript { @Override public Object[] getKeys() { return new Object[] { "zemouregal" , 14270 }; } public void processNPC() { if( getHitpoints() == 9500 ); World.spawnNPC(1419, new WorldTile(2879, 3866, 0), -1, false, EntityDirection.WEST); npc.setNextForceTalk(new ForceTalk("Fumus, don't fail me!")); } @Override public int attack(final NPC npc, final Entity target) { final NPCCombatDefinitions defs = npc.getCombatDefinitions(); switch (Utils.getRandom(2)) { case 0: npc.setNextAnimation(new Animation(11338)); delayHit( npc, 2, target, getMagicHit( npc, getRandomMaxHit(npc, defs.getMaxHit(), NPCCombatDefinitions.MAGE, target))); World.sendProjectile(npc, target, 2963, 34, 16, 40, 35, 16, 0); break; case 1: npc.setNextAnimation(new Animation(11338)); delayHit( npc, 2, target, getRangeHit( npc, getRandomMaxHit(npc, 500, NPCCombatDefinitions.RANGE, target))); } return defs.getAttackDelay(); } }
BTW all npcs and qoutes are placeholder atm
Alright well, for starters.. The processNPC() method here is never accessed. Moving on, this should be an override inside the NPC class (ClassName extends NPC not CombatScript). You'll need to make some.. E.g booleans in the npc class itself
For example
boolean spawnedMinions = false;
@Override
public void processNPC() {
super.processNPC();
if (!spawnedMinions && getHitpoints() <= 9500) {
spawnedMinions = true;
//spawn stuff.
}
}
I moved the npc into others from implCode:package com.rs.game.npc.others; import com.rs.game.Animation; import com.rs.game.Entity; import com.rs.game.ForceTalk; import com.rs.game.Hit; import com.rs.game.Hit.HitLook; import com.rs.game.Graphics; import com.rs.game.npc.NPC; import com.rs.game.npc.combat.CombatScript; import com.rs.game.npc.combat.NPCCombatDefinitions; import com.rs.game.tasks.WorldTask; import com.rs.game.tasks.WorldTasksManager; import com.rs.game.player.Player; import com.rs.game.player.Skills; import com.rs.utils.Utils; import com.rs.game.player.Appearence; import com.rs.cores.CoresManager; import com.rs.game.World; import com.rs.game.player.content.Magic; import com.rs.game.WorldTile; import com.rs.utils.Utils.EntityDirection; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; public class Zemouregal extends NPC { @Override public Object[] getKeys() { return new Object[] { "zemouregal" , 14270 }; } boolean spawnedMinions = false; @Override public void processNPC() { super.processNPC(); if (!spawnedMinions && getHitpoints() <= 9500) { spawnedMinions = true; World.spawnNPC(1419, new WorldTile(2879, 3866, 0), -1, false, EntityDirection.WEST); npc.setNextForceTalk(new ForceTalk("Fumus, don't fail me!")); } } @Override public int attack(final NPC npc, final Entity target) { final NPCCombatDefinitions defs = npc.getCombatDefinitions(); switch (Utils.getRandom(2)) { case 0: npc.setNextAnimation(new Animation(11338)); delayHit( npc, 2, target, getMagicHit( npc, getRandomMaxHit(npc, defs.getMaxHit(), NPCCombatDefinitions.MAGE, target))); World.sendProjectile(npc, target, 2963, 34, 16, 40, 35, 16, 0); break; case 1: npc.setNextAnimation(new Animation(11338)); delayHit( npc, 2, target, getRangeHit( npc, getRandomMaxHit(npc, 500, NPCCombatDefinitions.RANGE, target))); } return defs.getAttackDelay(); } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |