• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Text messages position.

Status
Not open for further replies.

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
Is there a way to change the position of where text messages appear?

(Messages that are generated via this action)
[trigger=""]Game - Display to (All players) the text: Message.[/trigger]

Thanks in advance!

JASS:
native DisplayTextToPlayer takes player toPlayer, real x, real y, string message returns nothing
native DisplayTimedTextToPlayer takes player toPlayer, real x, real y, real duration, string message returns nothing
 
Level 7
Joined
Nov 15, 2009
Messages
225
Jass is the world editor script language.

The triggers you can click is called GUI, upon playing the map the GUI code is converted into JASS.

If you want to add a single line of JASS code into a GUI trigger you can use the action:
Custom Script

for example:

  • Your Trigger Name
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: call DisplayTextToPlayer(Player(0), 0, 0, "Surprise message")
will display a message for player 1 (it's 0 in JASS).
Play around with both 0 integers to move the text.
 

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
@SeriousEnemy

Thanks for your reply. I will try that tommorow, but first I have one question: I do not want to define the player by his number, but with this (Owner of Buying Unit)

[trigger=""]Game - Display to (Player group((Owner of (Buying unit)))) for 10.00 seconds the text: Message
[/trigger]

How do I do it? Thanks.
 
Level 7
Joined
Nov 15, 2009
Messages
225
  • Game - Display to (Player group((Owner of (Buying unit)))) for 10.00 seconds the text: Message
How do I do it? Thanks.

Copy and paste it into your custom script action.

1st: showing Bought: UnitName
call DisplayTimedTextToPlayer(GetOwningPlayer(GetSoldUnit()), 0, 0, 10, "Bought: " + GetUnitName(GetSoldUnit()))

2nd: showing Success
call DisplayTimedTextToPlayer(GetOwningPlayer(GetSoldUnit()), 0, 0, 10, "Success")


Will work with the "unit sells a unit" event.
 
Alternatively if you are ever stuck and can't find the JASS equivalents, just assign it to a variable and then plug in the variable as input. As long as the variable is the correct type and you wrote the name out correctly (including the udg_ prefix), it will work.
  • Set TempPlayer = (Owner of (Buying unit))
  • Custom script: call DisplayTimedTextToPlayer(udg_TempPlayer, 0, 0, "Example")
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
Appear? You mean sometimes it appears in the middle or left or right or such... I mean the text messages. Well with the usages of spaces and such that is quite possible if that is your case btw.

If not please elaborate more and Ill try to help.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Appear? You mean sometimes it appears in the middle or left or right or such... I mean the text messages. Well with the usages of spaces and such that is quite possible if that is your case btw.

Adjusting the parameters in the jass function is a good solution. I would not add spaces to do that.

Note that the offset is resolution dependent if I remember correctly, so the text might not appear at the same place on all resolutions.

You can add line changes before or after the text to make it appear higher/lower. The line break is "/n" I think.
 
Status
Not open for further replies.
Top