• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

Buying Music Functions

Status
Not open for further replies.
Level 3
Joined
Aug 10, 2011
Messages
41
Hey there !

playing a music theme aint a prob. the thing i want to do is the following:

When a hero buys from a certain shop. then it plays a song. the thing is i need it to randomly pick a song from a selection of 3-5 song. so that it aint the same song everytime. the songs are 5 imported songs of my own. i simply just need a trigger that makes a kinda "random" pick of 4 things.


Im sure this a easy trigger :b so help me out and get some rep in return ;)
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
  • Map init
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set sound[1] = //custom path here
      • Set sound[2] = //custom path here
      • Set sound[3] = //custom path here
      • Set sound[4] = //custom path here
      • Set sound[5] = //custom path here
Now, when unit buys item:
  • sound
    • Events
      • Unit - A unit Sells item (from shop)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to //enter shop type here
    • Actions
      • Sound - Play sound[(Random integer number from 1 to 5)]
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Oh Holmenlund.. You should have said that you have problems with variables too. >.<
Yes 'sound' is sound array variable. Enter variable editor and in Name field enter 'sound', from type filter choose: Sound. Follow this with ticking the 'Array' box just below type field. "Custom path here" means that after choosing action: Set Variable and selecting the sound one you have to Select option 'Variable' and choose the imported sound. Done, enjoy.
 
Level 3
Joined
Aug 10, 2011
Messages
41
It sounds like ur in a different section/spot than i am ?
let me illustrate it hah :D :

scaled.php


First i import a sound/song then its variable name become the name of the file "almost"

scaled.php


then i make the trigger(set) where i enter a new variable which name was: sound[1] = "then you say i shall insert the custom path here" well i don´t see how to do it ?

scaled.php


You say that after i checked the Array then the custom path should be right under ? where ? XD haha :D

now i can´t explain it better, so what i am doing wrong? :p
 
Level 3
Joined
Aug 10, 2011
Messages
41
nice thanks m8 :D ! it was actually quite easy lol :D

just got one prob, the "main background music" still runs throughout the game, and it kinda destroy the music :p ? any ideá on how to dissable these ?
 
Status
Not open for further replies.
Top