Jump to content
vapour

Global hint from a local script not working quite right

Recommended Posts

Hi fellow scripters

 

I have 'Unit1' activating a script from an addAction. Part of the script fires a hint to tell all players on the server what the map grid reference is of the freshly moved respawn point. The unit who activated the script gets a nice "Respawn moved to grid 023865" or wherever the respawn point is, but all the other players get "Respawn moved to grid Any".

 

Where have I gone wrong?

 

Script snippet responsible:

[[{gridPos = mapGridPosition getPos Unit1; Hint composeText [parsetext format ["<t size='1.2' align='center' color='#113DDD'>Respawn moved to grid %1", gridPos]]}],"BIS_fnc_Spawn",true] call BIS_fnc_MP;

Share this post


Link to post
Share on other sites

try like this:

[unit1, {_gridPos = mapGridPosition getPos _this; Hint composeText [parsetext format ["<t size='1.2' align='center' color='#113DDD'>Respawn moved to grid %1", _gridPos]]}] remoteExec ["call", 0];

Share this post


Link to post
Share on other sites

Try to calculate the values and parse the text before sending it to all clients, otherwise each client has to do that which is unecessary.

_gridPos = mapGridPosition getPos _this;
_text = composeText [parsetext format ["<t size='1.2' align='center' color='#113DDD'>Respawn moved to grid %1", _gridPos]]
_text remoteExec ["hint", 0];

Share this post


Link to post
Share on other sites

Thanks heaps for the replies guys.

 

Okay, this is what the issue was. Thanks to Pierre from Armaholic for spotting it. gridPos was a 'Global' variable, but only on the clients computer. That variable needs to be broadcast to all other clients (players) in the mission by using the command 'publicVariable'.

 

Here's how it all should have looked:

 

 

  1. gridPos = mapGridPosition getPos unit1;
  2. publicVariable "gridPos";
  3. parseText format ["<t size='1.2' align='center' color='#113DDD'>Respawn moved to grid %1", gridPos] remoteExec ["hint"];
  • Like 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

×