Jump to content
Violt

Game chat if condition

Recommended Posts

So i'm trying to make a little mod and when a certain condition happens i want the player to be broadcasted a certain message. I can't seem to find how to do this. 

The function is setup like this: GetGame().Chat("Someone woke up, sleeping canceled.");

But it says i'm not giving Enough parameters, what parameter am i missing? 

Edited by Violt

Share this post


Link to post
Share on other sites

One reference to GetGame().Chat() I found in the DayZ Tools scripts was this:

/**
 \brief Prints text into game chat.
	\param text to print
	\param colorClass ??
	\n usage :
	@code
		GetGame().Chat("Item splitted", "colorAction");
	@endcode
*/

I also found this function and a call to it:

Message( text, "colorAction" );

void Message( string text, string style )
{
	if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
	{
		GetGame().ChatMP(this, text, style );
	}
	else
	{
		GetGame().Chat( text, style );
	}
}

The call wasn't just above the function in the document I found them in, I just put them together for better visibility. So basically the other argument seems to be a string type that says "colorAction". I have no idea what it does and what else can be put there.

So maybe this would work?

GetGame().Chat("Someone woke up, sleeping canceled.", "colorAction");

If that doesn't work, this is how I send a message to a player in my mods:

SendMessageToPlayer(player, "Someone woke up, sleeping canceled.");

void SendMessageToPlayer(PlayerBase player, string message)
{
	Param1<string> param = new Param1<string>(message);
	GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, param, true, player.GetIdentity());
}

 

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

×