Jump to content
Sign in to follow this  
scary blood

[718] Very Simple Killstreak System

Recommended Posts

Before you continue reading this; this is a VERY simple killstreak system, not 100% sure if I would call it a system even, but it might help out someone.
First "tutorial" don't hate! :)
I will not explain something, since I don't really think it's needed here...

Difficulty: 1/10 Copy and Paste

First open up [B]PLAYER.JAVA[/B] src>com>game>player

Search for this [QUOTE]private int killCount[/QUOTE] and you should find something like this: [QUOTE]private int killCount, deathCount;
private ChargesManager charges;[/QUOTE]
under int killCount add this: [QUOTE]private int killStreak;[/QUOTE]

Now still in [B]PLAYER.JAVA[/B] find [QUOTE]public int getKillCount() {
return killCount;
}[/QUOTE]
under that add: [QUOTE]public int getKillStreak() {
return killStreak;
}[/QUOTE]

Now find [QUOTE]public int setKillCount(int killCount) {
return this.killCount = killCount;

}[/QUOTE]
Under that add: [QUOTE]public int setKillStreak(int killStreak) {
return this.killStreak = killStreak;

}[/QUOTE]

Now, find this: [QUOTE]public void increaseKillCount(Player killed) {[/QUOTE]
Under [QUOTE]killcount++[/QUOTE] add [QUOTE]killStreak++;[/QUOTE]
and under [QUOTE]killed.deathCount++;[/QUOTE] add [QUOTE]killed.setKillStreak(0);[/QUOTE]

Okey, so now if you want, you can add something like this:
[QUOTE]if (killStreak == 10) World.sendWorldMessage("<col=fff800>"+ getDisplayName() +" is on a 10 killstreak, pretty decent i guess...", false);[/QUOTE] Which basically sends a "world" message to everyone online that one player is on a 10 killstreak!

And in player commands you can add [QUOTE]if (cmd[0].equals("checkks")) {
player.getPackets().sendGameMessage("You are on a "+ player.getKillStreak() +" killstreak");
return true;
}[/QUOTE] if you want to :) Edited by scary blood

Share this post


Link to post
Share on other sites
You could also add [QUOTE]if (killStreak > 2) World.sendWorldMessage("<col=fff800>"+ getDisplayName() +" is on a "+ getKillStreak() + " killstreak! ", false);[/QUOTE] if you don't want to manually add all the killstreak messages

Share this post


Link to post
Share on other sites
Sign in to follow this  

×