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?
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
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
 

pablo1517

New Member
Reaction score
1
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?
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
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.
 

pablo1517

New Member
Reaction score
1
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.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
You can set a string array for each hero, then call it...
 

pablo1517

New Member
Reaction score
1
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.

      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