• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How can you send Game Messages to only one player.

Status
Not open for further replies.
Level 11
Joined
Feb 22, 2006
Messages
752
Oddly enough, there's no GUI action for this, but in JASS there's a function DisplayTextToPlayer() and its timed counterpart DisplayTimedTextToPlayer().

However, I'm pretty sure the GUI action that sends text to a player force has options for sending it to individual players (but not positive on this, since I haven't used the GUI action in a while and I can't check right now). If this does work, you don't have to worry about leaking a force since I'm pretty sure the action uses a set of bj globals instead of creating a new force.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
If you need a more specific way of doing this (rather than needing a preset player), you can use Jass:

JASS:
call DisplayTextToPlayer(thePlayer,0.,0.,theText)
call DisplayTimedTextToPlayer(thePlayer,0.,0.,theTime,theText)

//for example

call DisplayTimedTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0.,0.,5.,"Our town is under attack! " + GetUnitName(GetTriggerUnit()) + " was just targeted!")
 
Level 9
Joined
Apr 25, 2009
Messages
468
I think this is solved now man :)

But well, if you want the best way of doing this, here's the trigger:
  • Player Message
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MessagePlayer = (All players matching (((Matching player) Equal to (Your Wanted Player (Color)) and (((Matching player) slot status) Equal to Is playing)))
      • Player Group - Pick every player in MessagePlayer and do (Actions)
        • Loop - Actions
          • Game - Display to (Player group((Picked player))) the text: Your Text
      • Custom script: call DestroyForce(udg_MessagePlayer)
 
Status
Not open for further replies.
Top