Error Messages: Can They Be Made

Ashlebede

New Member
Reaction score
43
Trigger the "can't cast spell" by ordering (Triggering unit) to "stop".

Use SimError to display the message. Source (copy in map custom script header) :

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"+msg+"|r" )
        call StartSound( udg_SimError )
    endif
endfunction


You need a sound-type variable declared using CTRL+B and name it SimError. Then, to display the error message, do :

Trigger:
  • //...
    • Set MyPlayerVariable = (Owner of (Triggering unit))
    • call SimError(udg_MyPlayerVariable,"You cannot cast that on mechanical units !")
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top