Energyxxer

Kill System Test by Energyxxer

Jun 25th, 2016
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.52 KB | None | 0 0
  1. ::section config
  2. name: Kill System
  3.  
  4. import:
  5. #Relative Blocks (BETA TEST)
  6. yLuBwShx
  7.  
  8. ::section notes
  9. #[CHANGE THIS (kills) TO YOUR SCORE]
  10. $shortcut killScore ItemKills
  11. # /!\
  12.  
  13. ::section before
  14. #Damage Taken
  15. scoreboard objectives add damageDealt stat.damageDealt Damage Dealt
  16.  
  17. #Unique Player Identifier
  18. scoreboard objectives add playerId dummy
  19.  
  20. #Copy of Player Identifier used to find killer
  21. scoreboard objectives add queryId dummy
  22.  
  23. #Player ID of the last player they were attacked by
  24. scoreboard objectives add attackerId dummy
  25.  
  26. #Timer ticking down after being attacked to reset attacker
  27. scoreboard objectives add attackedTime dummy
  28.  
  29. ::section IDs
  30. :I!: scoreboard players set @a playerId 0
  31. $f setId;
  32. :R: $function setId
  33. scoreboard players tag @p[score_playerId=0] add setId
  34. scoreboard players operation @a[tag=setId] playerId > * playerId
  35. scoreboard players add @a[tag=setId] playerId 1
  36. scoreboard players tag @a[tag=setId] remove setId
  37. testfor @a[score_playerId=0] $pos a set;
  38. testforblock $pos a get; minecraft:chain_command_block -1 {SuccessCount:0}
  39. :?: execute @e[type=ArmorStand,tag=function,name=setId] ~ ~ ~ blockdata ~ ~-1 ~ {auto:0b}
  40.  
  41. ::section tagging
  42. :R: scoreboard players tag @a[tag=hurt] remove hurt
  43. scoreboard players tag @a add hurt {HurtTime:10s}
  44.  
  45. ::section attacker_id_transfer
  46. :R: execute @a[score_damageDealt_min=1] ~ ~ ~ scoreboard players operation @p[tag=hurt,r=6,rm=0] attackerId = @p playerId
  47. execute @a[score_damageDealt_min=1] ~ ~ ~ scoreboard players set @p[tag=hurt,r=6,rm=0] attackedTime 60
  48. scoreboard players set @a[score_damageDealt_min=1] damageDealt 0
  49.  
  50. ::section pre_processing_tag_clearing
  51. :R: scoreboard players tag @a[tag=killerSearch] remove killed
  52. :MULTI:
  53. iterations:4
  54. !s';died,killer,fellOff,killerSearch
  55. scoreboard players tag @a[tag=%s] remove %s
  56.  
  57. ::section killing
  58. #Add the "died" tag for all players on red clay.
  59. :R: execute @a[score_playerId_min=0] ~ ~ ~ detect ~ ~-1 ~ minecraft:stained_hardened_clay 14 scoreboard players tag @p add died {OnGround:1b}
  60.  
  61. #Add the "killed" tag for all players on red clay that have been attacked by a player in the last 3 seconds.
  62. scoreboard players tag @a[tag=died,score_attackerId_min=0] add killed
  63.  
  64. #Add the "fellOff" tag for all players on red clay who had casually walked off the edge.
  65. scoreboard players tag @a[tag=!killed] add fellOff {Tags:["died"]}
  66.  
  67. ::section find_killer
  68. :R: scoreboard players tag @p[tag=killed] add killerSearch
  69.  
  70. execute @a[tag=killerSearch] ~ ~ ~ execute @a[score_playerId_min=0] ~ ~ ~ scoreboard players operation @p queryId = @p playerId
  71.  
  72. #Subtract the killer's ID score from everyone's queryId. The killer should now have a queryId score of 0
  73. execute @a[tag=killerSearch] ~ ~ ~ scoreboard players operation * queryId -= @a[tag=killerSearch] attackerId
  74.  
  75. #Tag the killer with the "killer" tag
  76. execute @a[tag=killerSearch] ~ ~ ~ scoreboard players tag @a[score_queryId==0] add killer
  77.  
  78. #Increment the killer's score
  79. execute @a[tag=killerSearch] ~ ~ ~ scoreboard players add @a[tag=killer] $s killScore; 1
  80.  
  81. scoreboard players reset @a[score_playerId_min=0] queryId
  82.  
  83. ::section death_actions
  84. :R: execute @a[tag=fellOff] ~ ~ ~ tellraw @a [{"text":"","color":"red"},{"selector":"@p[tag=fellOff]","color":"gold"}," fell off."]
  85. 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"},"."]
  86. scoreboard players tag @a[tag=fellOff] add respawn
  87. scoreboard players tag @a[tag=killerSearch] add respawn
  88. execute @a[tag=fellOff] ~ ~ ~ particle lava ~ ~ ~ 0 0 0 1 20 force
  89. execute @a[tag=killerSearch] ~ ~ ~ particle lava ~ ~ ~ 0 0 0 1 20 force
  90. execute @a[tag=fellOff] ~ ~ ~ playsound minecraft:block.note.bass master @a ~ ~ ~ 10.0 0.5 0.0
  91. execute @a[tag=fellOff] ~ ~ ~ playsound minecraft:block.note.bass master @a ~ ~ ~ 10.0 0.5 0.0
  92. execute @a[tag=killerSearch] ~ ~ ~ playsound minecraft:entity.zombie.remedy master @a ~ ~ ~ 10.0 1.0 0.0
  93. execute @a[tag=killerSearch] ~ ~ ~ playsound minecraft:entity.experience_orb.pickup master @a[tag=killer] ~ ~ ~ 10.0 0.5 1.0
  94.  
  95. ::section cooldown
  96. :R: scoreboard players reset @a[score_attackedTime=0] attackerId
  97. scoreboard players reset @a[score_attackedTime=0] attackedTime
  98. scoreboard players remove @a[score_attackedTime_min=1] attackedTime 1
  99.  
  100. ::section after
  101. execute @e[type=ArmorStand,tag=function,name=setId] ~ ~ ~ blockdata ~ ~-1 ~ {Command:""}
Advertisement
Add Comment
Please, Sign In to add comment