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!
Hey Poke! Thanks for the response, I am curious about one part. Is there a way to make the event: Unit enters any region? I only know how to reference if it entered a specific one.
You will add each one to your trigger likely from the config trigger.
set regionCount = regionCount + 1
set Regions[regionCount] = myRegion (The index is still 1, provided regionCount is 0)
set regionCount = regionCount + 1 (The index is still 2)
set Regions[regionCount] = myRegion2
You would do the same for sounds, making sure the indexes line up properly.
After that you will have a loop:
For Each tempInt from 1 to regionCount
Add the Event to your trigger:
Unit Enters Regions[tempInt]
However, you could also just have a stack of them in the event section, although more than a few might be tedious.
In the other trigger (unit enters) your events will be blank as we added them in the config trigger.
In the actions sections you will loop similar to above, through your catalog/list of regions to determine which one fired.
As before, once we know which one fired, we check the index to get the sound desired.
again in pseudo code it would be
For Each tempInt from 1 to regionCount
if Unit entered Regions[tempInt] then
PlaySound[tempInt]
Do anything else you want here.
Then Skip remaining actions because we already found the region
else
--blank-- continue searching.
Forgive the formatting, on my phone.
Also, if I am remembering right, regions are forced to conform to some specific size interval, so this method is likely not ideal should you need hyper precision.
If you need that precision, you would need to use Rects, which are not available in GUI. Then track the potential units coordinates and compare them to the min/Max of the rects to determine when they entered.
Mainly that thing I had mentioned earlier about the size of regions being off in game was half right. So it turns out, they don't need to be a specific size interval, but rather they are slightly shifted from where they are preplaced.
From what I understand, the event would fire, but when it did the check to see if the unit was contained in the region it could fail because the coordinates of the unit would be falling outside of the shifted region. This lead to region contains unit failing.
So, if we shift the regions back, we should have no problem.
I did some testing and could not get it to fail now, but double check.
I also moved the regions around because when I first tested it I was thinking they were overlapping somehow, but that was a by product of unknown shift.
I suspect you'll also need to look up a tutorial on GetLocalPlayer() so you can play these sounds to a specific player rather than everyone.
Melee Initialization
Events
Map initialization
Conditions
Actions
Set PlayersCurrentSong[1] = 0
Set PlayersCurrentSong[2] = -1
Set Hero = Knight 0000 <gen>
Set GenLoopCount = 1
Set RegionNum[GenLoopCount] = 1 <gen>
Set SongNum[GenLoopCount] = Doom <gen>
Set GenLoopCount = (GenLoopCount + 1)
Set RegionNum[GenLoopCount] = 2 <gen>
Set SongNum[GenLoopCount] = PursuitTheme <gen>
Set GenLoopCount = (GenLoopCount + 1)
Set RegionNum[GenLoopCount] = 3 <gen>
Set SongNum[GenLoopCount] = SadMystery <gen>
Set GenLoopCount = (GenLoopCount + 1)
Set RegionNum[GenLoopCount] = 4 <gen>
Set SongNum[GenLoopCount] = Tension <gen>
Set GenLoopCount = (GenLoopCount + 1)
Set RegionNum[GenLoopCount] = 5 <gen>
Set SongNum[GenLoopCount] = TragicConfrontation <gen>
For each (Integer TempInt) from 1 to GenLoopCount, do (Actions)
Loop - Actions
Trigger - Add to Region Ent Trigger <gen> the event (Unit - A unit enters RegionNum[TempInt])
Custom script: call SetRect(udg_RegionNum[udg_TempInt], GetRectMinX(udg_RegionNum[udg_TempInt]) - 32., GetRectMinY(udg_RegionNum[udg_TempInt]) - 32., GetRectMaxX(udg_RegionNum[udg_TempInt]) + 32., GetRectMaxY(udg_RegionNum[udg_TempInt]) + 32.) (This is the preplaced region correction)
Region Ent Trigger
Events
Conditions
Actions
For each (Integer TempInt) from 1 to GenLoopCount, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(RegionNum[TempInt] contains Hero) Equal to True
Then - Actions
Game - Display to (All players) the text: (String(TempInt))
Sound - Stop SongNum[PlayersCurrentSong[(Player number of (Triggering player))]] Immediately
Sound - Play SongNum[TempInt]
Set PlayersCurrentSong[(Player number of (Triggering player))] = TempInt
Wow you are diligent, I never would have guessed that regions had that issue and I'll have to see what to do about that. I likewise didn't experience any failure in your version, and I do know about localplayer but thanks for bringing it up in case I didn't! Thanks again Poke!
In one of my versions the check was being manifest on a low occurrence periodic trigger, such a check would lower the responsiveness of the soundtrack swap, but altogether function decently since in this map it will only be checking 4 units max.
I just noticed your trigger for the region position recalibration, I missed it the first time. Guess I don't really have to figure out how to fix it since you did
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.