I'm trying to make two teams that are the "good guys" and the "bad guys".
I'd like it to be like a reputation system where you get good karma for killing bad guys and bad karma for killing anyone but the bad guys.
So far I'm using the following commands:
/scoreboard teams add Team1 Fugitives
/scoreboard teams option Team1 color red
and
/scoreboard teams add Team2 Rescuers
/scoreboard teams option Team2 color blue
I'd like use a command or a command within a command block to do something like the following.
if(playerkillsplayer = true){
variable + 1
}
if(playerkillsFugitive = true){
variable - 1
}
if(variable > 0 ){
team == Team1
}
if(variable < 1){
team == Team2
}
How can I do this?
Best Answer
Before you begin,
Use a scoreboard to detect kills:
One for karma:
One for deaths:
And one for a time since last kill:
Finally, have a clock with the following command:
Now that the scoreboards are set up, let's begin.
For the first section of code:
Have the following three commands in a 20 tick clock, making sure that the third command is activated last:
For the second section:
Note: If you want people to be able to reverse their lost karma for killing a good person, change
variable - 1
tovariable - 2
I'm going to assume you want for people to be able to reverse, otherwise change the2
to1
in the commands.Now have the following commands on a clock powered in the following order:
A limitation is that if another one killed another person in the last 1/10 of a second, it will be activated twice. However, this is very unlikely.
Finally, the last two sections:
For the first section, on a clock have
Second, have a command on a clock: