Welcome!

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

Sign up now!

[OSRS] Dismissing randoms

Joined
Jan 8, 2015
Messages
1,427
I currently have the following code for dismissing randoms.

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 {

    final String[] dudes = new String[] {
        "Genie", "Flippa", "Leo", "Evil Bob", "Mysterious Old Man", "Freaky Forester", "Sergeant Damien", "Quiz Master", "Capt' Arnav"
    };

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

    @Override
    public void execute() {
        Npc random = Npcs.newQuery().names(dudes).reachable().results().first();

        if (random != null) {
            if (random.interact("Dismiss")) {
                Execution.delayUntil(() - > !random.isVisible(), 1000, 1500);
            }
        }
    }
}

If anyone wants to help out by posting all the names of the random dudes, please!
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
6,774
I currently have the following code for dismissing randoms.

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 {

    final String[] dudes = new String[] {
        "Genie", "Flippa", "Leo", "Evil Bob", "Mysterious Old Man", "Freaky Forester", "Sergeant Damien", "Quiz Master", "Capt' Arnav"
    };

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

    @Override
    public void execute() {
        Npc random = Npcs.newQuery().names(dudes).reachable().results().first();

        if (random != null) {
            if (random.interact("Dismiss")) {
                Execution.delayUntil(() - > !random.isVisible(), 1000, 1500);
            }
        }
    }
}

If anyone wants to help out by posting all the names of the random dudes, please!
You might also want to check that you're the npcs target, if not you'll be seeing someone elses random.
 
Joined
Jan 1, 2015
Messages
272
Yea I just thouh the same as aiddenn when i was looking over the code, otherwise its going to be off chasing everyone elses randoms trying to dissmiss them
 
Joined
Dec 10, 2014
Messages
3,255
You might also want to check that you're the npcs target, if not you'll be seeing someone elses random.

Yea I just thouh the same as aiddenn when i was looking over the code, otherwise its going to be off chasing everyone elses randoms trying to dissmiss them

Yeah @Geashaw knows :p, I forked the file on github and made a few changes then sent it to him :)

Edit: It seems he didn't implement them lel
 
Joined
Dec 10, 2014
Messages
3,255
I currently have the following code for dismissing randoms.

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 {

    final String[] dudes = new String[] {
        "Genie", "Flippa", "Leo", "Evil Bob", "Mysterious Old Man", "Freaky Forester", "Sergeant Damien", "Quiz Master", "Capt' Arnav"
    };

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

    @Override
    public void execute() {
        Npc random = Npcs.newQuery().names(dudes).reachable().results().first();

        if (random != null) {
            if (random.interact("Dismiss")) {
                Execution.delayUntil(() - > !random.isVisible(), 1000, 1500);
            }
        }
    }
}

If anyone wants to help out by posting all the names of the random dudes, please!

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 {

    final String[] dudes = new String[] {
        "Genie", "Flippa", "Leo", "Evil Bob", "Mysterious Old Man", "Freaky Forester", "Sergeant Damien", "Quiz Master", "Capt' Arnav"
    };

    private Npc random;

    @Override
    public boolean validate() {
        return (random = Npcs.newQuery().names(dudes).targeting(Players.getLocal()).reachable().results().first()) != null && random.isVisible();
    }

    @Override
    public void execute() {
        if (random != null && random.interact("Dismiss")) 
            Execution.delayUntil(() - > !random.isVisible(), 1000, 1500);
    }
}
 
Last edited:
Joined
Jul 6, 2014
Messages
24
Full list of random event names
Code:
public static final String[] RANDOMS = {"Mysterious Old Man", "Drunken Dwarf", "Frog", "Rick Turpentine", "Sergeant Damien", "Pillory Guard", "Capt' Arnav", "Flippa", "Evil Bob", "Giles", "Leo", "Dunce"};
 
Joined
Jan 8, 2015
Messages
1,427
Full list of random event names
Code:
public static final String[] RANDOMS = {"Mysterious Old Man", "Drunken Dwarf", "Frog", "Rick Turpentine", "Sergeant Damien", "Pillory Guard", "Capt' Arnav", "Flippa", "Evil Bob", "Giles", "Leo", "Dunce"};

Thanks, will improve my DismissHandler this weekend :)
 
Joined
Jul 6, 2014
Messages
24
Woops. Don't forget Dr Jekyll.
 
I don't know if there are any more members randoms I need to include. Those were all the f2p randoms.
 
Top