Editors Depot - Mission Editing and Scripting > Arma2 - Editing/Scripting Multiplayer

laserTarget in coop [SOLVED]

(1/1)

bardosy:
I have an issue with laserTarget command in my coop mission.

In single or the host player use the LaserDesignator, everything works fine. But if a client player try to use it, it wont works.

There is a radio trigger what set a variable to true and runs the tomahawn.sqf. The variable (tomavar) is triggering the same tomahawn.sqf script in all client by addPublicVariableEventHandler.

In the script (what runs in all client) I check the laserTarget value:

--- Code: ---_tmp = objNull;
_target = objNull;
{
   _tmp = laserTarget _x;
   if (!isNull _tmp) then {_target=_tmp;};
} forEach units pgrp;
if (!isNull _target) then {
  ...do the rocket to _target
}
else {
  ...warn them to use laserdesignator
};

--- End code ---

So this code (I forgot to bring the original with me here, but I will post it evening from home) works with single or if the laser designator is the host, but didn't work if a client use the laser.

I thought about it and I figured out, probably the laser target is only exists on the client where player use the designator, but don't exists on the server (if not the host player use). But(!) one of my friends created a mission where warplanes (I don't know wich one) armed with laser guided bombs, seek and destroy over OA and when I (a client and not host!) use my laser designator, the bombers drop their bomb where I point with the laser. So my laser mark had to be exists on the server side too, because the AI planes was on the server side.

Anyway, I'll use an other test this evening and change this line:

--- Code: ---   if (!isNull _tmp) then {target=_tmp; publicVariable target;};

--- End code ---

But if you have better suggestion, please do it.

EDIT: the publicVariable solved the problem.

Navigation

[0] Message Index

Go to full version