HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Playing interface announcements (e.g. "Inventory is full")

12-06-2008, 12:27 PM#1
marshall
I have a spell that creates an item in the unit's inventory.
If the inventory is already full, I presently just display some text saying "inventory is full".
What I would like to do is have the normal announcement message and sound play, as if the user had right-clicked on an item on the ground.

I tried issuing a smart order to the unit to pick up a dummy item - this doesn't achieve anything.

I searched for the various interface sounds in the Sound manager so that I could try and do it all manually but these sounds do not appear to be listed.

Any ideas how this can be achieved?
12-06-2008, 12:32 PM#2
abriko
The sound is listed :
Human sound : Sounds\Interface\Warning\Human\KnightInventoryFull1.wav
... the others are just below.
12-06-2008, 12:55 PM#3
Vexorian
http://www.wc3campaigns.net/showthread.php?t=101260
12-06-2008, 01:53 PM#4
marshall
Thanks guys. The text shows up great. The only trouble I'm having now is that I can't get the sound to play:

Collapse JASS:
function SimError takes player ForPlayer, string msg, sound error returns nothing
    set msg="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+msg+"|r"
    if (udg_GameLocalPlayer == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer(ForPlayer, 0.51, 0.96, 2.00, msg)
        call StartSound(error)
    endif
    set ForPlayer = null
endfunction

function Trig_InitSounds_Actions takes nothing returns nothing
    call DestroyTrigger(GetTriggeringTrigger())
    set udg_SoundInventoryFull[udg__TEAM_GOOD] = CreateSound("Sound\\Interface\\Warning\\NightElf\\SentinelInventoryFull1.wav",false,false,false,10,10, null)
endfunction

call SimError(GetOwningPlayer(uCaster), "Inventory is full.", udg_SoundInventoryFull[udg__TEAM_GOOD])

Any thoughts on what I've got wrong?
12-06-2008, 05:31 PM#5
Vexorian
wow why did you change SimError like that? It was already working fine without the extra complication.
12-06-2008, 07:05 PM#6
marshall
Not sure I understand. The globals/library stuff is something to do with JassHelper I believe, which I haven't even started looking at yet. I wanted something simple and the ability to choose a different sound depending on what called SimError. The only other changes were to do with leaks (at least, my understanding is that simply comparing GetLocalPlayer() to a player var would leak - perhaps I'm wrong about that).

It works fine if I use CreateSoundFromLabel("InterfaceError"...) but not if I use CreateSound("[path]"...)
That suggests that there's something wrong with my use of CreateSound but I can't figure out what it is.
12-06-2008, 10:15 PM#7
Pyrogasm
Just use SimError and don't modify it. The sound it uses should be fine, unless there's something radically different about the full inventory sound...?

And player variables don't leak because they're global objects.
12-07-2008, 01:03 PM#8
marshall
I want to hear "Inventory is full", not an error bleep. The original SimError doesn't allow you to choose a different sound.

I need to know why my use of CreateSound is not working.

I know that player objects don't leak, but surely the variables themselves do?
12-07-2008, 11:45 PM#9
cleeezzz
udg_SoundInventoryFull[udg__TEAM_GOOD]

what did you set that to
12-08-2008, 05:02 PM#10
marshall
Quote:
Originally Posted by marshall
Collapse JASS:
set udg_SoundInventoryFull[udg__TEAM_GOOD] = CreateSound("Sound\\Interface\\Warning\\NightElf\\SentinelInventoryFull1.wav",false,false,false,10,10, null)
and udg__TEAM_GOOD is 1.

I've searched around for values for the final parameter 'eaxSetting' but nothing I try works. No idea if that is the problem or not?
12-13-2008, 08:17 PM#11
marshall
So nobody knows how to use CreateSound() ?
12-14-2008, 04:00 AM#12
Pyrogasm
I've only ever copied the CreateSoundFromLabel() lines that you can find if you save your map with some sound used, then open it with an MPQ editor and extract war3map.j
12-14-2008, 04:06 AM#13
Ammorth
set SoundHandleVariable = CreateSound(YourPath, false, false, true, 200, 200, "")
These are the arguments used for interface sounds (taken from blizzard.j)
12-14-2008, 10:46 PM#14
marshall
Thanks guys, I'm doing it Pyrogasm's way and can now see why my earlier attempt wasn't working.