[JASS] Show Floating Text to specific player..?

Status
Not open for further replies.

ctb

ctb

Level 3
Joined
Jul 26, 2004
Messages
21
How can I show Floating Text for a specific player? I have "seen" it in a map, but it was protected.
 
An if with local player will do the magic. But only put it around the displaying code of the floating text, not around the creation of it if you don't want desyncs.
 
I think you can also do it with the GUI with `show text tag for force'? =P But localplayer is more aesthetic...
 
AIAndy said:
An if with local player will do the magic. But only put it around the displaying code of the floating text, not around the creation of it if you don't want desyncs.

Could't you explain a little more about the construction of the trigger and what there could happen if you are getting desyncs.


misaki said:
I think you can also do it with the GUI with `show text tag for force'? =P But localplayer is more aesthetic...

I've checked many times before writing this topic and I checked again when I saw what you had written, BUT there is no "show text tag for force/player etc." I'm using WE. Maybe there is such an action WEU, I don't know.
 
AIAndy is being a bit too guruish. ;) Create the text as usual and then show it as follows:

Code:
if GetLocalPlayer() == Player(0) then
   // add the showing code here
endif
The above block runs the code only for Player 1. Change Player(0) to whatever suits you.

Cheers!
 
I'm sorry, I'm too used to the JASS function calls. It's `Floating Text - show/hide'. One of the parameters is the force to show/hide it to or from.
 
Thanks Tommi.

One last question:
Couldn't someone tell a little about desyncs with floating text:

1. Why does desyncs happens?

2. What could there be done to prevent desync?

3. Could desync cause a error so the map, being played, crashes or screws up?
 
I think that desyncs happen, among others, if a variable is set to different values in different clients. Therefore you cannot initialize or set a variable in a local player loop.

You can use mainly "show text/graphics" and "play sound" actions in the local player block (anything that can be executed by the local client alone and which does not require network traffic to other clients).
 
When you play Warcraft in Multiplayer, the same game runs on multiple computers. To asure that those games actually do the same, Warcraft sends sync info between the computers.
As an example: when a unit is created, that unit needs to be created at the exact same point on all computers so Warcraft sends that location over the net and if it happens to be wrong on one computer, that computer desyncs with the rest of the game and will be forced to leave.
Usually desyncs are the result of bugs in the game or problems in the network. Now Warcraft has a special native that intentionally desyncs the game. That is GetLocalPlayer. After running
local player p = GetLocalPlayer()
p contains a different player on all computers (the player playing on that specific computer). Now you will wonder why does it not always cause a desync of the game? The reason is that Warcraft does not sync everything, some things are local and changing them on a specific computer does not desync the game. That are usually things related to input and output, but not related to the outcome of the current game.
Some Examples: Models, Skins, Displaying Text, Sound, ...

So if you have code like
if GetLocalPlayer() == Player(5) then
//some code
endif
then it is important that you only put local stuff in there and not create a unit or similar.
 
Actually I've used
set udg_LocalPlayer = GetLocalPlayer()
in the map initialization and it does not seem to desync the game. Any idea why's that so?

Still, I've heard of some strange problems that some people have with the map, but I've not been able to replicate them, nor relate them to desync (since people don't get disconnected; just nothing happens for the other player). Would it be possible that the map would run differently on different clients (e.g. Mac/PC)? I.e. some people would experience a desync related problem and others not, playing the same map?
 
Usually I think it is better to avoid desyncing globals as you never know where you accidently use it causing desyncs.
Some have claimed that globals are synced (so Warcraft would notice the desync at once). I have never tested it so I don't know for sure.
 
Status
Not open for further replies.
Back
Top