MarWo22 Posted November 20, 2018 Posted November 20, 2018 I'm trying to make a splasher for spells like curse etc which can't be autocasted. But how do i only attack the npc that is currently attacking me? Because in the script i'm making that doesn't work correctly. Spoiler import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.ui.MagicSpell; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.utility.ConditionalSleep; public class Attacker { public Attacker(MethodProvider mp, MagicSpell spellToCast) throws InterruptedException { NPC npc = mp.getNpcs().closest(n -> n.getName().equals("Rat") && n.getInteracting() == null && !n.isUnderAttack()); if(mp.myPlayer().isUnderAttack()) { NPC rat = mp.getNpcs().closest("Rat"); if(rat != null) { if(rat.isInteracting(mp.myPlayer())) { if(!mp.getMagic().isSpellSelected()) { if(mp.getMagic().castSpell(spellToCast)) new ConditionalSleep(1000) { @Override public boolean condition() throws InterruptedException { return mp.getMagic().isSpellSelected(); } }.sleep(); } else { if(!mp.myPlayer().isAnimating()) { if(rat.interact("Cast")) new ConditionalSleep(2000) { @Override public boolean condition() throws InterruptedException { return !mp.getMagic().isSpellSelected(); } }.sleep(); } } } } } else { if(npc != null) { if(!mp.myPlayer().isMoving() && !mp.myPlayer().isAnimating()) { if(!mp.getMagic().isSpellSelected()) { if(mp.getMagic().castSpell(spellToCast)) new ConditionalSleep(1000) { @Override public boolean condition() throws InterruptedException { return mp.getMagic().isSpellSelected(); } }.sleep(); } else { if(npc.interact("Cast")) new ConditionalSleep(2000) { @Override public boolean condition() throws InterruptedException { return !mp.getMagic().isSpellSelected(); } }.sleep(); } } } } } } And also what is a good way to make it stop spamming the spells?
TwistedBowHunter Posted November 20, 2018 Posted November 20, 2018 Dont know how to code but cant u just go to the lesser demon in the wizard tower/chaos druid in varrock where there is only 1 npc?
RDM Posted November 20, 2018 Posted November 20, 2018 Probably have to use" if in combat" for it to stop clicki g the spell more than once per cast, or if there is a "if animation" in the api. Im not a scripter, just from what ive seen in other threads in the past.