• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 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 ;)
 
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)]
 
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