Paste #128059: Corkscrew projectile script

Date: 2024/11/12 06:58:18 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


corkscrew_template_script:
    type: task
    debug: true
    script:
    - playsound sound:block_trial_spawner_spawn_item_begin <player.location> volume:2.0
    - define origin <player.location.add[0,1.3,0]>
    - define current_location <[origin]>
    - define direction <player.location.direction.vector>
    # default range = 30
    - define range 30
    # de fault speed = 1 (Ensure that speed and range are proportionate, otherwise you risk losing the animation and having "teleporting" particles)
    - define speed 1
    #- define impact_amount 10
    # default effect = dust_color_transition (if you change from dust, you must remove or modify the special data portion on the - playeffect command below)
    - define effect dust_color_transition
    # default particle_thickness = 10
    - define particle_thickness 10
    # default hit_effect = flash
    - define hit_effect flash
    # default hit_particle_thickness = 5
    - define hit_particle_thickness 5
    # default base_step_distance = 0.25 --> Do not change
    - define base_step_distance 0.25
    - define spiral_radius 0.5
    - define spiral_angle_increment 20
    - define angle 0
    - define step_distance <[base_step_distance].mul[<[speed]>]>
    - define step_vector <[direction].mul[<[step_distance]>]>
    - repeat <[range].div[<[step_distance]>]> as:step:
        - define angle_to_radians <[angle].to_radians>
        - define cos_angle <[angle_to_radians].cos>
        - define sin_angle <[angle_to_radians].sin>
        - define x_offset <[spiral_radius].mul[<[cos_angle]>]>
        - define z_offset <[spiral_radius].mul[<[sin_angle]>]>
        - define current_location <[current_location].add[<[step_vector]>]>
        - define particle_location <[current_location].add[<[x_offset]>,0,<[z_offset]>]>
        - playeffect effect:<[effect]> quantity:<[particle_thickness]> at:<[particle_location]> visibility:50 offset:0.1,0.1,0.1 special_data:1.0|white|red
        - define angle <[angle].add[<[spiral_angle_increment]>]>
        - if <[current_location].material.is_solid>:
            - playeffect at:<[particle_location]> quantity:<[hit_particle_thickness]> effect:<[hit_effect]> visibility:50
            - playsound sound:entity_firework_rocket_large_blast <[particle_location]> volume:2.0
            - stop
        - if !<[current_location].find_entities.within[0.4].is_empty> && <[step]> >= 10:
            - define hit_entity <[current_location].find_entities.within[0.4].first>
            - playeffect at:<[hit_entity].location> quantity:<[hit_particle_thickness]> effect:<[hit_effect]> offset:0,1,0
            - playsound sound:entity_firework_rocket_large_blast <[hit_entity].location> volume:2.0
            #- hurt <[impact_amount]> target:<[hit_entity]>
            - stop
        - wait 1t