Jump to content
Dj Rolnik

BIS_fnc_infoText global for all players when triggered

Recommended Posts

Hello everyone,

 

I am looking for help in regards to the BIS_fnc_infoText command which is supposed to trigger a small prompt in the bottom right corner of the map with some details on the location. Currently I have a trigger placed over an area and the trigger is set up to repeatable and triggered by blufor present. The trigger onActivation field points to a script which has this in it:

any= ["SHAPUR-3", "Coordinates:", mapGridPosition player ] spawn BIS_fnc_infoText;

Whenever I join a test server with a friend and I trigger the command, we all see it - it appears to be global.

What I would like to achieve though is trigger this option for each player individually, whenever they enter the trigger zone. So far I have not managed to achieve it, not sure if that's even possible with this command, but I would appreciate any help that I can get.

 

Thanks a lot!

Adam

 

 

 

Share this post


Link to post
Share on other sites

You can create the trigger locally to each client: createTrigger. In this case, take note of the makeGlobal parameter. 

Share this post


Link to post
Share on other sites

Hey beno,

 

Thanks for your response. I will test this out, but I assume this creates a trigger once the mission has been started, so would have to be put somewhere in the init.sqf.

 

Do you think there is a different way to make the editor-placed triggers do the same thing?

 

Thanks!

Share this post


Link to post
Share on other sites

Use remoteExec command. Like so:

["SHAPUR-3", "Coordinates:", mapGridPosition player] remoteExec ["BIS_fnc_infoText", [0, -2] select isDedicated, false];

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


EDIT: Misread. That function is Local already. It should do that automatically. What is in your trigger? I create triggers using script command. You can set the makeGlobal argument to false so that the trigger is local.

Quote

createTrigger [type, position, makeGlobal]

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

Share this post


Link to post
Share on other sites

No need to create local triggers. Just place the trigger in the mission as you describe you already have. Then in initPlayerLocal.sqf...

//initPlayerLocal.sqf

//Assuming you will have a few of these triggers
{
	_x params[ "_trigger" ];
	
	_trigger triggerAttachVehicle [ player ];
	_trigger setTriggerActivation [ "VEHICLE", "PRESENT", true ];
	
}forEach [
	locationTrigger1
	//add more triggers here
];

When you place a trigger in the editor each machine that joins the mission has an instance of the trigger created (via .sqm) that shares the same settings, position, size, activation, statements etc as where provided in the editor. As a trigger shares the same settings as all other instances of the same trigger, for example BLUFOR PRESENT repeating, then all instances of the trigger will fire on every machine when the activation statement is true. If a blufor is present in the trigger on one machine then he it must also be present on another. This is what you are experiencing with your current trigger setup, they are all activating.

 

As the majority of commands to effect triggers( triggerAttachVehicle, setTriggerStatements etc ) are EL(Effect Local) you can actually repurpose each instance of a trigger on each machine without effecting the others.

In the above script the trigger locationTrigger1 has the local player attached to the trigger and its activation changed to happen only when this attached vehicle is present, VEHICLE PRESENT repeating. In doing so each instances of the trigger will now only activate for their client and only on their specific machine. The triggers statement is left as provided in the editor which causes that client to see the location info text.

 

This is a great way of achieving things like this that would be a mess to set up in the editor. To do this in the editor would require you to place a trigger for each player, sync each player to a trigger( equivalent of triggerAttachVehicle ) and then provide in each trigger a condition to only activate if the attached vehicle(the synced player) is local, as remember each trigger would have a non local instance created on every machine when each client loads the .sqm.

 

 

  • Like 4

Share this post


Link to post
Share on other sites

Thanks Larrow! That's a solid explanation, I think I do get this now.

 

Will try the solution you provided when I get back home and report back.

 

Cheers!

Adam

Share this post


Link to post
Share on other sites

Confirmed! Working as expected. Triggers now activate only for the players who enter them. Thanks a lot @Larrow!

  • 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

×