Jump to content
Michael Marsh

Remoteexec of dynamic text possible?

Recommended Posts

Hi,

 

Is it possible to use remote exec to display dynamic text on a target PC initiated from the server? What would be the correct syntax?

 

[parseText format  	["<t align='CENTER' font='PuristaBold' size='4'><img size='6' color='000000' image='%1'  shadow='2'/> + 2</t>",mymoneyimage ], 	true, nil,  2, 0.5, 0] remoteExec ["BIS_fnc_textTiles", _killer];

 

The above code only shows to the host on a player hosted game. On dedicated it does not show at all. the target PC  variable "is _killer"  is taken from  entitykilled event handler.

Share this post


Link to post
Share on other sites

Yes, it's possible (your code should work as far as _killer is defined,  and myMoneyImage also... say common to all PC), but not advisable.

 

Your mission event handler (MEH) "entityKilled" must run on every PC (init.sqf,  or initPlayer.sqf if you don't need it on dedi server).

So, you don't need to remote exec this kind of function. As rule of thumb, it's preferable to run something locally instead of remote execute it. (net is a bottleneck)

 

Usually, there is already MEH "entityKilled" for whatever reason in the scenario (or think about it instead of EH "killed" or even MPEH "MPKilled") .

To keep some code local, just write something like:

if (local _killer) then {...}; 

Think about _instigator , (see MEH) It's more reliable.

Don't forget myMoneyImage for everyone.

 

Share this post


Link to post
Share on other sites

hi guys i have same small problem to solve

//  on trigger init called  names:   trig_1  trig_2  trig_3  trig_4

//  _trgactvted=[thisTrigger] execVM "scripts\SPAWN_TASKactivated.sqf";




if (!isServer) exitWith {};

_trigractivated = _this select 0;


/// this part working great only on my pc

// Find the nearest marker(generaly an objectif marker) to delete him & replace by a new one for everybody

_nearestMarker = [allMapMarkers, _trigractivated] call BIS_fnc_nearestPosition;
deletemarker _nearestMarker;


// this marker part working great on all pc

_m3 = createMarker [format ["mrk%1",random 100000],getpos _trigractivated];
_m3 setMarkerShape "ICON";
_m3 setMarkerType "mil_triangle";
_m3 setMarkerColor "Colorblack";
_m3 setMarkerText "CLEAR";



_typeMusic = [ "LeadTrack04_F","LeadTrack06_F","LeadTrack03_F_EPB"] call BIS_fnc_selectRandom;



/// this working great but only on my pc

{
//set music

playMusic _typeMusic;
ext = format ["<t size='0.6'>" + "GREAT" + "</t>" + "<br />" + "<t size='1'>" + "ONE MORE" ];  
[_text,0.01,0.01,15,-1,0,90]spawn bis_fnc_dynamicText;

} forEach allPlayers;

it a small work im doing for lan with my son, the problem are:

 

* i cannot delete nearest marker on all machine. the new marker created is ok for all (to show ex task done) but old one present on map at mission start is not deleted??

* the second is the Bis_fnc_dynamicText  can anybody tell me a nice way for exemple to show proper text or play a song to all players when triger is activated?

 

 

i know a bit how to script but more in sp if someone can help it will be nice.. 

 

Share this post


Link to post
Share on other sites

// Find the nearest marker(generaly an objectif marker) to delete him & replace by a new one for everybody

It seems your marker is local (even if on all PCs). How was it created?

 

 

Really, you take a wrong way with a server only sqf if you intend to broadcast most of the code!

Let your triggers NOT server only! This way, as you want the same result on each PC, the sqf runs on each PC. Simple as that.

If something must be run on server only... you can add the condition: if (isServer) then {...} 

 

 

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
6 hours ago, pierremgi said:

Let your triggers NOT server only! This way, as you want the same result on each PC, the sqf runs on each PC. Simple as that.

If something must be run on server only... you can add the condition: if (isServer) then {...} 

 

I always wondered what that meant exactly in a trigger.

Share this post


Link to post
Share on other sites

thanks all for the reply, then if i hunderstand with the trigger (NOT SERVER) the SQF runs on all machine , ok then no need remote exec for showing messages to all players

{

playMusic _typeMusic;
ext = format ["<t size='0.6'>" + "GREAT" + "</t>" + "<br />" + "<t size='1'>" + "ONE MORE" ];  
[_text,0.01,0.01,15,-1,0,90]spawn bis_fnc_dynamicText;

} forEach allPlayers;   //  no need the  forEach allPlayers? correct

 no need the  forEach allPlayers? correct?

 

and for the markers they are placed from editor as 4 zones to reach to win the mission.. by this way i can chose in editor where to place it and normaly the script does the job... but if you have smplest way to do ex .. in the trigger init   its super fun to play with Vandeanson & ravage and that make you travel across the map a bit

waitUntil {
	sleep 3;
	( (triggeractivated trig_1) && (triggeractivated trig_2)&& (triggeractivated trig_3)&& (triggeractivated trig_4) )
};


_text = format ["<t size='1.4'>" + "OBJECTIF COMPLETED" + "</t>" + "<br />" + "<t size='1'>" + "GOOD JOB SOLDIER!" ];  
[_text,0.01,0.01,15,-1,0,90]spawn bis_fnc_dynamicText;

sleep 10;
_text = format ["<t size='0.8'>" + "hope you enjoy" + "</t>" + "<br />" + "<t size='1'>" + "see next operation.." ];  
[_text,0.01,0.01,15,-1,0,90]spawn bis_fnc_dynamicText;

["end1", true, true] call BIS_fnc_endMission;



still wip 😉

Share this post


Link to post
Share on other sites
2 hours ago, thesnypr said:

 


{
playMusic _typeMusic;
ext = format ["<t size='0.6'>" + "GREAT" + "</t>" + "<br />" + "<t size='1'>" + "ONE MORE" ];  
[_text,0.01,0.01,15,-1,0,90]spawn bis_fnc_dynamicText;
} forEach allPlayers;   //  no need the  forEach allPlayers? correct

 no need the  forEach allPlayers? correct?

no need:  { } forEach allPlayers;

 

2 hours ago, thesnypr said:

and for the markers they are placed from editor as 4 zones to reach to win the mission.. by this way i can chose in editor where to place it and normaly the script does the job... but if you have smplest way to do ex .. in the trigger init   its super fun to play with Vandeanson & ravage and that make you travel across the map a bit

 

 

So, _nearestMarker = [allMapMarkers, _trigractivated] call BIS_fnc_nearestPosition;

deletemarker _nearestMarker;

should work.

You can also decide to change this marker (shape, type, color, text) instead of creating one/deleting one.

 

 

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

×