• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Music for a specific area

Status
Not open for further replies.

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
How to make a music play on a specific area ?

Example: the music PH1 (Sound Editor > Sound > Music > Mp3) playing on 2000 radius of center of map. (Note: I want make the music play ONLY in that area, that means it is not for all the game, only for units/heroes within that radius, so when they leave that area the music goes off)

Should I use Regions or something else... ? :grin: Regards
 
Alternatively, create a region, and then implement triggers along these lines:
  • Special Music
    • Events
      • Unit - A unit enters (Region 000 <gen>)
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
      • Sound - Stop music theme immediately
      • Sound - Play <Special Music>
      • Custom script: endif
  • Special Music 2
    • Events
      • Unit - A unit leaves (Region 000 <gen>)
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
      • Sound - Stop music theme immediately
      • Sound - Play <Regular Game Music>
      • Custom script: endif
Although, you should add conditions to ensure that it is only for the proper heroes. Otherwise you'll have all sorts of complications as units are passing in and out of the region. I assume this is for an RPG, so you should just check to make sure it is one of the main heroes.

The first trigger fires when a unit enters your specified region. Then it will stop the music only for that player and play the special music only for that player. The second trigger does the opposite. It fires when a unit leaves, and it will stop the music and play the regular game music for that player.

If you want it to do it by camera instead, the implementation is slightly different and involves a periodic trigger. I think it is better to do it when units enter/leave the region though.

P.S. This code was just written off the top of my head, so I apologize if it isn't completely 1-1 with the GUI actions. If you need clarification, feel free to ask.
 
Status
Not open for further replies.
Top