Full Version : XmlMusic Attachment
xmlspawner >>XMLSpawner Attachments >>XmlMusic Attachment


<< Prev | Next >>

Lord Hog Fred- 08-06-2006
WOuld it be possible to add an XMLMusic attachment that would act like the XMLSound attachment so when an object was used it would play music?

ArteGordon- 08-06-2006
yeah, that's a good idea.

ArteGordon- 08-10-2006
Here it is. XmlMusic. You can specify a music number (see config.txt in the client Music/Digital folder for the mapping), or a music name (see the MusicName enum)
as well as a refractory period and a triggering and playback range.

Movement within the specified TriggerRange (default = 5 tiles) will cause music to be played to everyone within the PlaybackRange (default = 0).
The default playbackrange of zero means that only the triggering player will hear it.
Once triggered, the attachment cannot be triggered again until the Refractory interval (default = 30 sec) has expired.
If the player currently has any music playing, that music will be stopped and the XmlMusic will be started.
You will be able to replace any ongoing background music (like the default region music) but may find that certain music (like the music played while in combat) will tend to override music you try to play to them, the same way that it overrides background region music.

You must have player accesslevel to trigger it.

Specifying a refractory interval of zero will cause the attachment to delete itself after a single use.

XmlMusic[,musicname][,refractory interval in seconds]

For example to manually add the attachment to something

[addatt xmlmusic Tavern01

or

[addatt xmlmusic 11

To spawn something with the attachment

orc/ATTACH/<xmlmusic,Approach,60/triggerrange/10/playbackrange/10>

QUOTE

public enum MusicName
{
  Invalid = -1,
  OldUlt01 = 0,
  Create1,
  DragFlit,
  OldUlt02,
  OldUlt03,
  OldUlt04,
  OldUlt05,
  OldUlt06,
  Stones2,
  Britain1,
  Britain2,
  Bucsden,
  Jhelom,
  LBCastle,
  Linelle,
  Magincia,
  Minoc,
  Ocllo,
  Samlethe,
  Serpents,
  Skarabra,
  Trinsic,
  Vesper,
  Wind,
  Yew,
  Cave01,
  Dungeon9,
  Forest_a,
  InTown01,
  Jungle_a,
  Mountn_a,
  Plains_a,
  Sailing,
  Swamp_a,
  Tavern01,
  Tavern02,
  Tavern03,
  Tavern04,
  Combat1,
  Combat2,
  Combat3,
  Approach,
  Death,
  Victory,
  BTCastle,
  Nujelm,
  Dungeon2,
  Cove,
  Moonglow,
  Zento,
  TokunoDungeon,
  Taiko
}

Lord Hog Fred- 08-13-2006
Is there a way to script an item so that when it is double clicked it plays the msuic attached to it with the XmlMusic attachment?

ArteGordon- 08-13-2006
you can have it call the OnTrigger method of the attachment in your OnDoubleClick method

CODE

XmlMusic a = (XmlMusic)XmlAttach.FindAttachment(this, typeof(XmlMusic));

if(a != null)
{
 a.OnTrigger(this, from);
}