[OSRS] Dismissing randoms

Discussion in 'Projects' started by Geashaw, Feb 22, 2015.

  1. Geashaw

    Joined:
    Jan 8, 2015
    Messages:
    1,402
    Likes Received:
    248
    I currently have the following code for dismissing randoms.

    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.     final String[] dudes = new String[] {
    14.         "Genie", "Flippa", "Leo", "Evil Bob", "Mysterious Old Man", "Freaky Forester", "Sergeant Damien", "Quiz Master", "Capt' Arnav"
    15.     };
    16.  
    17.     @Override
    18.     public boolean validate() {
    19.         Npc random = Npcs.newQuery().names(dudes).reachable().results().first();
    20.         return random != null && random.isVisible();
    21.     }
    22.  
    23.     @Override
    24.     public void execute() {
    25.         Npc random = Npcs.newQuery().names(dudes).reachable().results().first();
    26.  
    27.         if (random != null) {
    28.             if (random.interact("Dismiss")) {
    29.                 Execution.delayUntil(() - > !random.isVisible(), 1000, 1500);
    30.             }
    31.         }
    32.     }
    33. }
    If anyone wants to help out by posting all the names of the random dudes, please!
     
  2. Aidden

    Aidden The better executive

    Joined:
    Dec 3, 2013
    Messages:
    3,480
    Likes Received:
    717
    You might also want to check that you're the npcs target, if not you'll be seeing someone elses random.
     
  3. PhaseCoder

    Joined:
    Jan 1, 2015
    Messages:
    271
    Likes Received:
    26
    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
     
  4. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    2,962
    Likes Received:
    874
    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
     
  5. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    2,962
    Likes Received:
    874
    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.     final String[] dudes = new String[] {
    14.         "Genie", "Flippa", "Leo", "Evil Bob", "Mysterious Old Man", "Freaky Forester", "Sergeant Damien", "Quiz Master", "Capt' Arnav"
    15.     };
    16.  
    17.     private Npc random;
    18.  
    19.     @Override
    20.     public boolean validate() {
    21.         return (random = Npcs.newQuery().names(dudes).targeting(Players.getLocal()).reachable().results().first()) != null && random.isVisible();
    22.     }
    23.  
    24.     @Override
    25.     public void execute() {
    26.         if (random != null && random.interact("Dismiss"))
    27.             Execution.delayUntil(() - > !random.isVisible(), 1000, 1500);
    28.     }
    29. }
     
    #5 SlashnHax, Feb 23, 2015
    Last edited: Feb 23, 2015
    PhaseCoder likes this.
  6. Geashaw

    Joined:
    Jan 8, 2015
    Messages:
    1,402
    Likes Received:
    248
    Thanks @SlashnHax I kinda forgot about that...
     
  7. Ian C

    Joined:
    Jul 6, 2014
    Messages:
    23
    Likes Received:
    8
    Full list of random event names
    Code (Text):
    1. 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"};
     
    Geashaw likes this.
  8. Geashaw

    Joined:
    Jan 8, 2015
    Messages:
    1,402
    Likes Received:
    248
    Thanks, will improve my DismissHandler this weekend :)
     
  9. Ian C

    Joined:
    Jul 6, 2014
    Messages:
    23
    Likes Received:
    8
    Woops. Don't forget Dr Jekyll.
    --- Double Post Merged, Feb 26, 2015, Original Post Date: Feb 26, 2015 ---
    I don't know if there are any more members randoms I need to include. Those were all the f2p randoms.
     

Share This Page

Loading...