• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Display Error Message

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,347
I want to display a custom error message when a unit does something. I know I can use this to mimic an error message:

  • Game - Display to (Player group((Owner of (Triggering unit)))) for 5.00 seconds the text: Cannot cast Spell without x Condition
But I remember seeing someone post a custom script which displayed a proper error message, which appears more centered in the screen (like a "Not enough Mana message"). Is this possible?
 
  • Actions
    • Custom script: if udg_sound == null then
    • Custom script: set udg_sound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
    • Custom script: endif
    • Custom script: if GetLocalPlayer() == udg_player then
    • Custom script: call ClearTextMessages()
    • Custom script: call DisplayTimedTextToPlayer( udg_player, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_message+"|r" )
    • Custom script: call StartSound(udg_sound)
    • Custom script: endif
You would need to set up sound, player and message
 
  • Actions
    • Custom script: if udg_sound == null then
    • Custom script: set udg_sound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
    • Custom script: endif
    • Custom script: if GetLocalPlayer() == udg_player then
    • Custom script: call ClearTextMessages()
    • Custom script: call DisplayTimedTextToPlayer( udg_player, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_message+"|r" )
    • Custom script: call StartSound(udg_sound)
    • Custom script: endif
You would need to set up sound, player and message

Why use GetLocalPlayer() when you use DisplayTimedTextToPlayer?

Also, I'm a total n00b in JASS so don't hurt me :D just answer my question :D


EDIT: this can be a lot more GUI friendly
 
Status
Not open for further replies.
Back
Top