Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.75 KB | None | 0 0
  1. # ----------------------------------------­­------------
  2. # The Stalker - A skript based AI / Custom Mob
  3. # ----------------------------------------­­------------
  4. # Developed by: eyesniper2
  5. # ----------------------------------------­­------------
  6. # This skript is meant to show the custom and
  7. # possibilities of AI / Custom Mobs within skript
  8. # and skRayFall
  9. # ----------------------------------------------------
  10. # Required Addons: skRayFall, skQuery
  11. # Required Plugins: Citizens
  12. # ----------------------------------------------------
  13. # Permissions
  14. # - stalker.admin
  15. # - Grants access to the admin commands to force
  16. # spawn the stalker
  17. # - stalker.spawn
  18. # - Will allow the stalker to be spawned to the
  19. # player using the timed spawn method.
  20. # ----------------------------------------------------
  21. # Command:
  22. # /spawnstalker [player] - permission "stalker.admin"
  23. # - Allows you to force spawn the stalker for either
  24. # an online player or for yourself when the first
  25. # argument is left blank
  26. # ----------------------------------------------------
  27. # Configurations/Options:
  28. options:
  29.  
  30. # This is the name, chat prefix, health and weapon of the stalker for the player.
  31.  
  32. StalkerName: &cThe Stalker
  33. StalkerPrefix: &7[&4...?&7]&r
  34. StalkerHealth: 20
  35. StalkerWeapon: iron sword
  36.  
  37. # Choose if the stalker will spawn at night only or at any time.
  38.  
  39. NightOnly: false
  40.  
  41. # The current method for spawning in the stalker to players. If you make your own custom spawning system, which is highly recommended, please set this the false.
  42.  
  43. TimedSpawn: true
  44.  
  45. # This is the dialog for the stalker to the player during a non attacking state.
  46. # To include the players name in a message just use %{_player}% in place of the name.
  47.  
  48. StalkerMessage1: Hey %{_player}% I like your skin...
  49. StalkerMessage2: It's really nice, so I made my own version of it and I love to wear it.
  50. StalkerMessage3: But of course it’s no substitute for the real thing.
  51. StalkerMessage4: Which I can't wait to get my hands on.
  52. StalkerMessage5: However, I don't think we have formally met, but I have been following you around for a while.
  53. StalkerMessage6: Watching your every move, every block you have broken and placed.
  54. StalkerMessage7: Watching every piece of meat you have meticulously cooked, and every animal you have killed.
  55. StalkerMessage8: I'm a big fan of your work and I can't wait to get to know you from the inside out.
  56. StalkerMessage9: You should turn around and have a look at what I have made, I think you would be impressed.
  57. StalkerMessage10: Actually don't, I get really angry when people look at me directly.
  58. StalkerMessage11: I'm a bit shy so when people look at me I tend to go into a bit of a rage.
  59. StalkerMessage12: But back to you and your perfect skin.
  60. StalkerMessage13: Getting the details perfect on the square head of yours was a bit of a challenge.
  61. StalkerMessage14: I needed to sneak in multiple times while you were sleeping so that everything would be perfect.
  62. StalkerMessage15: But it was all worth it in the end and it will be once I replace you.
  63.  
  64. # This is the message sent when the player decides to ignore the stalker for
  65. # The full 2 min.
  66.  
  67. StalkerLeaveMessage: However you seem to be disinterested, I'll come back and visit you later.
  68.  
  69. StalkerAttackTimeRunOutMessage: Wow you are tough to catch, I'll come back later.
  70.  
  71. # These two sections represent the dialog displayed when the stalker either dies or is killed by the player.
  72.  
  73. StalkerGlobalKillMessage: &6%victim% &rhas meet their fait at the hands of &c%victim%
  74. StalkerKillMessage: &cThanks for your skin... Ill come get some more later.
  75.  
  76. StalkerGlobalDeathMessage: %attacker% has defeated &c%attacker%
  77. StalkerDeathMessage: &cI will come again... watch your back.
  78.  
  79. # These are the messages that the attacker will say to the player while attacking.
  80. # Add %{_player}% to the message for the attacker to say the players name in the message.
  81.  
  82. StalkerAttackingMessage1: &4DONT LOOK AT ME LIKE THAT!
  83. StalkerAttackingMessage2: &4I WILL MAKE YOU PAY!
  84. StalkerAttackingMessage3: &4Your blood will be the answer.
  85. StalkerAttackingMessage4: &4ooooo you are a bit squishy.
  86. StalkerAttackingMessage5: &4Give up, it will be easier!
  87. StalkerAttackingMessage6: &4Just die %{_player}%!
  88.  
  89. # The sounds that are played as the stalkers spawns in and out or when the speak to the player.
  90. # The complete list of sounds can be found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
  91.  
  92. SpawnDespawnSoundEffect: ENDERDRAGON_GROWL
  93. ChatSoundEffect: ENDERMAN_SCREAM
  94. AttackSound: ENDERDRAGON_GROWL
  95.  
  96. #This will increase the base damage done by the stalker to the player. This is damage on top of the base output of the given weapon.
  97.  
  98. StalkerDamageIncrease: 3
  99. # ----------------------------------------------------
  100. # Developer info:
  101.  
  102. # If you want to use this in your own skripts and code your own spawning system you can do so by
  103. # Calling the subroutine "spawnStalker" and invoking the target for the stalker.
  104. # This is the line of code you would use to spawn a stalker for the current player in a event:
  105. # invoke "spawnStalker" from player
  106. # ----------------------------------------------------
  107. # Closing Remarks:
  108.  
  109. # Below is all the code that runs this skript. I recommended you have a look at it and explore/modify/experiment with the code.
  110. # However I cannot guarantee that I will be unable to offer you support once you modify this code.
  111. # Enjoy and thanks for the download!
  112. # Happy Skripting!
  113. # ----------------------------------------------------
  114.  
  115.  
  116. # This is the natural timed spawn method. It is recommended that you use this as a template for
  117. # Your own spawning techniques and then set the "TimedSpawn" option to false.
  118. # If you want to increase or decrease the time modify the "every 10 minutes:" to your desired time span.
  119. # For example if you want the spawning code to run every 2 hours, it would be "every 2 hours:".
  120. # You can also adjust the chance of the stalker spawning for each player by adjusting the "chance of 20%"
  121. # and changing the 20 to a different number in between 1 and 100.
  122. every 10 minutes:
  123. {@TimedSpawn} is true
  124. loop all players:
  125. loop-player has permission "stalker.spawn"
  126. chance of 20%:
  127. invoke "spawnStalker" from loop-player
  128. # ----------------------------------------------------
  129.  
  130.  
  131. command /spawnstalker [<player>]:
  132. trigger:
  133. if arg 1 is set:
  134. if player has permission "stalker.admin":
  135. arg 1 is online
  136. invoke "spawnStalker" from arg 1
  137. else:
  138. message "&cYou must have the permission &astalker.admin&c to do that!"
  139. else:
  140. if player has permission "stalker.admin":
  141. invoke "spawnStalker" from player
  142. else:
  143. message "&cYou must have the permission &astalker.admin&c to do that!"
  144.  
  145. sub "spawnStalker":
  146. set {_player} to parameter 1
  147. if {@NightOnly} is true:
  148. time in {_player}'s world is not night
  149. stop
  150. if {Stalker::%{_player}%} is set:
  151. send "&7[&4Stalker&7] &cYou cannot spawn multiple stalkers for 1 player at once!" to console
  152. stop
  153. set {_startingLocation} to block 4 blocks behind {_player}
  154. set {_safe} to false
  155. set {_startingLocation} to block 7 blocks behind {_player}
  156. set {_startingLocation} to block 5 blocks below {_startingLocation}
  157. loop 5 times:
  158. set {_startingLocation} to block behind {_startingLocation}
  159. loop 8 times:
  160. set {_startingLocation} to block above {_startingLocation}
  161. block at {_startingLocation} is air
  162. block above {_startingLocation} is air
  163. block below {_startingLocation} is not air
  164. set {_safe} to true
  165. stop loop
  166. if {_safe} == true:
  167. stop loop
  168. if {_safe} == false:
  169. stop
  170. create a citizen named "{@StalkerName}" at {_startingLocation}
  171. set {_stalkerID} to last created citizen
  172. give npc {_stalkerID} the look close trait
  173. equip citizen {_stalkerID} with stone sword
  174. set {Stalker::%{_player}%} to {_stalkerID}
  175. change citizen {_stalkerID} skin to "%{_player}%"
  176. wait 2 seconds
  177. play "{@SpawnDespawnSoundEffect}" to {_player}
  178. invoke "stalkerFightTicker" from {_player}
  179. invoke "stalkerMovementTicker" from {_player}
  180. loop 15 times:
  181. if {Stalker.Attack::%{_player}%} == true:
  182. stop
  183. if {Stalker::%{_player}%} is not set:
  184. stop
  185. if loop-value == 1:
  186. send "{@StalkerPrefix} {@StalkerMessage1}" to {_player}
  187. if loop-value == 2:
  188. send "{@StalkerPrefix} {@StalkerMessage2}" to {_player}
  189. if loop-value == 3:
  190. send "{@StalkerPrefix} {@StalkerMessage3}" to {_player}
  191. if loop-value == 4:
  192. send "{@StalkerPrefix} {@StalkerMessage4}" to {_player}
  193. if loop-value == 5:
  194. send "{@StalkerPrefix} {@StalkerMessage5}" to {_player}
  195. if loop-value == 6:
  196. send "{@StalkerPrefix} {@StalkerMessage6}" to {_player}
  197. if loop-value == 7:
  198. send "{@StalkerPrefix} {@StalkerMessage7}" to {_player}
  199. if loop-value == 8:
  200. send "{@StalkerPrefix} {@StalkerMessage8}" to {_player}
  201. if loop-value == 9:
  202. send "{@StalkerPrefix} {@StalkerMessage9}" to {_player}
  203. if loop-value == 10:
  204. send "{@StalkerPrefix} {@StalkerMessage10}" to {_player}
  205. if loop-value == 11:
  206. send "{@StalkerPrefix} {@StalkerMessage11}" to {_player}
  207. if loop-value == 12:
  208. send "{@StalkerPrefix} {@StalkerMessage12}" to {_player}
  209. if loop-value == 13:
  210. send "{@StalkerPrefix} {@StalkerMessage13}" to {_player}
  211. if loop-value == 14:
  212. send "{@StalkerPrefix} {@StalkerMessage14}" to {_player}
  213. if loop-value == 15:
  214. send "{@StalkerPrefix} {@StalkerMessage15}" to {_player}
  215. play "{@ChatSoundEffect}" to {_player}
  216. wait 8 seconds
  217. send "{@StalkerPrefix} {@StalkerLeaveMessage}" to {_player}
  218. play "{@SpawnDespawnSoundEffect}" to {_player}
  219. delete {Stalker::%{_player}%}
  220. destroy citizen {_stalkerID}
  221. delete {Stalker.Attack::%{_player}%}
  222.  
  223.  
  224. sub "stalkerFightTicker":
  225. set {_player} to parameter 1
  226. while {Stalker::%{_player}%} is set:
  227. wait 1 second
  228. if {_player} is not online:
  229. destroy citizen {Stalker::%{_player}%}
  230. delete {Stalker::%{_player}%}
  231. delete {Stalker.Attack::%{_player}%}
  232. stop
  233. {_player}'s target is citizen {Stalker::%{_player}%}
  234. make citizen {Stalker::%{_player}%} hold {@StalkerWeapon}
  235. send "{@StalkerPrefix} {@StalkerAttackingMessage1}" to {_player}
  236. play "{@AttackSound}" to {_player}
  237. move citizen {Stalker::%{_player}%} to location of {_player} at speed 2
  238. make citizen {Stalker::%{_player}%} vulnerable
  239. set citizens {Stalker::%{_player}%} max health to {@StalkerHealth}
  240. wait 4 ticks
  241. make citizen {Stalker::%{_player}%} attack {_player}
  242. set {Stalker.Attack::%{_player}%} to true
  243. loop 5 times:
  244. {_player} is online
  245. play "{@AttackSound}" to {_player}
  246. wait 8 seconds
  247. if {Stalker::%{_player}%} is not set:
  248. stop
  249. if citizen {Stalker::%{_player}%} is dead:
  250. stop
  251. if {_player} is dead:
  252. stop
  253. make citizen {Stalker::%{_player}%} attack {_player}
  254. if loop-value == 1:
  255. send "{@StalkerPrefix} {@StalkerAttackingMessage2}" to {_player}
  256. if loop-value == 2:
  257. send "{@StalkerPrefix} {@StalkerAttackingMessage3}" to {_player}
  258. if loop-value == 3:
  259. send "{@StalkerPrefix} {@StalkerAttackingMessage4}" to {_player}
  260. if loop-value == 4:
  261. send "{@StalkerPrefix} {@StalkerAttackingMessage5}" to {_player}
  262. if loop-value == 5:
  263. send "{@StalkerPrefix} {@StalkerAttackingMessage6}" to {_player}
  264. play "{@AttackSound}" to {_player}
  265. wait 5 seconds
  266. if {Stalker::%{_player}%} is not set:
  267. stop
  268. else:
  269. send "{@StalkerPrefix} {@StalkerAttackTimeRunOutMessage}" to {_player}
  270. play "{@SpawnDespawnSoundEffect}" to {_player}
  271. destroy citizen {Stalker::%{_player}%}
  272. delete {Stalker::%{_player}%}
  273. delete {Stalker.Attack::%{_player}%}
  274. stop
  275.  
  276. sub "stalkerMovementTicker":
  277. set {_player} to parameter 1
  278. while {Stalker::%{_player}%} is set:
  279. if {Stalker.Attack::%{_player}%} == true:
  280. stop
  281. if {_player} is not online:
  282. delete {Stalker.Attack::%{_player}%}
  283. delete {Stalker::%{_player}%}
  284. destroy citizen {Stalker::%{_player}%}
  285. stop
  286. set {_target} to block 5 blocks behind location of {_player}
  287. move citizen {Stalker::%{_player}%} to {_target} at speed 1.5
  288. wait 5 seconds
  289.  
  290. on death:
  291. if attacker is citizen {Stalker::%victim%}:
  292. set the death message to "{@StalkerGlobalKillMessage}"
  293. send "{@StalkerPrefix} {@StalkerKillMessage}" to victim
  294. delete {Stalker.Attack::%victim%}
  295. wait 2 seconds
  296. destroy citizen {Stalker::%victim%}
  297. delete {Stalker::%victim%}
  298. if victim is npc {Stalker::%attacker%}:
  299. set the death message to "{@StalkerGlobalDeathMessage}"
  300. send "{@StalkerPrefix} {@StalkerDeathMessage}" to attacker
  301. delete {Stalker.Attack::%attacker%}
  302. destroy citizen {Stalker::%attacker%}
  303. delete {Stalker::%attacker%}
  304.  
  305. on skript start:
  306. delete {Stalker::*}
  307. delete {Stalker.Attack::*}
  308.  
  309. on damage:
  310. attacker is npc {Stalker::%victim%}
  311. victim is a player
  312. increase the damage by {@StalkerDamageIncrease}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement