-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Lua Script API: Sound and Music Functions
ShadowMario edited this page Dec 8, 2022
·
2 revisions
-
sound
- File name (Should be located inmods/music/
orassets/music/
) -
volume
- Optional value, volume percent goes from0
to1
. Default value:1
-
loop
- Optional value, if the music should loop indefinitely. Default value:false
-
sound
- File name (Should be located inmods/sounds/
orassets/sounds/
) -
volume
- Optional value, volume percent goes from0
to1
. Default value:1
- OPTIONAL:
tag
- Should only be used if you want to pause, resume, change the time, volume or fade in/out your sound, if you don't want to use it, don't include a third value.
This function will stop the sound AND remove it permanently!
-
tag
- Sound tag
-
tag
- Sound tag
-
tag
- Sound tag
Example: Using playSound('confirmMenu', 0.5)
will play the menu "Accept" sound with 50% volume
-
tag
- Sound tag, leave this field empty if you want to do a fade in on the Background music instead -
duration
- The time it takes for the volume to go fromfromValue
totoValue
-
fromValue
- Starting value. Default value is0
-
toValue
- End value. Default value is1
-
tag
- Sound tag, leave this field empty if you want to do a fade out on the Background music instead -
duration
- The time it takes for the volume to go from the starting volume totoValue
-
toValue
- End value. Default value is0
-
tag
- Sound tag, leave this field empty if you want cancel the Background music's fade in/out instead
-
tag
- Sound tag, leave this field empty if you want get the Background music's volume instead
-
tag
- Sound tag, leave this field empty if you want change the Background music's volume instead -
value
- Goes from 0 to 1.
Gets the current sound's position in miliseconds
-
tag
- Sound tag
Sets the current sound's position in miliseconds
-
tag
- Sound tag -
value
- New position
Note: Value 5000 = 5 seconds