Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ----------------------------------------ÂÂ------------
- # The Stalker - A skript based AI / Custom Mob
- # ----------------------------------------ÂÂ------------
- # Developed by: eyesniper2
- # ----------------------------------------ÂÂ------------
- # This skript is meant to show the custom and
- # possibilities of AI / Custom Mobs within skript
- # and skRayFall
- # ----------------------------------------------------
- # Required Addons: skRayFall, skQuery
- # Required Plugins: Citizens
- # ----------------------------------------------------
- # Permissions
- # - stalker.admin
- # - Grants access to the admin commands to force
- # spawn the stalker
- # - stalker.spawn
- # - Will allow the stalker to be spawned to the
- # player using the timed spawn method.
- # ----------------------------------------------------
- # Command:
- # /spawnstalker [player] - permission "stalker.admin"
- # - Allows you to force spawn the stalker for either
- # an online player or for yourself when the first
- # argument is left blank
- # ----------------------------------------------------
- # Configurations/Options:
- options:
- # This is the name, chat prefix, health and weapon of the stalker for the player.
- StalkerName: &cThe Stalker
- StalkerPrefix: &7[&4...?&7]&r
- StalkerHealth: 20
- StalkerWeapon: iron sword
- # Choose if the stalker will spawn at night only or at any time.
- NightOnly: false
- # 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.
- TimedSpawn: true
- # This is the dialog for the stalker to the player during a non attacking state.
- # To include the players name in a message just use %{_player}% in place of the name.
- StalkerMessage1: Hey %{_player}% I like your skin...
- StalkerMessage2: It's really nice, so I made my own version of it and I love to wear it.
- StalkerMessage3: But of course it’s no substitute for the real thing.
- StalkerMessage4: Which I can't wait to get my hands on.
- StalkerMessage5: However, I don't think we have formally met, but I have been following you around for a while.
- StalkerMessage6: Watching your every move, every block you have broken and placed.
- StalkerMessage7: Watching every piece of meat you have meticulously cooked, and every animal you have killed.
- StalkerMessage8: I'm a big fan of your work and I can't wait to get to know you from the inside out.
- StalkerMessage9: You should turn around and have a look at what I have made, I think you would be impressed.
- StalkerMessage10: Actually don't, I get really angry when people look at me directly.
- StalkerMessage11: I'm a bit shy so when people look at me I tend to go into a bit of a rage.
- StalkerMessage12: But back to you and your perfect skin.
- StalkerMessage13: Getting the details perfect on the square head of yours was a bit of a challenge.
- StalkerMessage14: I needed to sneak in multiple times while you were sleeping so that everything would be perfect.
- StalkerMessage15: But it was all worth it in the end and it will be once I replace you.
- # This is the message sent when the player decides to ignore the stalker for
- # The full 2 min.
- StalkerLeaveMessage: However you seem to be disinterested, I'll come back and visit you later.
- StalkerAttackTimeRunOutMessage: Wow you are tough to catch, I'll come back later.
- # These two sections represent the dialog displayed when the stalker either dies or is killed by the player.
- StalkerGlobalKillMessage: &6%victim% &rhas meet their fait at the hands of &c%victim%
- StalkerKillMessage: &cThanks for your skin... Ill come get some more later.
- StalkerGlobalDeathMessage: %attacker% has defeated &c%attacker%
- StalkerDeathMessage: &cI will come again... watch your back.
- # These are the messages that the attacker will say to the player while attacking.
- # Add %{_player}% to the message for the attacker to say the players name in the message.
- StalkerAttackingMessage1: &4DONT LOOK AT ME LIKE THAT!
- StalkerAttackingMessage2: &4I WILL MAKE YOU PAY!
- StalkerAttackingMessage3: &4Your blood will be the answer.
- StalkerAttackingMessage4: &4ooooo you are a bit squishy.
- StalkerAttackingMessage5: &4Give up, it will be easier!
- StalkerAttackingMessage6: &4Just die %{_player}%!
- # The sounds that are played as the stalkers spawns in and out or when the speak to the player.
- # The complete list of sounds can be found here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
- SpawnDespawnSoundEffect: ENDERDRAGON_GROWL
- ChatSoundEffect: ENDERMAN_SCREAM
- AttackSound: ENDERDRAGON_GROWL
- #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.
- StalkerDamageIncrease: 3
- # ----------------------------------------------------
- # Developer info:
- # If you want to use this in your own skripts and code your own spawning system you can do so by
- # Calling the subroutine "spawnStalker" and invoking the target for the stalker.
- # This is the line of code you would use to spawn a stalker for the current player in a event:
- # invoke "spawnStalker" from player
- # ----------------------------------------------------
- # Closing Remarks:
- # Below is all the code that runs this skript. I recommended you have a look at it and explore/modify/experiment with the code.
- # However I cannot guarantee that I will be unable to offer you support once you modify this code.
- # Enjoy and thanks for the download!
- # Happy Skripting!
- # ----------------------------------------------------
- # This is the natural timed spawn method. It is recommended that you use this as a template for
- # Your own spawning techniques and then set the "TimedSpawn" option to false.
- # If you want to increase or decrease the time modify the "every 10 minutes:" to your desired time span.
- # For example if you want the spawning code to run every 2 hours, it would be "every 2 hours:".
- # You can also adjust the chance of the stalker spawning for each player by adjusting the "chance of 20%"
- # and changing the 20 to a different number in between 1 and 100.
- every 10 minutes:
- {@TimedSpawn} is true
- loop all players:
- loop-player has permission "stalker.spawn"
- chance of 20%:
- invoke "spawnStalker" from loop-player
- # ----------------------------------------------------
- command /spawnstalker [<player>]:
- trigger:
- if arg 1 is set:
- if player has permission "stalker.admin":
- arg 1 is online
- invoke "spawnStalker" from arg 1
- else:
- message "&cYou must have the permission &astalker.admin&c to do that!"
- else:
- if player has permission "stalker.admin":
- invoke "spawnStalker" from player
- else:
- message "&cYou must have the permission &astalker.admin&c to do that!"
- sub "spawnStalker":
- set {_player} to parameter 1
- if {@NightOnly} is true:
- time in {_player}'s world is not night
- stop
- if {Stalker::%{_player}%} is set:
- send "&7[&4Stalker&7] &cYou cannot spawn multiple stalkers for 1 player at once!" to console
- stop
- set {_startingLocation} to block 4 blocks behind {_player}
- set {_safe} to false
- set {_startingLocation} to block 7 blocks behind {_player}
- set {_startingLocation} to block 5 blocks below {_startingLocation}
- loop 5 times:
- set {_startingLocation} to block behind {_startingLocation}
- loop 8 times:
- set {_startingLocation} to block above {_startingLocation}
- block at {_startingLocation} is air
- block above {_startingLocation} is air
- block below {_startingLocation} is not air
- set {_safe} to true
- stop loop
- if {_safe} == true:
- stop loop
- if {_safe} == false:
- stop
- create a citizen named "{@StalkerName}" at {_startingLocation}
- set {_stalkerID} to last created citizen
- give npc {_stalkerID} the look close trait
- equip citizen {_stalkerID} with stone sword
- set {Stalker::%{_player}%} to {_stalkerID}
- change citizen {_stalkerID} skin to "%{_player}%"
- wait 2 seconds
- play "{@SpawnDespawnSoundEffect}" to {_player}
- invoke "stalkerFightTicker" from {_player}
- invoke "stalkerMovementTicker" from {_player}
- loop 15 times:
- if {Stalker.Attack::%{_player}%} == true:
- stop
- if {Stalker::%{_player}%} is not set:
- stop
- if loop-value == 1:
- send "{@StalkerPrefix} {@StalkerMessage1}" to {_player}
- if loop-value == 2:
- send "{@StalkerPrefix} {@StalkerMessage2}" to {_player}
- if loop-value == 3:
- send "{@StalkerPrefix} {@StalkerMessage3}" to {_player}
- if loop-value == 4:
- send "{@StalkerPrefix} {@StalkerMessage4}" to {_player}
- if loop-value == 5:
- send "{@StalkerPrefix} {@StalkerMessage5}" to {_player}
- if loop-value == 6:
- send "{@StalkerPrefix} {@StalkerMessage6}" to {_player}
- if loop-value == 7:
- send "{@StalkerPrefix} {@StalkerMessage7}" to {_player}
- if loop-value == 8:
- send "{@StalkerPrefix} {@StalkerMessage8}" to {_player}
- if loop-value == 9:
- send "{@StalkerPrefix} {@StalkerMessage9}" to {_player}
- if loop-value == 10:
- send "{@StalkerPrefix} {@StalkerMessage10}" to {_player}
- if loop-value == 11:
- send "{@StalkerPrefix} {@StalkerMessage11}" to {_player}
- if loop-value == 12:
- send "{@StalkerPrefix} {@StalkerMessage12}" to {_player}
- if loop-value == 13:
- send "{@StalkerPrefix} {@StalkerMessage13}" to {_player}
- if loop-value == 14:
- send "{@StalkerPrefix} {@StalkerMessage14}" to {_player}
- if loop-value == 15:
- send "{@StalkerPrefix} {@StalkerMessage15}" to {_player}
- play "{@ChatSoundEffect}" to {_player}
- wait 8 seconds
- send "{@StalkerPrefix} {@StalkerLeaveMessage}" to {_player}
- play "{@SpawnDespawnSoundEffect}" to {_player}
- delete {Stalker::%{_player}%}
- destroy citizen {_stalkerID}
- delete {Stalker.Attack::%{_player}%}
- sub "stalkerFightTicker":
- set {_player} to parameter 1
- while {Stalker::%{_player}%} is set:
- wait 1 second
- if {_player} is not online:
- destroy citizen {Stalker::%{_player}%}
- delete {Stalker::%{_player}%}
- delete {Stalker.Attack::%{_player}%}
- stop
- {_player}'s target is citizen {Stalker::%{_player}%}
- make citizen {Stalker::%{_player}%} hold {@StalkerWeapon}
- send "{@StalkerPrefix} {@StalkerAttackingMessage1}" to {_player}
- play "{@AttackSound}" to {_player}
- move citizen {Stalker::%{_player}%} to location of {_player} at speed 2
- make citizen {Stalker::%{_player}%} vulnerable
- set citizens {Stalker::%{_player}%} max health to {@StalkerHealth}
- wait 4 ticks
- make citizen {Stalker::%{_player}%} attack {_player}
- set {Stalker.Attack::%{_player}%} to true
- loop 5 times:
- {_player} is online
- play "{@AttackSound}" to {_player}
- wait 8 seconds
- if {Stalker::%{_player}%} is not set:
- stop
- if citizen {Stalker::%{_player}%} is dead:
- stop
- if {_player} is dead:
- stop
- make citizen {Stalker::%{_player}%} attack {_player}
- if loop-value == 1:
- send "{@StalkerPrefix} {@StalkerAttackingMessage2}" to {_player}
- if loop-value == 2:
- send "{@StalkerPrefix} {@StalkerAttackingMessage3}" to {_player}
- if loop-value == 3:
- send "{@StalkerPrefix} {@StalkerAttackingMessage4}" to {_player}
- if loop-value == 4:
- send "{@StalkerPrefix} {@StalkerAttackingMessage5}" to {_player}
- if loop-value == 5:
- send "{@StalkerPrefix} {@StalkerAttackingMessage6}" to {_player}
- play "{@AttackSound}" to {_player}
- wait 5 seconds
- if {Stalker::%{_player}%} is not set:
- stop
- else:
- send "{@StalkerPrefix} {@StalkerAttackTimeRunOutMessage}" to {_player}
- play "{@SpawnDespawnSoundEffect}" to {_player}
- destroy citizen {Stalker::%{_player}%}
- delete {Stalker::%{_player}%}
- delete {Stalker.Attack::%{_player}%}
- stop
- sub "stalkerMovementTicker":
- set {_player} to parameter 1
- while {Stalker::%{_player}%} is set:
- if {Stalker.Attack::%{_player}%} == true:
- stop
- if {_player} is not online:
- delete {Stalker.Attack::%{_player}%}
- delete {Stalker::%{_player}%}
- destroy citizen {Stalker::%{_player}%}
- stop
- set {_target} to block 5 blocks behind location of {_player}
- move citizen {Stalker::%{_player}%} to {_target} at speed 1.5
- wait 5 seconds
- on death:
- if attacker is citizen {Stalker::%victim%}:
- set the death message to "{@StalkerGlobalKillMessage}"
- send "{@StalkerPrefix} {@StalkerKillMessage}" to victim
- delete {Stalker.Attack::%victim%}
- wait 2 seconds
- destroy citizen {Stalker::%victim%}
- delete {Stalker::%victim%}
- if victim is npc {Stalker::%attacker%}:
- set the death message to "{@StalkerGlobalDeathMessage}"
- send "{@StalkerPrefix} {@StalkerDeathMessage}" to attacker
- delete {Stalker.Attack::%attacker%}
- destroy citizen {Stalker::%attacker%}
- delete {Stalker::%attacker%}
- on skript start:
- delete {Stalker::*}
- delete {Stalker.Attack::*}
- on damage:
- attacker is npc {Stalker::%victim%}
- victim is a player
- increase the damage by {@StalkerDamageIncrease}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement