Thread: Snippet For Boss Kill Count 718

Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1 Snippet For Boss Kill Count 718 
    Registered Member Kobalt's Avatar
    Join Date
    May 2015
    Posts
    83
    Thanks given
    3
    Thanks received
    2
    Rep Power
    11
    For Matrix 718 to count all boss kills and slayer monsters. Maybe a tab for bosses and a tab for slayer monster kills. If you're really feeling squirrely about it, add a command line like ::killcount

    Will rep you because you'd be awesome
    Reply With Quote  
     

  2. #2  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    There are many ways to do this;

    Two being:

    1). Use ints, for example, public int man;
    then in the npc senddeath method,

    if (npcId == 1)
    player.man++;

    or

    2). Use a hashmap and refer to this post.

    Recommending the latter.
    Reply With Quote  
     

  3. #3  
    Registered Member Kobalt's Avatar
    Join Date
    May 2015
    Posts
    83
    Thanks given
    3
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by hc747 View Post
    There are many ways to do this;

    Two being:

    1). Use ints, for example, public int man;
    then in the npc senddeath method,

    if (npcId == 1)
    player.man++;

    or

    2). Use a hashmap and refer to this post.

    Recommending the latter.
    I'm not that great of a coder, so which one of the two would you suggest?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Zach's Avatar
    Join Date
    Aug 2013
    Posts
    1,120
    Thanks given
    24
    Thanks received
    513
    Rep Power
    5000
    Quote Originally Posted by hc747 View Post
    There are many ways to do this;

    Two being:

    1). Use ints, for example, public int man;
    then in the npc senddeath method,

    if (npcId == 1)
    player.man++;

    or

    2). Use a hashmap and refer to this post.

    Recommending the latter.
    Well that helped me, thanks
    ZachTX's RSPS Video Services (10,000+ Loyal RSPS Subscribers)
    CLICK HERE!

    Attached image
    Reply With Quote  
     

  5. #5  
    Registered Member Kobalt's Avatar
    Join Date
    May 2015
    Posts
    83
    Thanks given
    3
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Zach_ View Post
    Well that helped me, thanks
    Lol can you show me how you're doing it?
    Reply With Quote  
     

  6. #6  
    Extreme Donator


    Join Date
    Mar 2009
    Posts
    1,461
    Thanks given
    111
    Thanks received
    184
    Rep Power
    79
    Quote Originally Posted by Kobalt View Post
    Lol can you show me how you're doing it?
    You could use a hashmap and track the npc by name or id. Personally I'd go by name because there are many npcs with the same name but have different ids that serve the same purpose.

    in the Player class add
    Code:
    private HashMap<String, Integer> killcount = new HashMap<String, Integer>();
    
    public HashMap<String, Integer> getKillcount() {
    if (killcount == null)
    killcount = new HashMap<String, Integer>();
    return killcount;
    }
    
    public int getNPCKillcount(String name) {
    return killcount.get(name) == null ? 0 : counters.get(name);
    }
    and in the npc's sendDeath method add something like

    Code:
    if (source instanceof Player) {
    Player player = (Player) source;
    player.getCounters().put(getName(), player.getCounters().containsKey(getName()) ? (player.getCounters().get(getName()) + 1) : 1);
    }
    and to check the your killcount use
    Code:
    player.getNPCKillcount("Man");
    Attached image
    Quote Originally Posted by MaxXi View Post
    Your combat is so awsome that i almost forgot its the combat matrix coded.
    Quote Originally Posted by twobrosplay View Post
    Try allowing the batch file through your firewall?
    Quote Originally Posted by SS_Alophonse View Post
    i have no life u say ha anything u say kid.i doubt u can even get a girlfriend
    i bet u cant even code anything.
    Reply With Quote  
     

  7. #7  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    Quote Originally Posted by Zach_ View Post
    Well that helped me, thanks
    Glad to have helped.
    Quote Originally Posted by Kobalt View Post
    I'm not that great of a coder, so which one of the two would you suggest?
    In terms of efficiency; the hashmap, however, simply using ints is easier.
    Reply With Quote  
     

  8. #8  
    Registered Member Kobalt's Avatar
    Join Date
    May 2015
    Posts
    83
    Thanks given
    3
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Dragon View Post
    You could use a hashmap and track the npc by name or id. Personally I'd go by name because there are many npcs with the same name but have different ids that serve the same purpose.

    in the Player class add
    Code:
    private HashMap<String, Integer> killcount = new HashMap<String, Integer>();
    
    public HashMap<String, Integer> getKillcount() {
    if (killcount == null)
    killcount = new HashMap<String, Integer>();
    return killcount;
    }
    
    public int getNPCKillcount(String name) {
    return killcount.get(name) == null ? 0 : counters.get(name);
    }
    and in the npc's sendDeath method add something like

    Code:
    if (source instanceof Player) {
    Player player = (Player) source;
    player.getCounters().put(getName(), player.getCounters().containsKey(getName()) ? (player.getCounters().get(getName()) + 1) : 1);
    }
    and to check the your killcount use
    Code:
    player.getNPCKillcount("Man");
    I don't know where to put this at. Do I put it into a command to have a window pop up with all the kills? Cause that's what I'm trying to do.
    Code:
    player.getNPCKillcount("Man");
    Reply With Quote  
     

  9. #9  
    Extreme Donator


    Join Date
    Mar 2009
    Posts
    1,461
    Thanks given
    111
    Thanks received
    184
    Rep Power
    79
    Quote Originally Posted by Kobalt View Post
    I don't know where to put this at. Do I put it into a command to have a window pop up with all the kills? Cause that's what I'm trying to do.
    Code:
    player.getNPCKillcount("Man");
    try

    Code:
    case "killcount":
    player.sendMessage("Name: "+cmd[1]+", amount killed: "+player.getNPCKillcount(cmd[1])+".");
    break;
    
    ;;killcount Man
    or something like that, type the name exactly.
    Attached image
    Quote Originally Posted by MaxXi View Post
    Your combat is so awsome that i almost forgot its the combat matrix coded.
    Quote Originally Posted by twobrosplay View Post
    Try allowing the batch file through your firewall?
    Quote Originally Posted by SS_Alophonse View Post
    i have no life u say ha anything u say kid.i doubt u can even get a girlfriend
    i bet u cant even code anything.
    Reply With Quote  
     

  10. #10  
    Husband. Father.
    Loyalty_'s Avatar
    Join Date
    Aug 2013
    Age
    28
    Posts
    1,170
    Thanks given
    74
    Thanks received
    130
    Rep Power
    64
    Quote Originally Posted by Kobalt View Post
    For Matrix 718 to count all boss kills and slayer monsters. Maybe a tab for bosses and a tab for slayer monster kills. If you're really feeling squirrely about it, add a command line like ::killcount

    Will rep you because you'd be awesome
    Code:
    Player.java
    Code:
    	public int bandos = 0; 
    Code:
    	public int getBandos() {
            return bandos;
        }
    public void setBandos(int bandos) {
            this.bandos = bandos;
        }
    NPC.java
    
    Code:
    			if (getId() == 6260) {
    				killer.setBandos(killer.getBandos() + 1);
    				killer.getPackets().sendIComponentText(601, 9, ""+killer.getBandos());
    			}
    Loyalty_





    Quote Originally Posted by Falconpunch View Post
    Player.java buddy. find init() or something like that and find where it adds the starter and do what someone mentioned above (Although an int is 4 scrublords)
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 4
    Last Post: 02-03-2014, 10:30 PM
  2. Replies: 1
    Last Post: 07-24-2013, 02:48 PM
  3. snippet for soul wars? 718 server or up
    By thecr1me0 in forum Requests
    Replies: 10
    Last Post: 02-18-2013, 08:53 PM
  4. Replies: 3
    Last Post: 09-26-2012, 06:24 PM
  5. Replies: 0
    Last Post: 07-10-2011, 05:06 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •