Liven_28 20 Posted February 15, 2019 Since the yesterday update I have a problem : the instruction GetGame().ChatPlayer(1 ,"Hello"); do not compile anymore (error message "incompatible parameter '1'") And if I try GetGame().ChatPlayer("Hello"); I have no error message but no message displaying in game when it worked well before the update Share this post Link to post Share on other sites
SmashT 10907 Posted February 15, 2019 (edited) I read ChatPlayer(string text); is broken on engine side, hence the known issue: When using the in-game text chat, you will not see your own messages. Other players can." Mark (DaOne) suggested using proto native void Chat(string text, string colorClass); for local use only or GetGame().GetPlayer().MessageImportant("YOU ARE A MEME"); if you want to do it on a server. I assume it will be hotfixed soon. Edited February 15, 2019 by SmashT Share this post Link to post Share on other sites
Liven_28 20 Posted February 15, 2019 (edited) I am running DayZ on a server on my own machine (server and client on the same computer), so I tried GetGame().GetPlayer().MessageImportant("YOU ARE A MEME"); => Undefined function 'MessageImportant' GetGame().GetPlayers().MessageImportant("YOU ARE A MEME"); => Not enought parameters in function 'GetPlayers' I Am really stuck without that because I don't know how to see variable values évolution for debugging and playtests (I'm blind !) Edited February 15, 2019 by Liven_28 Share this post Link to post Share on other sites
g4borg 74 Posted February 15, 2019 (edited) someone in the news thread reported, that the see-your-own-chat thing is just a client setting issue? Anyway, I really hope they overhaul the whole chat system in fact. having chat messages arrive with a string based username only is not ideal to know who wrote that message, if everyone is named survivor, and there is no option serverside to at least assign a name to unnamed players; imho this is a rather major issue, from my developer perspective, that i would rather overhaul sooner than later. if you really needed to display a message you can definitely still use the method with RPC directly (altough this rpc makes it appear red) Param1<string> Msgparam; PlayerBase player; PlayerIdentity playerIdentity; # fill those variables with GetPlayer() and GetPlayer().GetIdentity() Msgparam = new Param1<string>( "Hello world!"); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerIdentity); also getplayers requires an array to write to: array<Man> players = new array<Man>; GetGame().GetPlayers( players ); Edited February 15, 2019 by g4borg Share this post Link to post Share on other sites
Liven_28 20 Posted February 16, 2019 (edited) 21 hours ago, g4borg said: someone in the news thread reported, that the see-your-own-chat thing is just a client setting issue? Anyway, I really hope they overhaul the whole chat system in fact. having chat messages arrive with a string based username only is not ideal to know who wrote that message, if everyone is named survivor, and there is no option serverside to at least assign a name to unnamed players; imho this is a rather major issue, from my developer perspective, that i would rather overhaul sooner than later. if you really needed to display a message you can definitely still use the method with RPC directly (altough this rpc makes it appear red) Param1<string> Msgparam; PlayerBase player; PlayerIdentity playerIdentity; # fill those variables with GetPlayer() and GetPlayer().GetIdentity() Msgparam = new Param1<string>( "Hello world!"); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerIdentity); also getplayers requires an array to write to: array<Man> players = new array<Man>; GetGame().GetPlayers( players ); For me RPC is a great mystery, I heard here and here that it is verry useful (essential), but I can't figure out how it works. For exemple, how to fill player and playerIdentity, what to do with the array<Man>, how to be sure RPC is activated, does it is link to the RPC framework mod or it is internal dayz function (I heard I have to I have to declare it on config.ccp ...). I searched a lot documention, help, tuto... but find nothing that helped me. All I need is a basic, simple, fonctionnal, complete exemple for sending message ingame (mostly to check variables values). I heard getting player inputs (detect when player hit a key) require RPC too, but I don't find how to do. Very sorry being so noob, I have a solide experience on Unity (for single player games) but I can't figure out how Enfusion works. I never done modding on arma so I don't have the workflow even for these "simple" things (witch make me lost a looooooooooot of time). Edit : Just finish writiing this and I find a solution that seem to work : Param1<string> Msgparam; PlayerBase player; PlayerIdentity playerIdentity; array<Man> players = new array<Man>; GetGame().GetPlayers( players ); for ( int i = 0; i < players.Count(); ++i ) { player = PlayerBase.Cast(players.Get(i)); playerIdentity = player.GetIdentity(); Msgparam = new Param1<string>( "Hello world!"); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, Msgparam, true, playerIdentity); } Is it a good way for doing it. And I always look a way to detect player inputs... Edited February 16, 2019 by Liven_28 Share this post Link to post Share on other sites
g4borg 74 Posted February 17, 2019 (edited) the RPC is basicly a function that gets sent as a signal to the client. what the client does with it depends on the signal. it is basicly a network message. "remote procedure calls" are the opposite of other general network code, they get used to trigger custom functions, opposite to the general network code which constantly syncs stuff like your player position internally. a "message" is by definition something custom, unpredictable, as opposed to predictable things. 🙂 but more on that you find in general literature, it is not a dayz specific thing. Any modern multiplayer engine uses this. rpcs are also important for mods, as they allow you custom commands/data to be sent from server to client and vice versa. there are a few predefined ones in scripts/3_Game/Enums/ERPCs.c, and the "user action message" is one of them. GetPlayers is a procedure, which writes the amount of players into the array you give it. Your snippet of code basicly sends the RPC to all players connected. So your code is basicly a "message to all players". It might be enough if you are alone. If not, you would have to filter for "your designated player" in the loop. It is fine not to know previous titles btw. the way arma was different. you can get an example of intercepting chat messages in some of the admin tool scripts you can find, like in vanilla plus plus; however, in scripts you can only read chat messages of players which are registered as admin. otherwise you need to write client side mods aswell, or may have a look at the mods in the workshop if something fits your needs, because you would have to intercept input on client side and send an rpc to the server for anything more sophisticated. good luck 🙂 Edited February 17, 2019 by g4borg Share this post Link to post Share on other sites
AXEL777 2 Posted February 17, 2019 (edited) void SendMessageToAllPlayers(string message) { private array<Man> players = new array<Man>; GetGame().GetPlayers( players ); private int numbOfplayers = players.Count(); if(( numbOfplayers > 0 ) && (message != "")) { foreach(Man player: players) { if(( player ) && (message != "")) { Param1<string> m_GlobalMessage = new Param1<string>(message); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_GlobalMessage, true, player.GetIdentity()); } } } } void SendPersonalMessage(string message, Man player) { if(( player ) && (message != "")) { Param1<string> m_GlobalMessage = new Param1<string>(message); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_GlobalMessage, true, player.GetIdentity()); } } Add this functions in your mission server or you mod and call him with: For all players global message: SendMessageToAllPlayers("My global test message"); For one player only: SendPersonalMessage("My test private message", player); where player is notNULL Man base object! Any functiuons, as this: proto native void Chat(string text, string colorClass); proto native void ChatMP(Man recipient, string text, string colorClass); proto native void ChatPlayer(string text); is not worked in server, tested with my friends, because i am can't connect to my test server (local server don't searched in game browser, in community server him don't founded (my provider block my ports server) and from commandline start game this game client will be crashed, developvers game don't ask anything, very bad support for release game) Edited February 17, 2019 by AXEL777 Share this post Link to post Share on other sites
Liven_28 20 Posted February 17, 2019 Thank you for the answers, I'll look at it seriously tomorrow. Be sure I'll be back ,:-) Share this post Link to post Share on other sites
Liven_28 20 Posted February 18, 2019 (edited) On 2/17/2019 at 11:01 AM, AXEL777 said: void SendMessageToAllPlayers(string message) { private array<Man> players = new array<Man>; GetGame().GetPlayers( players ); private int numbOfplayers = players.Count(); if(( numbOfplayers > 0 ) && (message != "")) { foreach(Man player: players) { if(( player ) && (message != "")) { Param1<string> m_GlobalMessage = new Param1<string>(message); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_GlobalMessage, true, player.GetIdentity()); } } } } void SendPersonalMessage(string message, Man player) { if(( player ) && (message != "")) { Param1<string> m_GlobalMessage = new Param1<string>(message); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_GlobalMessage, true, player.GetIdentity()); } } Add this functions in your mission server or you mod and call him with: For all players global message: SendMessageToAllPlayers("My global test message"); For one player only: SendPersonalMessage("My test private message", player); where player is notNULL Man base object! Any functiuons, as this: proto native void Chat(string text, string colorClass); proto native void ChatMP(Man recipient, string text, string colorClass); proto native void ChatPlayer(string text); is not worked in server, tested with my friends, because i am can't connect to my test server (local server don't searched in game browser, in community server him don't founded (my provider block my ports server) and from commandline start game this game client will be crashed, developvers game don't ask anything, very bad support for release game) Thank you, very useful piece of code, I'm now looking for such same thing for detecting player inputs On 2/17/2019 at 10:49 AM, g4borg said: the RPC is basicly a function that gets sent as a signal to the client. what the client does with it depends on the signal. it is basicly a network message. "remote procedure calls" are the opposite of other general network code, they get used to trigger custom functions, opposite to the general network code which constantly syncs stuff like your player position internally. a "message" is by definition something custom, unpredictable, as opposed to predictable things. 🙂 but more on that you find in general literature, it is not a dayz specific thing. Any modern multiplayer engine uses this. rpcs are also important for mods, as they allow you custom commands/data to be sent from server to client and vice versa. there are a few predefined ones in scripts/3_Game/Enums/ERPCs.c, and the "user action message" is one of them. GetPlayers is a procedure, which writes the amount of players into the array you give it. Your snippet of code basicly sends the RPC to all players connected. So your code is basicly a "message to all players". It might be enough if you are alone. If not, you would have to filter for "your designated player" in the loop. It is fine not to know previous titles btw. the way arma was different. you can get an example of intercepting chat messages in some of the admin tool scripts you can find, like in vanilla plus plus; however, in scripts you can only read chat messages of players which are registered as admin. otherwise you need to write client side mods aswell, or may have a look at the mods in the workshop if something fits your needs, because you would have to intercept input on client side and send an rpc to the server for anything more sophisticated. good luck 🙂 Ok, that's make me progress in understanding those things. I already had a look in workshop mods code, but I can't differentiate what concern the server, what concerne the client, how they conmunicate with each other (tryed lot of things without succed). The script I am working on (the one sending message to players, witch run fine now) is in a subfolder of mpmission stuff and link to the init.c so it is a server modification (not realy a mod as it is not sign and packed), but now (if I understand what you say) I need to make a client side mod to detect players input. Can you give me some details on this point? Edited February 18, 2019 by Liven_28 Share this post Link to post Share on other sites
g4borg 74 Posted February 19, 2019 18 hours ago, Liven_28 said: Can you give me some details on this point? unfortunately no, as i did not yet make a mod myself yet in dayz. but maybe someone here has. but i did see chat mods on the workshop which might be usable and introduce RPCs, like the SideChat. what you would basicly do is send an RPC to the server if a player on the client enters a text. this has to be done in your mod, or any mod you use which sends an rpc to the server. on the server, the RPC would be catched as event (which can be done perfectly also in mission) and lead to whatever you do with it. you can already catch chat messages from players who are logged in as admin (#login password in chat, happens over battleeye). so for something like admin commands, this already works. however since the event only sends username and message, you would also have to make sure, each admin actually sets a username explicitly, or you will not be able to identify who actually wrote it (i know, it sounds as broken as it is). To be honest I sincerely hope, this will be fixed by the devs, which is why i wait. because until the client cannot auto-load mods natively, i fear that running modded servers will only appeal to a certain population (which usually prefer heavily modded servers), and i just want modifications that are "useful". also for the general public this is no good, as you would certainly not want to distribute your server password to people, who can then just enter #shutdown at any time 🙂 Share this post Link to post Share on other sites