Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resource Dismiss them random dudes

Joined
Jan 8, 2015
Messages
1,427
Anyone interested in adding names, giving feedback, improving the following?

Code:
package com.runemate.geashawscripts.LazyChaosDruids.Tasks;

import com.runemate.game.api.hybrid.entities.Npc;
import com.runemate.game.api.hybrid.region.Npcs;
import com.runemate.game.api.script.Execution;
import com.runemate.game.api.script.framework.task.Task;

/**
 * Created by Geashaw on 18-2-2015.
 */
public class DismissTask extends Task {

    @Override
    public boolean validate() {
        Npc random = Npcs.newQuery().names("Genie", "Flippa", "Leo").reachable().results().first();
        return random != null && random.isVisible();
    }

    @Override
    public void execute() {
        Npc random = Npcs.newQuery().names("Genie", "Flippa", "Leo").reachable().results().first();

        if (random != null) {
            if (random.interact("Dismiss")) {
                Execution.delayUntil(() - > !random.isVisible(), 1000, 1500);
            }
        }
    }
}
 
Joined
Mar 22, 2015
Messages
75
I compiled a list of a few of the Random Event NPCs (found on the wikia page)

Code:
private static final String[] RANDOMS = { "Beekeeper", "Capt' Arnav",
            "Niles", "Miles", "Giles", "Sergeant Damien", "Drunken dwarf",
            "Freaky Forester", "Frogs", "Prince", "Princess", "Genie",
            "Evil Bob", "Servant", "Postie Pete", "Leo", "Jekyll",
            "Mysterious Old Man", "Pillory Guard", "Flippa", "Evil Bob",
            "Quiz Master", "Rick Turpentine", "Sandwich lady",
            "Security Guard", "Strange plant", "Mr. Morduat" };

Then I just replaced your method of getting the nearest random NPC with
Code:
Npc random = Npcs.newQuery().names(RANDOMS)
                .reachable().results().first();
 
First Bot Author
Joined
Aug 7, 2013
Messages
262
How to handle randoms 101:
* Get all npcs
* Filter based on name
* Filter based on interacting with local player
* Interact with it
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
I never thought about that, it's a great idea and certainly better than maintaining a large list of npcs.
Sure it is, unless there are other npcs which might have the option to dismiss them, but i don't think so...
 
Top