Function with particle effect

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Why this doesn't work?

code_language.skript:
function particula(i: integer, p: particle effect, l: location, n: number):
    show {_i} of {_p} particle at location of {_l} at speed {_n}


on right click with boots:
    set {_l} to location of player
    particula(20, cloud, {_l}, 1)

This works:

code_language.skript:
function particula(i: integer, l: location, n: number):
    show {_i} of cloud particle at location of {_l} at speed {_n}


on right click with boots:
    set {_l} to location of player
    particula(20, {_l}, 1)
[doublepost=1497514758,1497461746][/doublepost]Hilp
 
Why this doesn't work?

code_language.skript:
function particula(i: integer, p: particle effect, l: location, n: number):
    show {_i} of {_p} particle at location of {_l} at speed {_n}


on right click with boots:
    set {_l} to location of player
    particula(20, cloud, {_l}, 1)

This works:

code_language.skript:
function particula(i: integer, l: location, n: number):
    show {_i} of cloud particle at location of {_l} at speed {_n}


on right click with boots:
    set {_l} to location of player
    particula(20, {_l}, 1)
[doublepost=1497514758,1497461746][/doublepost]Hilp
code_language.skript:
function ParticleType(i: number, particle: text, l: locations, players: players):
    if {_i} is not 0 or 1:
        loop all enum values of visualeffect:
            if "%loop-value%" is "%{_particle}%":
                spawn {_i} loop-value at {_l::*} for {_players::*}
                stop
    else:
        loop all enum values of visualeffect:
            if "%loop-value%" is "%{_particle}%":
                spawn 1 loop-value at {_l::*} for {_players::*}
                stop
I don't know if this still works or not. But basically it's looping all the enum types of visual effect which is
code_language.skript:
ender signal, mobspawner flames, potion break, smoke, hurt, sheep eating, wolf hearts, wolf shaking, wolf smoke, firework's spark, critical hit, magical critical hit, potion swirl, transparent potion swirl, spell, spell, witch spell, note, portal, flying glyph, flame, lava pop, footstep, water splash, smoke particle, huge explosion, large explosion, explosion, void fog, small smoke, cloud, coloured dust, snowball break, water drip, lava drip, snow shovel, slime, heart, angry villager, happy villager, large smoke, item crack, block break, block dust, totem and spit
And spawns a particle based on your parameters

If the code above doesn't work this will:

code_language.skript:
function ParticleType(i: number, particle: text, l: locations, players: players):
    if {_i} is not 0 or 1:
        loop ender signal, mobspawner flames, potion break, smoke, hurt, sheep eating, wolf hearts, wolf shaking, wolf smoke, firework's spark, critical hit, magical critical hit, potion swirl, transparent potion swirl, spell, spell, witch spell, note, portal, flying glyph, flame, lava pop, footstep, water splash, smoke particle, huge explosion, large explosion, explosion, void fog, small smoke, cloud, coloured dust, snowball break, water drip, lava drip, snow shovel, slime, heart, angry villager, happy villager, large smoke, item crack, block break, block dust, totem amd spit:
            if "%loop-value%" is "%{_particle}%":
                spawn {_i} loop-value at {_l::*} for {_players::*}
                stop
    else:
        loop ender signal, mobspawner flames, potion break, smoke, hurt, sheep eating, wolf hearts, wolf shaking, wolf smoke, firework's spark, critical hit, magical critical hit, potion swirl, transparent potion swirl, spell, spell, witch spell, note, portal, flying glyph, flame, lava pop, footstep, water splash, smoke particle, huge explosion, large explosion, explosion, void fog, small smoke, cloud, coloured dust, snowball break, water drip, lava drip, snow shovel, slime, heart, angry villager, happy villager, large smoke, item crack, block break, block dust, totem amd spit:
            if "%loop-value%" is "%{_particle}%":
                spawn 1 loop-value at {_l::*} for {_players::*}
                stop
 
The first give me this error:
66d5f90d7e7cdfa6ecc3f65fdf8535e4.png

And the second crash my server :emoji_frowning:
I'm using 1.8.8
I need the "at speed #" in a particle

The reason why I do the function for the particles is so that it does not take 2 minutes to reload the skript, I do not know if there will be any solution apart from doing a function ...
 
You could always use the vanilla minecraft particle command:
/particle <name> <x> <y> <z> <xd> <yd> <zd> <speed> [count] [mode]

So your function would look something like this:

code_language.skript:
function particula(i: integer, p: particle effect, n: number):
    make player execute command "/particle %{_p}% ~ ~ ~ 1 1 1 %{_n}% %{_i}%"
 
You could always use the vanilla minecraft particle command.

So your function would look something like this:

code_language.skript:
function particula(i: integer, p: particle effect, n: number):
    make player execute command "/particle %{_p}% ~ ~ ~ 1 1 1 0 %{_i}% %{_n}%"

The problem with this is that most of the particles have nothing to do with the players :emoji_cry: (I'm doing a little skript of bosses)
 
So like this:
code_language.skript:
execute console command "/particle %{_p}% %{_x}% %{_y}% %{_z}% 1 1 1 %{_n}% %{_i}%"
[doublepost=1497567259,1497567199][/doublepost]It will play in the world named world
 
Lol yeah I guess thats a problem.

You could just choose a random player on the world you want and have them execute the command and they won't know unless they're op.
 
  • Like
Reactions: NewbyZ
First of all, you shouldn't create a function that does only one thing. Now, regarding your issue, what are you using for particles, skRayFall's EffectLib's hook? If so then the type name isn't particle effect, it is EffectLibParticle
 
First of all, you shouldn't create a function that does only one thing. Now, regarding your issue, what are you using for particles, skRayFall's EffectLib's hook? If so then the type name isn't particle effect, it is EffectLibParticle

If you mean this:
code_language.skript:
function particula(i: integer, p: EffectLibParticle, l: location, n: number):
    show {_i} of {_p} particle at location of {_l} at speed {_n}

200444248ff38aeae00fe3c534b8f082.png
 
Status
Not open for further replies.