• 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.

[Solved] Make an error message beep

Status
Not open for further replies.
Level 11
Joined
Dec 8, 2006
Messages
334
[<- nope, just chuck testa] Make an error message beep

Hi!
Is there a manual way for making an error message beep? I mean those in-game errors that are displayed in yellow font at the bottom of the game-screen... You know, those: "more gold is required", "must target a ground unit" or "only units with inventory can pick up items"
It mostly doesn't matter which message it is, I will change its text through Game Interface. I just need to make it beep throught triggers somehow.

Anyone?
 
Last edited:
SimError.
JASS:
library SimError initializer init
//**************************************************************************************************
//*
//*  SimError
//*
//*     Mimic an interface error message
//*       call SimError(ForPlayer, msg)
//*         ForPlayer : The player to show the error
//*         msg       : The error
//*    
//*     To implement this function, copy this trigger and paste it in your map.
//* Unless of course you are actually reading the library from wc3c's scripts section, then just
//* paste the contents into some custom text trigger in your map.
//*
//**************************************************************************************************

//==================================================================================================
    globals
        private sound error
    endglobals
    //====================================================================================================

    function SimError takes player ForPlayer, string msg 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 (GetLocalPlayer() == ForPlayer) then
            call ClearTextMessages()
            call DisplayTimedTextToPlayer( ForPlayer, 0.52, 0.96, 2.00, msg )
            call StartSound( error )
        endif
    endfunction

    private function init takes nothing returns nothing
         set error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
         //call StartSound( error ) //apparently the bug in which you play a sound for the first time
                                    //and it doesn't work is not there anymore in patch 1.22
    endfunction

endlibrary
Now you can call those messages via:
  • Set someplayer = Player(1) Red
  • Set stringMessage = "shit"
  • Custom script: call SimError(udg_someplayer, udg_stringMessage)

If you don't own NewGen (in case this is vJass script), then use GUI-friendly version below (just copy + paste that into map's header - header is small map icon in your trigger editor)
JASS:
function SimError takes player ForPlayer, string msg 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 (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( ForPlayer, 0.52, 0.96, 2.00, msg )
        call StartSound(udg_Error)
    endif
endfunction

function InitTrig_SimError takes nothing returns nothing
    set udg_Error=CreateSoundFromLabel("InterfaceError", false, false, false, 10, 10)
    //call StartSound(udg_Error)
endfunction
 
Unfortunately war3 doesn't allow us to manipulate the true default "Warnings" (apart from configuring few of those which are listed in Game Interface). You can only simulate errors, thats why it's called SimError. Hope it's enough ;/

For most it is - sometimes you can not have all what you wanted; but you should be happy having at least a part of that (=
 
Wait a minute! I just found out: when I use this, these new error messages won't overwrite the normal Warcraft's error messages, but are displayed over them instead, making them both unreadable.
This won't do, can't it be fixed somehow?

If you need to, you can always remove 1-3 of the "\n" parts within this line:
set msg="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+msg+"|r"

That way, it will be kind of in the same vicinity, but it won't overlap the actual wc3 errors. Yes, it will show that yours is different from the wc3 errors, but that is the only solution aside from ignoring it. :p
 
Level 11
Joined
Dec 8, 2006
Messages
334
Well, what I'm making is kind of a Tower Defense game, so most messages the player get is "Buliding Complete: That and that tower"
If I could somehow remove these, I would be ok with ignoring the rest of them. But I couldn't find it in Gameplay Interface

Alternatively, if I could somehow make beep ANY of the basic error messages, it would be even more win, since I could just rewrite that one...
Can this thread be marked as unsolved again? :D
 
Status
Not open for further replies.
Top