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.
|
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
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.
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
and in the npc's sendDeath method add something likeCode: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 to check the your killcount useCode:if (source instanceof Player) { Player player = (Player) source; player.getCounters().put(getName(), player.getCounters().containsKey(getName()) ? (player.getCounters().get(getName()) + 1) : 1); }
Code:player.getNPCKillcount("Man");
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()); }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |