Paste #58630: Untitled Paste

Date: 2019/09/24 14:29:56 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# +---------------------- 
# | GraveSpawn 
# | 
# | Spawn in the nearest predefined location(s) (Graveyard)! 
# +---------------------- 
# 
# @author ShadyMac 
# @denizen-version 1.0.3-snapshot (BUILD 448-dev)
# @version 1.0
# 
# Usage: /gravespawn
# When a player dies in of the defined worlds
# and one/multiple graveyards exist in this
# world, he will respawn in the nearest one
# to him. 
# +---------------------- 
#
GraveSpawn:
    type: world
    events:
###Die Event
        on player dies bukkit_priority:LOWEST:
#Define Player Location
        - define player_location "<player.flag[gravespawn.location] .as_location>"
#Flag Player location when die        
        - flag player "gravespawn.location:<player.location>"
#Keep Inventory       
        - determine passively KEEP_INV
#Keep Level        
        - determine KEEP_LEVEL 
        - title "title:<red>You have perished!" fade_in:4/{1s} stay:4/{3s} fade_out:3/{1s} targets:<player>|...        
###
###        
###Respawn Event  
###
        on player respawns:
#Define returned Death Location
        - define player_location "<player.flag[gravespawn.location].as_location>"
#Define Location of Graveyards on map
        - define location_list <s@graveyard_list.yaml_key[WORLD_NAME]>    
#Define Respawn Location Chosen       
        - define respawn_location "<def[location_list].sort_by_number[distance_squared[<player.location>]].get[1]>" 
#Sends Respawn Message        
        - narrate "You have respawned in a safe location."
#Determine which Graveyard is closest and send player  
        - title "title:<red>You have perished!" fade_in:4/{1s} stay:4/{3s} fade_out:3/{1s} targets:<player>|...
        - wait 1t
        - teleport <player> <def[respawn_location]>  
        - wait 50t        
        - title "title:<red>You awoke in the Cemetery..." "subtitle:<white>Your soul has weakend..." fade_in:4/{1s} stay:4/{3s} fade_out:3/{1s} targets:<player>|...        
#       
###Graveyard Coords###
graveyard_list:
    type: yaml data
    WORLD_NAME:
    - l@-1758,61,-1621,QCX1
    - l@-1676,89,-775,QCX1
    - l@1319,50,1962,QCX1  
    - l@667,67,-1528,QCX1     
    - l@535,46,-10,QCX1    
    - l@-344,99,471,QCX1   
    - l@-360,42,1464,QCX1
    - l@-90,55,-2239,QCX1    
#Dont forget to add ShadowPool cemetry....