Jump to content
DennisWeiss

UI Scripting

Recommended Posts

Hello,

so far I have figured out how to do server sided coding, like dealing damage to a player if he is outside of a specific zone or sending global chat messages. But if I'm not mistaken I need something client sided to for instance pop up a dialog or display a UI widget. Does anyone know how to do client sided scripting? 

Also the 

GetGame().ChatMP(player, "Text", "colorImportant");

function to send a chat message to a specific player didn't work for me.

Edited by DennisWeiss

Share this post


Link to post
Share on other sites

Hello,

so far I have figured out how to do server sided coding, like dealing damage to a player if he is outside of a specific zone or sending global chat messages. But if I'm not mistaken I need something client sided to for instance pop up a dialog or display a UI widget. Does anyone know how to do client sided scripting? 

Also the 

GetGame().ChatMP(player, "Text", "colorImportant");

function to send a chat message to a specific player didn't work for me.

Share this post


Link to post
Share on other sites

Merged.

Please only open one topic - if you need something moved, have us moderators do it, thank you!

Share this post


Link to post
Share on other sites
@code
		// example sending
		void Send()
		{
			ScriptRPC rpc = new ScriptRPC();
	
			rpc.Write(645);
			rpc.Write("hello");
			
			array<float> farray = {1.2, 5.6, 8.1};
			rpc.Write(farray);
	
			rpc.Send(m_Player, ERPCs.RPC_TEST, true, m_Player.GetIdentity());
		}

		// example receive
		void OnRPC(ParamsReadContext ctx)
		{
			int num;
			string text;
			array<float> farray;

			ctx.Read(num);
			ctx.Read(text);
			ctx.Read(farray);
		}
	@endcode

You will need RPCs. ERPCs is an enum in 3_Game\Enum, you can just create your own.  As far as  I understand, to open a window for one specific player, this player has to sent an RPC to the server, which allows the player to open that window/menu/whatever.

Search the script.pbo for RPCSingleParam() and and OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)

Share this post


Link to post
Share on other sites

You would have to override the corresponding OnRPC function. In DayZPlayerImplement is a debug version of autowalk inside the rpc function. Overriding this wont break something so go ahead and play around with it.

override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)

Edit: and dont put your custom RPC in the ERPCs, make a new file with your own naming it MyRPCs for example.

Edited by nico1122

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×