1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resource Dismiss them random dudes

Discussion in 'Tutorials & Resources' started by Geashaw, Feb 20, 2015.

  1. Geashaw

    Joined:
    Jan 8, 2015
    Messages:
    1,429
    Likes Received:
    252
    Anyone interested in adding names, giving feedback, improving the following?

    Code (Text):
    1. package com.runemate.geashawscripts.LazyChaosDruids.Tasks;
    2.  
    3. import com.runemate.game.api.hybrid.entities.Npc;
    4. import com.runemate.game.api.hybrid.region.Npcs;
    5. import com.runemate.game.api.script.Execution;
    6. import com.runemate.game.api.script.framework.task.Task;
    7.  
    8. /**
    9.  * Created by Geashaw on 18-2-2015.
    10.  */
    11. public class DismissTask extends Task {
    12.  
    13.     @Override
    14.     public boolean validate() {
    15.         Npc random = Npcs.newQuery().names("Genie", "Flippa", "Leo").reachable().results().first();
    16.         return random != null && random.isVisible();
    17.     }
    18.  
    19.     @Override
    20.     public void execute() {
    21.         Npc random = Npcs.newQuery().names("Genie", "Flippa", "Leo").reachable().results().first();
    22.  
    23.         if (random != null) {
    24.             if (random.interact("Dismiss")) {
    25.                 Execution.delayUntil(() - > !random.isVisible(), 1000, 1500);
    26.             }
    27.         }
    28.     }
    29. }
     
  2. not_mallard

    Joined:
    Mar 22, 2015
    Messages:
    75
    Likes Received:
    17
    I compiled a list of a few of the Random Event NPCs (found on the wikia page)

    Code (Text):
    1.  
    2. private static final String[] RANDOMS = { "Beekeeper", "Capt' Arnav",
    3.             "Niles", "Miles", "Giles", "Sergeant Damien", "Drunken dwarf",
    4.             "Freaky Forester", "Frogs", "Prince", "Princess", "Genie",
    5.             "Evil Bob", "Servant", "Postie Pete", "Leo", "Jekyll",
    6.             "Mysterious Old Man", "Pillory Guard", "Flippa", "Evil Bob",
    7.             "Quiz Master", "Rick Turpentine", "Sandwich lady",
    8.             "Security Guard", "Strange plant", "Mr. Morduat" };
    9.  
    Then I just replaced your method of getting the nearest random NPC with
    Code (Text):
    1.  
    2. Npc random = Npcs.newQuery().names(RANDOMS)
    3.                 .reachable().results().first();
    4.  
     
  3. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Whydon't you just query the action "Dismiss" and the dialog containing your name?
     
    not_mallard likes this.
  4. Salvation

    Salvation First Bot Author

    Joined:
    Aug 7, 2013
    Messages:
    262
    Likes Received:
    68
    How to handle randoms 101:
    * Get all npcs
    * Filter based on name
    * Filter based on interacting with local player
    * Interact with it
     
  5. not_mallard

    Joined:
    Mar 22, 2015
    Messages:
    75
    Likes Received:
    17
    I never thought about that, it's a great idea and certainly better than maintaining a large list of npcs.
     
  6. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Sure it is, unless there are other npcs which might have the option to dismiss them, but i don't think so...
     

Share This Page

Loading...