Home   Help Search Login Register  

Author Topic: laserTarget in coop [SOLVED]  (Read 1450 times)

0 Members and 1 Guest are viewing this topic.

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
laserTarget in coop [SOLVED]
« on: 07 Feb 2012, 08:17:36 »
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: [Select]
_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
};

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: [Select]
  if (!isNull _tmp) then {target=_tmp; publicVariable target;};

But if you have better suggestion, please do it.

EDIT: the publicVariable solved the problem.
« Last Edit: 09 Feb 2012, 08:54:43 by bardosy »
Fix bayonet!