Warning message (How to display it?)

pablo1517

New Member
Reaction score
1
I'm creating my very first JASS ability right now. Is there any command to display error message like those ones for example, when you try using some attacking ability on your ally then it says *BIP* "You can't cast that on your friends" or something like that. You know, that yellow warning message.

Do you know how to display it in JASS?
 
There's a function in Handyfunctions, I think by Vex, that's called SimError. I'll try finding it for you.

Here it is.
JASS:
library SimError initializer init
//**************************************************************************************************
//*
//*  SimError
//*
//*     Mimic an interface error message
//*       call SimError(ForPlayer, msg)
//*         ForPlayer : The player to show the error
//*         msg       : The error
//*    
//*     To implement this function, copy this trigger and paste it in your map.
//* Unless of course you are actually reading the library from wc3c's scripts section, then just
//* paste the contents into some custom text trigger in your map.
//*
//**************************************************************************************************

//==================================================================================================
    globals
        private sound error
    endglobals
    //====================================================================================================

    function SimError takes player ForPlayer, string msg returns nothing
        set msg="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+msg+"|r"
        if (GetLocalPlayer() == ForPlayer) then
            call ClearTextMessages()
            call DisplayTimedTextToPlayer( ForPlayer, 0.52, 0.96, 2.00, msg )
            call StartSound( error )
        endif
    endfunction

    private function init takes nothing returns nothing
         set error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
         //call StartSound( error ) //apparently the bug in which you play a sound for the first time
                                    //and it doesn't work is not there anymore in patch 1.22
    endfunction

endlibrary
 
Renendaru, thank you very much, only problem is that... i don't know how to put this into my script xP.
I used scope to write my ability, shall i put everything i have in Library or somehow else?

BTW: I need now some command that would return me unit's base damage, hope it is possible.

EDIT:
I think i got it, it's not a private function so it is probably usable in other triggers :D So everything i gotta do is to make soem init trigger just to get this into my map, am i correct?
 
Just put that system into a trigger then run this in any trigger.

JASS:
call SimError( GetOwningPlayer(GetTriggerUnit()), "Your dmg is: " + i)


Where i is the set damage.
 
Yeah but... i asked about any command that would return for me that base damage taking it from unit that i'll show the computer. I mean something like GetUnitBaseDamage for example.
 
You can set a string array for each hero, then call it...
 
That is definatly not a solution :/
Anyway, do any1 of you know how to cancel some issued order? I want to check if a unit is in right position before it makes some ability, but when I register "issued order" and then trry to check conditions and if ther're false i try to issue "stop" then it just doesnt work, ability is not used but my unit gets out of stealth like if it used it and is walking toward the target of that order :/ i want it to cancel all
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top