Custom Warnings?

kungfuturte0

New Member
Reaction score
2
Hi. Im sure theres a way to create custom warnings, ive seen it in DOTA. What i mean by custom warnings is for example:

You build a unit, but you have insufficent funds. A warning appears displaying Insufficent funds. I know i could just display a normal game message but this doesnt look quite as good. Its in the left corner, not in the middle like warnings.

Has anyone play DOTA (who hasnt?) and you try and buy the Roshan shield. A warning comes up saying : You must kill Roshan in order to get this item.

This is what i want. If you still dont understand ill get a print screen of what i want. Thanks for any help. Rep + to correct answer.
 

hell_knight

Playing WoW
Reaction score
126
There is a JASS function which allows you to display the game message whereever you want.

They could of just used a hex code , and played the error sound and positioned it where it would look like it was an error.
 

SFilip

Gone but not forgotten
Reaction score
634

kungfuturte0

New Member
Reaction score
2
Code:
//Needs a udg_SimError global sound variable
function SimError takes player ForPlayer, string msg returns nothing
    if udg_SimError==null then
        set udg_SimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
    endif
    if (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+msg+"|r" )
        call StartSound( udg_SimError )
    endif
endfunction

Ok im not sure what to do with this :( Do i put in action - custom script. And what do i change to put my custom message etc? Thanks
 

hell_knight

Playing WoW
Reaction score
126
Uh its JASS , well you need to set a variabled called SimError to the sound you want played.

and where it says msg you put the string there.
 

Insane!

Shh I didn't edit this, go away.
Reaction score
122
Code:
//Needs a udg_SimError global sound variable
function SimError takes player ForPlayer, string msg returns nothing
    if udg_SimError==null then
        set udg_SimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
    endif
    if (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+[B]msg[/B]+"|r" )
        call StartSound( udg_SimError )
    endif
endfunction

Ok im not sure what to do with this :( Do i put in action - custom script. And what do i change to put my custom message etc? Thanks

that stuff in bold should be it
 

kungfuturte0

New Member
Reaction score
2
Uh its JASS , well you need to set a variabled called SimError to the sound you want played.

and where it says msg you put the string there.

Ok so i create a new variable and call it SimError. Then i choose variable type sound or sound type?? then after that what i need to do trigger wise?

Do i need to
Code:
set variable SimError = Sound i want played?

Then what i need next??? where do i type that JASS code?

thanks
 

kungfuturte0

New Member
Reaction score
2
JASS:
//Needs a udg_SimError global sound variable
function SimError takes player ForPlayer, string msg returns nothing
    if udg_SimError==null then
        set udg_SimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
    endif
    if (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
        call DisplayTimedTextToPlayer( ForPlayer, 0.52, -1.00, 2.00, "|cffffcc00"+No Item To Identify!+"|r" )
        call StartSound( udg_SimError )
    endif
endfunction


Ok where do i put this???

Action - game - display message???

and what do i need to do about sound??? I have created a variable but its not working?? Please help!
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
There's another option. Every warning is in the game options tab, I believe I don't have the editor open now. The one in advanced options where you can replace the background. You can change the interface artwork as well as changing the pre-scripted messages. Note that the game will still fire off the new message when someone would have triggered the old one. You'll have to play with that to get it to fire at the right time.
 

SFilip

Gone but not forgotten
Reaction score
634
OK, here's what you need to do:
-Open the variable editor (Ctrl+B) and create a variable called SimError of type Sound. You don't need to do anything with this variable, just make sure it's created.
-Copy the original code (don't change anything, not even msg as previously suggested) and paste it into the map header. To do this, open the trigger editor and click on the map's name on top of the tree where all triggers are. Then just paste it into the text box on the bottom.
-You use the function this way: call SimError(<player here>, <message here>) in a custom script action. For example:
Code:
test trigger
    Events
        Unit - A unit Dies
    Conditions
    Actions
        Custom script:   call SimError(Player(0), "test")
Player(0) is player 1, Player(1) would be player 2 etc.
GetTriggerPlayer() is triggering player.
GetEnumPlayer() is Picked Player.
GetOwningPlayer(GetTriggerUnit()) is owner of triggering unit.
If you need anything else you need used as a player here, just ask.
 

NotTheHelper

Yeah, its under your bed.
Reaction score
23
Would custom warnings be ike if you try to cast a spell on a unit and instead of saying its magic immune itd say like "Stupid...hes spell immune"
 

SFilip

Gone but not forgotten
Reaction score
634
No, you can change existing messages' text using Advanced - Game Interface.
 

SFilip

Gone but not forgotten
Reaction score
634
For displaying those whenever you wish using a trigger. Just a somewhat fancy way of displaying an error, I guess it's good for custom spells.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top