Jump to content
Firewall233

cutText showed for the one activated trigger

Recommended Posts

Hi,guys

I want to create a trigger that can simply teleport someone whoever enters the trigger from some place to another place.Here is what I wrote in trigger's OnActivation:

thisList select 0 execVM "teleport.sqf"

And here's "teleport.sqf"

_victim = _this;
_index = round random 2;
_range = 5;
_dir = random 360;
_posSphere_1 = getMarkerPos "marker_Sphere_1";
_posSphere_2 = getMarkerPos "marker_Sphere_2";
_posSphere_3 = getMarkerPos "marker_Sphere_3";
_pos = [_posSphere_1,_posSphere_2,_posSphere_3] select _index;
_id = clientOwner;			//maybe "clientOwner" returned 0 to "_id" so cutText executed on every client
[["","BLACK OUT"]] remoteExec ["cutText",_id,false];
sleep 4;

removeAllAssignedItems _victim;
_victim unlinkItem "ItemGPS";
_victim unlinkItem "ItemMap";
_victim unlinkItem "ItemWatch";
_victim unlinkItem "ItemCompass";
removeAllWeapons _victim;
removeAllItemsWithMagazines _victim;
_victim setPos _pos;

sleep 4;
[["succeeded","BLACK IN",5]] remoteExec ["cutText",_id,false];

I tested this code with a friend (on a dedicated server) and it turned out "BLACK OUT" effect and "BLACK IN" effect worked not only on the client who activated the trigger but also the one who didn't.

I didn't know how remoteExec works in this code so I try to find solutions in BI forums and I got nothing.I sincerely hope you can help me.

 

Share this post


Link to post
Share on other sites

Editor triggers exist on every machine unless set to be server-only.  So when the unit enters the trigger, everyone including the dedicated server runs the teleport script on the unit.  They're getting their own clientOwner and remoteExec the cutText to themselves.

 

- Set the trigger to server-only.

- Set the trigger onActivation to remotExec "teleport.sqf" where the unit entering the trigger is local.

- Since the local machine runs the script, no need to get clientOwner or remotExec cutText.  Just condition cutText to occur only when Not isDedicated, and then only when _victim isEqualTo Player.

  • Like 2

Share this post


Link to post
Share on other sites
On 12/5/2021 at 3:41 AM, opusfmspol said:

Editor triggers exist on every machine unless set to be server-only.  So when the unit enters the trigger, everyone including the dedicated server runs the teleport script on the unit.  They're getting their own clientOwner and remoteExec the cutText to themselves.

 

- Set the trigger to server-only.

- Set the trigger onActivation to remotExec "teleport.sqf" where the unit entering the trigger is local.

- Since the local machine runs the script, no need to get clientOwner or remotExec cutText.  Just condition cutText to occur only when Not isDedicated, and then only when _victim isEqualTo Player.

Thank you so much for your advices and especially for basic trigger knowledge!!!!!!! I get your point and I will try to run my code by these ways.😁

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

×