• 🏆 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!

InGame Error - Action

Status
Not open for further replies.
Level 4
Joined
Dec 15, 2007
Messages
96
Hey,
Is it possible to trigger an "Interface error messege" (from Game Interface) using a Jass line?

I've noticed an error messege in the Game Interface which is not in use, so I just wondered if there were any ways to sort of "call" it, or make it appear by using a Custom Script action, or any other methods? If there is, please feel free to explain here. Thank you:con:
 
Level 2
Joined
Feb 24, 2007
Messages
37
There is a function for it yes.

SimError(no leak) by Vexorian on JassVault said:
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

Copy and paste that part into your mapheader (the mapicon at the top in the trigger editor) and make a global sound variable named SimError. Now you can use it in a trigger for example:

  • Unit Dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Player = (Owner of (Triggering unit))
      • Custom script: call SimError(udg_Player, "Grats your unit died")
Or as one Jass line

JASS:
call SimError(GetOwningPlayer(GetTriggerUnit()), "Grats your unit died")
 
Status
Not open for further replies.
Top