Full Version : How do I - Play music and sounds?
xmlspawner >>XMLSpawner - How do I? >>How do I - Play music and sounds?


<< Prev | Next >>

ArteGordon- 01-01-2006
Playing sounds

The

SOUND,value keyword

will play a sound to nearby players. If this keyword is used as part of an item/mob spawn spec then the sound is played at the location of the item or mob.
For example to spawn a grunting orc that also says something, use the spawn entry

orc/MSG/Die human!/SOUND,1068

the SOUND keyword can also be spawned alone to simply provide sound effects.

For example, to continuous play a set of sounds when a player comes within range you could use a spawner entry like this

SOUND,26

with a small Min/MaxDelay and ProximityRange set to some value >= 0.

or change the spawn entry to something like this instead

SOUND,{RNDLIST,15,16,17,18,19,25,26,27,28,29,30,31,32,33}

to play a random sound selected from the list.


Playing music

The

MUSIC,musicname[,range]

keyword lets you play music when it is spawned. It will override any ongoing ambient regional music that might be playing but will only briefly interrupt, not replace, the combat music if a player is in combat mode (that already overrides regional music).
You can also specify music numbers directly in place of the musicname argument. So for example MUSIC,9 can be used instead of MUSIC,Britain1. This also allows access to the new ML music values from 51-66 that are not yet defined in the MusicName enum.

This can be used to add additional ambience to triggered events, such as playing

MUSIC,Victory

upon completion of a quest, or

MUSIC,Death

on triggering a nasty spawn. This can spawned on its own e.g. "MUSIC,Britain1" or added as part of a spawn spec e.g.

orc/MUSIC,Death

so that individual spawns could have their own music associated with them. See the MusicName enum in the docs for list of available musicnames.
There are some pieces of music (I think the non-repeating pieces like Death and Victory) that dont seem to be able to be played directly one after the other without playing a continous piece (such as the regional pieces Britain1, Britain2, or other background pieces such as Combat1, Tavern01, etc.)

When the optional range argument is given, then the music will be sent to all players within the specified range when it is triggered. Otherwise, by default,only the triggering player receives the music.

The MusicName enums from the docs\types\MusicName.html are listed below. Note, these are the enum values as defined in the core.

QUOTE

MusicName (Enum)
OldUlt01 = 0,
Create1 = 1,
DragFlit = 2,
OldUlt02 = 3,
OldUlt03 = 4,
OldUlt04 = 5,
OldUlt05 = 6,
OldUlt06 = 7,
Stones2 = 8,
Britain1 = 9,
Britain2 = 10,
Bucsden = 11,
Jhelom = 12,
LBCastle = 13,
Linelle = 14,
Magincia = 15,
Minoc = 16,
Ocllo = 17,
Samlethe = 18,
Serpents = 19,
Skarabra = 20,
Trinsic = 21,
Vesper = 22,
Wind = 23,
Yew = 24,
Cave01 = 25,
Dungeon9 = 26,
Forest_a = 27,
InTown01 = 28,
Jungle_a = 29,
Mountn_a = 30,
Plains_a = 31,
Sailing = 32,
Swamp_a = 33,
Tavern01 = 34,
Tavern02 = 35,
Tavern03 = 36,
Tavern04 = 37,
Combat1 = 38,
Combat2 = 39,
Combat3 = 40,
Approach = 41,
Death = 42,
Victory = 43,
BTCastle = 44,
Nujelm = 45,
Dungeon2 = 46,
Cove = 47,
Moonglow = 48,
Zento = 49,
TokunoDungeon = 50,
Invalid = -1


Defining custom music

The MusicName enums are basically indices into the clients music configuration file in Music/Digital/config.txt
That is where the music number (the value of the MusicName enum) is mapped into the corresponding mp3 file.

So when you refer to the Britain1 MusicName with,

MUSIC,Britain1

it will map to entry 9 in the config.txt file (which points to the britainpos file by default).

To add your own custom music, add your own mp3 files and modify config.txt to map one of the music numbers to it, or just replace one of the existing mp3 files with your custom mp3.

Be sure to make a backup of config.txt and existing mp3s if you fiddle with it, otherwise you may have difficulty patching later on.

Mage-Solitaire- 01-03-2006
Jouer un son

Le

SOUND,value keyword

jouera un bruit à les joueurs d'a coté.
Si ce mot-clé est employé en tant que valeur dans la spawn d'un item/mob alors le bruit est joué à l'endroit meme ou se trouve le mob/item. Par exemple pour spawner un orc qui grogne et qui dit quelque chose, esssayez:

orc/MSG/Die human!/SOUND, 1068

Le mot clef SOUND peut également être spawné seul pour fournir simplement des effets sonores.
Par exemple, pour jouer en continu un son quand un joueur entre dans la zone de detection du spawnner, vous pouvez utiliser:

SOUND,26

avec un petit Min/MaxDelay et un ProximityRange réglé à une valeur > = 0.
ou changez l'entrée du spawn pour quelque chose comme ça

SOUND, {rndlist, 15, 16, 17, 18, 19, 25, 26, 27, 28, 29, 30, 31, 32, 33 }

pour jouer un bruit aléatoire a choisir parmi la liste.


Jouer de la musique

Le mot-clef

MUSIC,musicname[,range]

vous permettra de jouer de la musique lorsqu'il est spawné. Il remplacera n'importe quelle musique régionale ambiante continue qui pourrait déjà être jouée mais interrompra seulement brièvement la musique de combat si un joueur est en mode de combat (qui dépasse déjà la musique régionale). Vous pouvez également indiquer le numéro de la musique directement au lieu de l'argument musicname. Donc, par exemple, la MUSIC,9 peut être employée au lieu de la MUSIC, Britain1. Ceci permet également l'accès aux nouvelles valeurs de musique de ML de 51-66 qui ne sont pas encore définies dans l'enum de MusicName.

Ceci peut être employé pour ajouter l'ambience additionnel aux événements déclenchés tels que jouer:

MUSIC,Victory

la victoire sur l'accomplissement d'une quete ou d'une mission

MUSIC,Death

sur le déclenchement un gros mechant.

orc/MUSIC,death

permet a des spawns individuels d'avoir leur propre musique liée à eux. Jettez un oeil à l'enum de MusicName dans les Docs pour la liste de musicnames disponibles.

Il y a quelques morceaux de musique (je pense les morceaux non-repeating comme la mort et la victoire) qui ne semblent pas pouvoir être joué directement une après l'autre sans jouer un morceau continous (tel que les morceaux régionaux Britain1, Britain2, ou d'autres morceaux de fond tels que Combat1, Tavern01, etc...)

Quand l'option "range" est activée, alors la musique sera envoyée à tous les joueurs dans la zone indiquée quand elle est déclenchée. Autrement, par défaut, seulement le joueur de déclenchement reçoit la musique.

Les enums de MusicName du docs\types\MusicName.html sont énumérés ci-dessous.

QUOTE

MusicName (Enum)
OldUlt01 = 0,
Create1 = 1,
DragFlit = 2,
OldUlt02 = 3,
OldUlt03 = 4,
OldUlt04 = 5,
OldUlt05 = 6,
OldUlt06 = 7,
Stones2 = 8,
Britain1 = 9,
Britain2 = 10,
Bucsden = 11,
Jhelom = 12,
LBCastle = 13,
Linelle = 14,
Magincia = 15,
Minoc = 16,
Ocllo = 17,
Samlethe = 18,
Serpents = 19,
Skarabra = 20,
Trinsic = 21,
Vesper = 22,
Wind = 23,
Yew = 24,
Cave01 = 25,
Dungeon9 = 26,
Forest_a = 27,
InTown01 = 28,
Jungle_a = 29,
Mountn_a = 30,
Plains_a = 31,
Sailing = 32,
Swamp_a = 33,
Tavern01 = 34,
Tavern02 = 35,
Tavern03 = 36,
Tavern04 = 37,
Combat1 = 38,
Combat2 = 39,
Combat3 = 40,
Approach = 41,
Death = 42,
Victory = 43,
BTCastle = 44,
Nujelm = 45,
Dungeon2 = 46,
Cove = 47,
Moonglow = 48,
Zento = 49,
TokunoDungeon = 50,
Invalid = -1


Définir ses propres musiques

Les enums de MusicName sont tout simplement indexés dans le dossier de configuration des musiques du client:s Music/Digital/config.txt
C'est là que le numéro de la musique (la valeur de l'enum de MusicName) est associé dans le dossier mp3 correspondant.

Ainsi quand vous vous référez au Britain1 MusicName avec:

MUSIC,Britain1

l se referera à l'entrée 9 dans le dossier de config.txt (qui cible le fichier britainpos par défaut).

Pour utiliser votre propre musique, ajoutez vos propres fichiers mp3 et modifiez config.txt pour associer un des nombres de musique à la votre, ou remplacez juste un des mp3 existant par le votre.

N'oubliez pas de faire une save de votre config.txt et des mp3s existant si vous les modifiez, autrement vous pourriez avoir du mal lors des prochains patchs.

Hanse46- 03-29-2008
Can you please give a example how the sound is written for that min.max delay and prox. I understand how to make sound but I am unsure how thwe rest is written.

Divinus- 10-29-2008
I am trying to make a music box using the XMLEDIT on an item. I have the music playing just fine however I can't find a way to stop it. Anyone have any ideas?
Ideally I would like to stop it by command however a timer would be nice too.