SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.06k stars 368 forks source link

Add Sound Type #6990

Open aaaeeeMC opened 3 weeks ago

aaaeeeMC commented 3 weeks ago

Suggestion

Setting a Sound Variable

Example 1: set {_sound1} to sound "entity.zombie.ambient" with volume 0.75 and pitch 1.25 Example 2: set {_sound2} to sound "entity.zombie.ambient" with seed 1 with volume 2 and pitch 0.5 with time position 376 milliseconds

Editing a Sound Variable's Existing Skript Properties

Example 1: set sound pitch of {_sound} to 1.3 Example 2: set sound volume of {_sound} to 0.2 Example 3: set sound seed of {_sound} to 4

Playing a Sound Variable

Example 1: play sound {_sound} Example 2: play sound {@monsterAttackSound} at {_monster}


sovde edit:

THE FOLLOWING SUGGESTIONS ARE NOT POSSIBLE

Any PRs should only target the above suggestions.


Sound Pausing

Example 1: pause sound {_sound} Example 2:

pause sound {_sound}
play sound {_sound}

We can pause a sound, and doing so will have its time position paused too, so that when you play it again it will resume from that time position.

Sound Is Playing Check

Example 1: if {_sound} is playing: Example 2: while {_sound} is playing:

Time Position of Sound

Example 1: set time position of {_sound} to 500 milliseconds Example 2: set time position of sound "entity.enderman.stare" to 2500 ms Time position is measured in milliseconds (or it can be measured in ticks, etc. as well). Both milliseconds and the acronym 'ms' work. It is used to skip to a certain part of a sound, similar to how you can set the song's time position that you're listening to on Spotify. Anything under a millisecond won't work, it'll be similar to trying 0.4 ticks for example, and the time position value must be an integer since putting 500.5 milliseconds will be no difference from 500 or 501 milliseconds.

Reverberation of Sound

Example 1: set sound reverberation of {_sound} to 50% Example 2: set sound reverb of {_sound} to 100% A percentage value between 0 and 100, where 0% is no reverb and 100% is maximum reverb. You already know how reverb works.

Why?

Why set a sound variable?

This is kind of logical, we can store a sound in a variable and be able to play it later in the code by typing just 3-5 short and easy words in a line. This is similar to how you can set {_e} to event-entity in an event, for example. It can be very useful.

Why pause sounds?

With this feature, we can effectively stop a sound and have it resume when we play it again. Additionally, you guys can also update the stop sound effect so that it stops the sound only for the players that it played to, without affecting other players minding their own business hearing the same sound in their own area.

Why check if a sound is playing?

Let's say we set a sound variable so we can manage a sound that a monster we made can produce, and that sound is a custom sound added by a resource pack. We can't use entity emitters, only location emitters. So to solve that problem, we can loop all players and in there call a function that takes the loop-player and constantly sets the volume of the sound based on the proximity of the loop-player to the monster, for example with this formula: volume (distance between {_ent1} and {_ent2}*-1)/maxDistance+maxVolume. Well, in that function we will constantly check if the given sound is playing (which is a sound variable, only the sound variable is affected. other sounds that are the same won't be affected.), so the function will run until the sound finishes playing.

Why change the time position of a sound?

This can be useful from time to time, like when you play music and you want to skip to the best part. Or when you make a quick and dramatic change of scene when you do something and have random things appear and play sounds, we can utilize time positions to get to the point. What is your reason for making use of the time position on Spotify?

What if we can't add time positions because it isn't in the javadocs?

I don't expect everything to be added, but I do know it is possible to make at least those sound variables as they can be very useful. When we make a monster, we can set all sounds beforehand in an options: section and easily play them by typing 3-5 short and easy words. This issue is submitted to give a handful of suggestions for sounds and see what can be added out of them.

Why add the reverb effect to a sound?

In case we want the sound to be heard like from the underground, or just from a distance, we can utilize sound reverb to give it that far away or claustrophobic effect.

What if we can't add the reverb effect because it isn't in the javadocs?

I'm really not sure if it can be added, but it would be a cool bonus. And once again, these are just a bunch of suggestions meant to be selected, with the first ones surely being possible.

Other

Summary

All of these sound features would greatly improve sounds in Skript and be a big part of the 2.10 update! It would not only help me a lot, but other fellow skripters as well! I always had this issue with stopping sounds, and I always wished sound variables, time positions and such would get added.

Agreement

TheLimeGlass commented 3 weeks ago

I have just added sound seeds and sound emitters in Skript 2.9.

6131

aaaeeeMC commented 3 weeks ago

I have just added sound seeds and sound emitters in Skript 2.9.

6131

the suggestions are brand new and unique

sovdeeth commented 2 weeks ago

The only thing here that is physically possible is adding a sound type so it can be stored in variables

aaaeeeMC commented 2 weeks ago

The only thing here that is physically possible is adding a sound type so it can be stored in variables

alright, thanks. those at the top that you say are possible are actually the most important. tysm.

TheLimeGlass commented 2 weeks ago

Skript doesn't register a sound type due to the amount of enums registered in Spigot's Sound and also the need to maintain an aliases for it in the default.lang file.

Sound enum changes frequently.

I was on the classinfo side, then everyone said it being a String is better for performance.