Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::section config
- name: Kill System
- import:
- #Relative Blocks (BETA TEST)
- yLuBwShx
- ::section notes
- #[CHANGE THIS (kills) TO YOUR SCORE]
- $shortcut killScore ItemKills
- # /!\
- ::section before
- #Damage Taken
- scoreboard objectives add damageDealt stat.damageDealt Damage Dealt
- #Unique Player Identifier
- scoreboard objectives add playerId dummy
- #Copy of Player Identifier used to find killer
- scoreboard objectives add queryId dummy
- #Player ID of the last player they were attacked by
- scoreboard objectives add attackerId dummy
- #Timer ticking down after being attacked to reset attacker
- scoreboard objectives add attackedTime dummy
- ::section IDs
- :I!: scoreboard players set @a playerId 0
- $f setId;
- :R: $function setId
- scoreboard players tag @p[score_playerId=0] add setId
- scoreboard players operation @a[tag=setId] playerId > * playerId
- scoreboard players add @a[tag=setId] playerId 1
- scoreboard players tag @a[tag=setId] remove setId
- testfor @a[score_playerId=0] $pos a set;
- testforblock $pos a get; minecraft:chain_command_block -1 {SuccessCount:0}
- :?: execute @e[type=ArmorStand,tag=function,name=setId] ~ ~ ~ blockdata ~ ~-1 ~ {auto:0b}
- ::section tagging
- :R: scoreboard players tag @a[tag=hurt] remove hurt
- scoreboard players tag @a add hurt {HurtTime:10s}
- ::section attacker_id_transfer
- :R: execute @a[score_damageDealt_min=1] ~ ~ ~ scoreboard players operation @p[tag=hurt,r=6,rm=0] attackerId = @p playerId
- execute @a[score_damageDealt_min=1] ~ ~ ~ scoreboard players set @p[tag=hurt,r=6,rm=0] attackedTime 60
- scoreboard players set @a[score_damageDealt_min=1] damageDealt 0
- ::section pre_processing_tag_clearing
- :R: scoreboard players tag @a[tag=killerSearch] remove killed
- :MULTI:
- iterations:4
- !s';died,killer,fellOff,killerSearch
- scoreboard players tag @a[tag=%s] remove %s
- ::section killing
- #Add the "died" tag for all players on red clay.
- :R: execute @a[score_playerId_min=0] ~ ~ ~ detect ~ ~-1 ~ minecraft:stained_hardened_clay 14 scoreboard players tag @p add died {OnGround:1b}
- #Add the "killed" tag for all players on red clay that have been attacked by a player in the last 3 seconds.
- scoreboard players tag @a[tag=died,score_attackerId_min=0] add killed
- #Add the "fellOff" tag for all players on red clay who had casually walked off the edge.
- scoreboard players tag @a[tag=!killed] add fellOff {Tags:["died"]}
- ::section find_killer
- :R: scoreboard players tag @p[tag=killed] add killerSearch
- execute @a[tag=killerSearch] ~ ~ ~ execute @a[score_playerId_min=0] ~ ~ ~ scoreboard players operation @p queryId = @p playerId
- #Subtract the killer's ID score from everyone's queryId. The killer should now have a queryId score of 0
- execute @a[tag=killerSearch] ~ ~ ~ scoreboard players operation * queryId -= @a[tag=killerSearch] attackerId
- #Tag the killer with the "killer" tag
- execute @a[tag=killerSearch] ~ ~ ~ scoreboard players tag @a[score_queryId==0] add killer
- #Increment the killer's score
- execute @a[tag=killerSearch] ~ ~ ~ scoreboard players add @a[tag=killer] $s killScore; 1
- scoreboard players reset @a[score_playerId_min=0] queryId
- ::section death_actions
- :R: execute @a[tag=fellOff] ~ ~ ~ tellraw @a [{"text":"","color":"red"},{"selector":"@p[tag=fellOff]","color":"gold"}," fell off."]
- execute @a[tag=killerSearch] ~ ~ ~ tellraw @a [{"text":"","color":"red"},{"selector":"@a[tag=killerSearch]","color":"gold"}," was knocked off by ",{"selector":"@a[tag=killer]","color":"gold"},"."]
- scoreboard players tag @a[tag=fellOff] add respawn
- scoreboard players tag @a[tag=killerSearch] add respawn
- execute @a[tag=fellOff] ~ ~ ~ particle lava ~ ~ ~ 0 0 0 1 20 force
- execute @a[tag=killerSearch] ~ ~ ~ particle lava ~ ~ ~ 0 0 0 1 20 force
- execute @a[tag=fellOff] ~ ~ ~ playsound minecraft:block.note.bass master @a ~ ~ ~ 10.0 0.5 0.0
- execute @a[tag=fellOff] ~ ~ ~ playsound minecraft:block.note.bass master @a ~ ~ ~ 10.0 0.5 0.0
- execute @a[tag=killerSearch] ~ ~ ~ playsound minecraft:entity.zombie.remedy master @a ~ ~ ~ 10.0 1.0 0.0
- execute @a[tag=killerSearch] ~ ~ ~ playsound minecraft:entity.experience_orb.pickup master @a[tag=killer] ~ ~ ~ 10.0 0.5 1.0
- ::section cooldown
- :R: scoreboard players reset @a[score_attackedTime=0] attackerId
- scoreboard players reset @a[score_attackedTime=0] attackedTime
- scoreboard players remove @a[score_attackedTime_min=1] attackedTime 1
- ::section after
- execute @e[type=ArmorStand,tag=function,name=setId] ~ ~ ~ blockdata ~ ~-1 ~ {Command:""}
Advertisement
Add Comment
Please, Sign In to add comment