• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Display Error Message

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
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?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
  • 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
 
Level 17
Joined
Dec 11, 2014
Messages
2,004
  • 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.
Top