This script generates a circle, and then plays an effect at each point on the circle.
Read the comments for info on definitions.
All definitions are optional except the starting location.
It creates the circle, then displays the points so the generation part can be taken and used elsewhere if you so desire.
Raw code:
URL: https://one.denizenscript.com/haste/71208
Read the comments for info on definitions.
Code:
- run CircleGenerator def:[Location](|Radius)(|Stepsize)(|Effect)(|Delay)
All definitions are optional except the starting location.
It creates the circle, then displays the points so the generation part can be taken and used elsewhere if you so desire.
Raw code:
Code:
CircleGenerator:
type: task
debug: false
# Centre is the centre of the circle.
# Radius is the size of the circle.
# Step size is the distance between each point.
# Effect is the type of effects to play.
# Delay is the delay between creating each point.
definitions: centre|radius|stepsize|effect|delay
script:
- if !<[centre].exists>:
- narrate "<red>A centre point must be specified!"
- stop
# Start at 0.
- define angle 0
# Default the radius to 1 block.
- if !<[radius].exists>:
- define radius 1
# Default the step size to 0.1 blocks.
- if !<[stepsize].exists>:
- define stepsize 0.1
# Default the effect to a flame.
- if !<[effect].exists>:
- define effect flame
# Select a random effect
- if <[effect]> == random:
- define effect <server.particle_types.random>
# Instantly create if no delay is specified.
- if !<[delay].exists>:
- define delay 0
- define points <list[]>
# We want to step until the angle is 2 x pi (a full circle is 2 x pi radians.).
- while <[angle].is[LESS].than[<util.pi.mul[2]>]>:
# calculate X
- define x <[radius].mul[<[angle].cos>]>
# calculate Z (for some stupid reason Y is up and down).
- define z <[radius].mul[<[angle].sin>]>
# Add our step size to the total angle.
- define angle:+:<[stepsize]>
# Add the point to our list.
- define points:->:<[centre].add[<[x]>,0,<[z]>]>
# Delay each step if specified in our run.
- if <[delay]> != 0:
# Playeffect at each point individually.
- foreach <[points]> as:point:
- playeffect effect:<[effect]> at:<[point]> offset:0 quantity:2
# Deley between each point.
- wait <[delay]>t
- stop
# If delay is 0 (instant), we create the circle in one hit.
- playeffect at:<[points]> effect:<[effect]> offset:0 quantity:2
URL: https://one.denizenscript.com/haste/71208