Fake Error Message

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
"You have no kills"

Does anybody know how to make the above message seem like an error message, like "Already at full health" ?

I'm trying to make a spell where the Hero eats one of his previous kills, but he can't cast the spell if he hasn't killed anything yet. How do I make it look like an error message?
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
It's kind of like an in-built message. Which can be edited in the game interface. I don't think there's any way to create this other than floating text, so if you don't want that, you have to check for an error. An error that you can actually replay so the error message pop out. After that you change that message to whatever you want. Example is,

You create an ability that targets trees.

So the hero has no kills, and he is trying to use the skill that requires kills, you order the unit to cast the ability on the ground.

Now the message "Must target a tree" will come out. Change that message in game interface, and voila. But I'm not sure if the ordering of unit to target the ground will even trigger. So you gotta find, and try, maybe it'll work.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Oh, okay. Thanks for the suggestion! I managed to find one almost immediately.
 

TomTTT

New Member
Reaction score
44
Yeah, you may find all icon paths, text stuff like messages, descriptions and titles built in-game in the Advanced > Gameplay Interface I think thats how it's called. Anyways it's under the Advanced > Gameplay Constants.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
But I'm not sure if the ordering of unit to target the ground will even trigger. So you gotta find, and try, maybe it'll work.

Nope, doesn't work. I think it has to be ordered by the player for it to work. Oh well, looks like I'll have to think up another ability for the Hunter. Any suggestions?
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Well, it might not work that way.. But, you can use floating texts. Attach it the unit that is casting it, so there'll be text that appear above the unit reading "you have no kills".
 

Ayanami

칼리
Reaction score
288
Use this. Closest match to an error message in my opinion. I quote from Ashlebede.

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 !")
 

bboykonjo

New Member
Reaction score
1
or u can just put this in the trigger:

Action:
>Game Text: |cffffcc00You have no kills|r


(With the spaces in front, the text will appear in the bottom middle of the screen.)

IDK, just try it out
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Well.. Finding the same sound isn't easy, playing any sound loses its point. Besides, the message is supposed to follow the screen. I think it'll be really difficult and complicated, or even impossible to track the player's camera and create a dummy unit, and create the text above the unit.
 

Sim

Forum Administrator
Staff member
Reaction score
534
That discussion should have ended with post #7, which is the best solution to the problem at hand.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
or u can just put this in the trigger:

Action:
>Game Text: |cffffcc00You have no kills|r


(With the spaces in front, the text will appear in the bottom middle of the screen.)

IDK, just try it out

Nope, the spaces will push all previous game text upward. Game text seems to have a specific line where it ends. The whole reason I posted this was because the above method didn't work.

As for Glenphir's response, I kinda understand it, but being relatively new to JASS I'm not sure what goes where.
 

Ayanami

칼리
Reaction score
288
Just paste that code in the Map Header.

34803196.png


Then, just make a Sound-type variable called "SimError" in your Variable Editor.

Then to use this, basically input this line.

Trigger:
  • My Trigger
    • Actions
      • Set MyPlayerVariable = (Owner of (Triggering unit))
      • call SimError(udg_MyPlayerVariable,"You cannot cast that on mechanical units !")


"MyPlayerVariable" is basically the player that you want to show the error message to. You can edit the error message itself between the "".
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Wow, thanks. But do I have to edit anything in the original JASS code? Some of them, like msg and ForPlayer, seem to have no specific values.
 

Ayanami

칼리
Reaction score
288
Wow, thanks. But do I have to edit anything in the original JASS code? Some of them, like msg and ForPlayer, seem to have no specific values.

Nope, you don't need to edit the code. ForPlayer and msg do have values.

JASS:
function SimError takes player ForPlayer, string msg returns nothing


Trigger:
  • Actions
    • Set MyPlayerVariable = (Owner of (Triggering unit))
    • call SimError(udg_MyPlayerVariable,"You cannot cast that on mechanical units !")


In this case, "MyPlayerVariable" is "ForPlayer" and "You cannot cast that on mechanical units !" is "msg".
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
So ForPlayer is a global variable? And there's some problems with the code. It won't let me save the map.
 

Ayanami

칼리
Reaction score
288
So ForPlayer is a global variable? And there's some problems with the code. It won't let me save the map.

No, ForPlayer isn't a global. The only variable you need to make is the SimError sound variable and your player variable. Do you have NewGen and the latest JASSHelper?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Er... no. So I need to have a global variable to set as the Owner of Triggering Unit?
 
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