Paste #128060: Outward spiral script (For example of application of cosine and sine, inspiring the corkscrew)

Date: 2024/11/12 06:59:19 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


flat_outward_spiral_template_script:
    type: task
    debug: true
    script:
    - playsound sound:block_trial_spawner_spawn_item_begin <player.location> volume:2.0
    - define center <player.location>
    # default radius = 0 (DO NOT CHANGE)
    - define radius 0
    - define radius_increment 0.1
    # default max_radius = 10 (Size of spiral)
    - define max_radius 10
    - define angle 0
    - define angle_increment 15
    # default effect = dust_color_transition
    - define effect dust_color_transition
    # default particle thickness = 10
    - define particle_thickness 10
    - define impact_amount 5
    - if !<[center].find_entities.within[<[max_radius]>].is_empty>:
        - define affected_entities <[center].find_entities.within[<[max_radius]>]>
        #- heal <[impact_amount]> target:<[affected_entities]> --> KEEP THIS - IF COMMAND FOR AOE EFFECT.
    # FOR EFFECTS ON CASTER, REPLACE - IF COMMAND WITH SIMPLE COMMANDS AT SAME INDENTATION AS THIS HASHTAG AND REMOVE - IF AND INDENTED CONSTITUENTS.
    - repeat <[max_radius].div[<[radius_increment]>]> 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 <[radius].mul[<[cos_angle]>]>
        - define z_offset <[radius].mul[<[sin_angle]>]>
        - define particle_location <[center].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 radius <[radius].add[<[radius_increment]>]>
        - define angle <[angle].add[<[angle_increment]>]>