Jump to content
JohnKalo

Chat Showing multiple times

Recommended Posts

So one major change I tried doing in all campaign missions is to use scripts to run all chats. The scripts are run via a trigger. The trigger runs the audio via the effects and also the chat script which goes like:
 

[HQ,"HQ to Blue Lightning, Blue Lightning do you copy?"] remoteExec ["sideChat",0];
sleep 4;
[BL,"Blue Lightning copies."] remoteExec ["sideChat",0];
sleep 2.5;
[HQ,"Blue Lighting, forces coming from your West are moving towards point Lamda. About 30 heavily equipped hostiles."] remoteExec ["sideChat",0];
sleep 7;
[HQ,"Ability to change the extraction point available."] remoteExec ["sideChat",0];
sleep 4.5;
[BL,"Copy that HQ, no need to. "] remoteExec ["sideChat",0];
sleep 2;
[BL,"Not every day do we have the chance to eliminate terrorists. Blue lightning over."] remoteExec ["sideChat",0];

The problem is that the Chat was shown many times. Actually it was shown as many times as the number of players playing. One solution I can think of is to change all the above with a simple:

 

HQ sideChat "texthere";

 

but that will mean waaaaaaay many changes. So how can I fix it?

 

Sadly I have not got many testing opportunities so I will have to ask here, if I make the trigger Server Only will that fix the issue?

  • Like 1

Share this post


Link to post
Share on other sites

John !

 

Check my ex. from my :

_systemChat_notification		= true;			//	Show Systemchat notification

_sideChat_notification			= true;			//	Show hint notification
_side_of_sideChat				= playerside;	//	https://community.bistudio.com/wiki/Side	or	ex: west
_identity_of_sideChat			= "HQ";			//	https://community.bistudio.com/wiki/sideChat



if (_systemChat_notification) then {
[format["%1    K  .  I  .  A  .", _Killed]] remoteExec ["systemChat", 0, true]; 
};

if (_sideChat_notification) then {
[[_side_of_sideChat,_identity_of_sideChat],format["%1    K  .  I  .  A  .", _Killed]]remoteExec ["sideChat", 0, true]; 
};

 

  • Thanks 1

Share this post


Link to post
Share on other sites

You are running that on EVERY machine connected * total connected machines. Either ditch remoteExec or change the 0. Copied from Wiki:

Quote

 


Revo
    While KK's solution works fine in sp missions and on dedicated servers, it will not work properly for hosted missions.
    Solution:
    [0,0.5] remoteExec ['fadeRadio',[0,-2] select isDedicated,true];

    Singleplayer: isDedicated returns false -> code is executed everywhere (0)
    Hosted: isDedicated returns false -> code is executed everywhere including host (0)
    Dedicated: isDedicated returns true -> code is executed everywhere excluding server(-2)
 

 



ffs! Responsive design on these forums are terrible! Trying to do simple things on mobile and it just isn't working!!!

In response to my post above, that is only acceptable when CALLED on server only. I assume your trigger is local to each connected client so just remove remoteExec altogether. More info here:

https://community.bistudio.com/wiki/remoteExec



 

Edited by FallujahMedic -FM-
Edit Requested by OP
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

So all I can do is remove remoteExec and replace it with the simple sideChat command. Do that to about 1.600 lines of code :)

Whatevs the mission releases will be delayed but at least the problem will be solved. 

  • Like 1

Share this post


Link to post
Share on other sites

You just learned a good lesson about coding in general, if you've written it more than once make it a function. Here's a slightly less crappy way to make life easier.

 

//Set globally, maybe in init.sqf

//Now any changes can be quickly adjusted once, here.
fn_displayChat = {
	
	_speaker = _this select 0;
	_text = _this select 1;
	
	_speaker sideChat _text;

};

[BL, "I done goofed"] remoteExec ["fn_displayChat", allPlayers];

sleep 5;

[BL, "this isnt tested"] remoteExec ["fn_displayChat", allPlayers];

sleep 2;

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
Quote

Might be the trigger and the code in trigger execution ?

I used to show all chats via triggers. Something which caused many conditions but worked nicely. The problem appeared now that all chats are being shown via a script.

As far as I can see tiggers work locally once to every player. Something which is really nice but which does not combine with remoteExec. Because since they work locally the chat will show as much times as the number of players.

I could not see that when testing missions in the editor hence I have to change so many lines of codes. Everything seemed to work fine.
 

Quote


You just learned a good lesson about coding in general, if you've written it more than once make it a function. Here's a slightly less crappy way to make life easier.

 

Oh I get it. So as to easily change the command if a problem occurs.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, JohnKalo said:

Oh I get it. So as to easily change the command if a problem occurs.


Exactly :drinking2:

Also I hope you're using a text editor such as notepad++, you could easily go replace and change ["sideChat", 0] into ["fn_displayChat", allplayers] for all of the instances in about 10 seconds.

  • Like 2

Share this post


Link to post
Share on other sites

Yep, thanks for the advice, I started using notepad++ from the first campaign mission. Saw its recommendation from @GEORGE FLOROS GR scripts. 

  • Like 1
  • Thanks 1

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

×