| 05-04-2009, 03:55 PM | #1 |
In my map I want to give special information to observer players that can be seen only by them (like, what abilities Player 4 leveled, what items Player 7 bought, etc.). Is there an easy way to do so? I noticed there was a constant PLAYER_STATE_OBSERVER but I have no idea with which function to use it. I tried using something like: JASS:if GetLocalPlayer() != Player(0) and GetLocalPlayer() != Player(1) and ... //etc. |
| 05-04-2009, 04:16 PM | #2 |
GetPlayerState, maybe... |
| 05-04-2009, 04:48 PM | #3 |
But that returns an integer... With what am I supposed to compare it? |
| 05-04-2009, 04:53 PM | #4 | |
Quote:
|
| 05-04-2009, 05:50 PM | #5 |
isn't it JASS:if GetPlayerState(Player(N)) == PLAYER_STATE_OBSERVER then |
| 05-04-2009, 06:08 PM | #6 | |
Quote:
JASS:constant native GetPlayerState takes player whichPlayer, playerstate whichPlayerState returns integer Ok, I did this after 1 second of map startup. It displays 1 to the observer players and 0 to normal ones. JASS:call BJDebugMsg(I2S(GetPlayerState(GetLocalPlayer(), PLAYER_STATE_OBSERVER))) My next question is if it will cause desyncs if I use directly JASS:if GetPlayerState(GetLocalPlayer(), PLAYER_STATE_OBSERVER) == 1 then call DisplayTextToPlayer(GetLocalPlayer(), ...) endif |
| 05-04-2009, 06:36 PM | #7 |
text messages are likely not source of desyncs. although, you could just do a loop check, rather than a getlocalplayer block if you are worried, specially because displaytexttoplaer already filetrs by player |
| 05-04-2009, 06:50 PM | #8 |
GetLocalPlayer() fail in a replay. It's hard for me to explain but basically with your example, only the first player (first slot) will see this message. http://www.wc3c.net/showthread.php?t=101885 If you care about replays then you shouldn't use GetLocalPlayer() like that, especially because you can easily avoid using it here. |
| 05-05-2009, 09:55 AM | #9 |
I saw the link but I couldn't find anything that could help me avoid usage of GetLocalPlayer(). Btw, in another thread a guy told me this native: JASS:constant native IsPlayerObserver takes player whichPlayer returns boolean As for the replays... I still can't find a way to show messages, does anybody have a sollution for this? |
| 05-05-2009, 10:23 AM | #10 |
JASS:function SFNLP takes nothing returns nothing call DisplayTimedTextToPlayer(GetEnumPlayer(), 0, 0, bj_cineFadeContinueTrans, bj_lastPlayedMusic) endfunction function DisplayTimedTextToForceSFNLP takes force toForce, real duration, string message returns nothing local real r = bj_cineFadeContinueTrans local string s = bj_lastPlayedMusic set bj_cineFadeContinueTrans = duration set bj_lastPlayedMusic = message call ForForce(toForce,function SFNLP) set bj_cineFadeContinueTrans = r set bj_lastPlayedMusic = s endfunction Have fun with this function |
| 05-05-2009, 11:26 AM | #11 |
I see it displays a message but how am I supposed to use it? Do I have to create a force, set it to bj_FORCE_ALL_PLAYERS and then remove from it Players 0-9 and use it with that function? |
| 05-05-2009, 12:57 PM | #12 |
Post function you using currently to display text, i will fix it. For this, just use GUI forces (enemy of player, ally of player and others) or create forces with players you need. |
| 05-05-2009, 01:28 PM | #13 |
Currently: JASS:if IsPlayerObserver(GetLocalPlayer()) then call DisplayTextToPlayer(GetLocalPlayer(), 0., 0., GetPlayerNameColored(Player(2)) + "has leveled Earth Splitter.") // Or something like that... endif But as it was stated above, it won't work in a replay. |
| 05-05-2009, 01:58 PM | #14 |
dont use getlocal player. just do a loop that checks for all players. that would be simpler, and displaytexttoplayer doesnt really need to use a local player argument. |
| 05-05-2009, 04:35 PM | #15 | ||
Quote:
Quote:
|
