Jump to content

Forums Announcement

Read-Only Mode for Announcements & Changelogs

Dear Survivors, we'd like to inform you that this forum will transition to read-only mode. From now on, it will serve exclusively as a platform for official announcements and changelogs.

For all community discussions, debates, and engagement, we encourage you to join us on our social media platforms: Discord, Twitter/X, Facebook.

Thank you for being a valued part of our community. We look forward to connecting with you on our other channels!

Stay safe out there,
Your DayZ Team

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

×