Date: 2024/05/19 11:40:57 UTC-07:00
Type: Denizen Script
GIANT_SWORD_ABILITY:
type: world
debug: true
events:
after player right clicks block with:giants_sword:
- if <player.is_sneaking>:
- if <player.has_flag[GIANT_SWORD.cooldown]>:
- narrate "<&[error]>Please wait <player.flag_expiration[GIANT_SWORD.cooldown].from_now.formatted> before using the ability again!"
- playsound <player> sound:BLOCK_NOTE_BLOCK_BELL volume:1 pitch:2
- stop
- define material giants_sword
- define location <player.eye_location.ray_trace[range=20].if_null[null]>
- if <[location]> == null:
- narrate "<&[error]>The block is too far away!"
- playsound <player> sound:BLOCK.NOTE_BLOCK.BELL volume:1 pitch:2
- stop
- spawn item_display[item=<[material]>;view_range=300;scale=4.5,4.5,4.5;brightness=[sky=15;block=15];left_rotation=0.6,-2,0,0] <[location].above[8].with_pitch[180].with_yaw[<player.location.yaw>]> save:GIANT_SWORD
- define GIANT_SWORD <entry[GIANT_SWORD].spawned_entity>
- define targetLoc <player.eye_location.ray_trace[range=20]>
- define target <[targetLoc].find_entities[living].within[4.5]>
- hurt "30" <[target]> source:<player> if:<[target]>!=[<player>]
- playsound <[location]> sound:BLOCK_ANVIL_LAND volume:1 pitch:0.3
- if !<player.has_permission[GIANT_SWORD.delayexempt]>:
- flag player GIANT_SWORD.cooldown expire:30s
- itemcooldown iron_sword d:30s
- wait 10s
- remove <[GIANT_SWORD]> if:<[GIANT_SWORD].is_spawned>
- else:
- stop