ChaoticRedstone

NPC Chat System

Aug 17th, 2017
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. /// MINECRAFT VERSION 1.12.1 ///
  2.  
  3. //scoreboards for variation 1 (Display Custom Message With Options)
  4. > /scoreboard objectives add c1 dummy
  5. > /scoreboard objectives add talk stat.talkedToVillager
  6.  
  7. //test if player is within 5 blocks of NPC Henry and tellraw
  8. > /execute @e[name=Henry,tag=guy1] ~ ~ ~ /scoreboard players add @p[score_talk_min=1,r=5] c1 1
  9. > /tellraw @a[score_c1_min=1,score_c1=1,score_talk_min=1,score_talk=1] {"text":"Henry: ","color":"gold","extra":[{"text":"You got any water?","color":"white"}]}
  10. > /tellraw @a[score_c1_min=1,score_c1=1,score_talk_min=1,score_talk=1] ["",{"text":"Yes","color":"green","clickEvent":{"action":"run_command","value":"/tellraw @a [\"\",{\"text\":\"Liar!\",\"color\":\"white\"}]"}}]
  11. > /tellraw @a[score_c1_min=1,score_talk_min=1,score_talk=1] ["",{"text":"No","color":"red","clickEvent":{"action":"run_command","value":"/tellraw @a [\"\",{\"text\":\"Aw :(\",\"color\":\"white\"}]"}}]
  12.  
  13. //reset scoreboards
  14. > /scoreboard players remove @a[score_talk_min=1] talk 1
  15. > /scoreboard players set @a c1 0
  16.  
  17.  
  18. //scoreboards for variation 2 (Display Just Custom Message)
  19. > /scoreboard objectives add c2 dummy
  20. > /scoreboard objectives add talk2 stat.talkedToVillager
  21.  
  22. //test if player is within 5 blocks of NPC Ryan and tellraw
  23. > /execute @e[name=Ryan,tag=guy2] ~ ~ ~ /scoreboard players add @p[score_talk2_min=1,r=5] c2 1
  24. > /tellraw @a[score_c2_min=1,score_c2=1,score_talk2_min=1,score_talk2=1] {"text":"Ryan: ","color":"gold","extra":[{"text":"Me found diamonds!","color":"white"}]}
  25.  
  26. //reset scoreboards
  27. > /scoreboard players remove @a[score_talk2_min=1] talk2 1
  28. > /scoreboard players set @a c2 0
  29.  
  30.  
  31. //scoreboards for variation 3 (Display Multiple Custom Messages)
  32. > /scoreboard objectives add c3 dummy
  33. > /scoreboard objectives add talk3 stat.talkedToVillager
  34.  
  35. //test if player is within 5 blocks of NPC Kevin and tellraw
  36. > /execute @e[name=Kevin,tag=guy3] ~ ~ ~ /scoreboard players add @p[score_talk3_min=1,r=5] c3 1
  37. > /tellraw @a[score_c3_min=1,score_c3=1,score_talk3_min=1,score_talk3=1] {"text":"Kevin: ","color":"gold","extra":[{"text":"This mineshaft...","color":"white"}]}
  38. > /tellraw @a[score_c3_min=2,score_c3=2,score_talk3_min=1,score_talk3=1] {"text":"Kevin: ","color":"gold","extra":[{"text":"Dark...","color":"white"}]}
  39. > /tellraw @a[score_c3_min=3,score_c3=3,score_talk3_min=1,score_talk3=1] {"text":"Kevin: ","color":"gold","extra":[{"text":"Scary...","color":"white"}]}
  40. //reset scoreboards
  41. > /scoreboard players remove @a[score_talk3_min=1] talk3 1
  42. > /scoreboard players set @a[score_c3_min=3] c3 0
Advertisement
Add Comment
Please, Sign In to add comment