No, event-handlers are entirely
compatible with MP play, but in SP you don't notice their behaviour is not global. There are a multitude of differences between MP and SP scripting that you are not taking into account (MP is a lot more complex than SP). You will need to use MP comm
* Look at the
MP tutorial (specifically to grasp the difference between local and global effects).
* Look at my
functions tutorial to get a better grasp of functions (also look at cheetah's sqf tutorial, perhaps).
* Always use
preprocessFileLineNumbers, rather than
preprocessFile (look at the COMREF if you want an explanation of the differences).
* On another issue (not directly associated with your MP problems), seriously consider the multiple benefits of learning to use arrays and loops, rather than endlessly repeating code:
// Run with:
// nul = [[target0, target1, target2], [marker0, marker1, marker2]] execVM "resetTanks.sqf";
//
// or (since you are compiling your functions!):
// [[target0, target1, target2], [marker0, marker1, marker2]] call tankreset;
//
// Note that the markers array is NOT an array of game markers, but of objects, such as game-logics.
//
private ["_dir","_pos","_markers","_targets","_class"];
_targets = _this select 0; // targets is an array.
_markers = _this select 1; // markers is also an array and must be the same size.
if ((count _targets) != (count _markers)) exitWith
{
hint "ERROR: There must be exactly the same number of targets as markers!";
};
// Rather than repeating the exact same code for 12 targets, just iterate through the arrays you have.
for "_i" from 0 to ((count _targets) - 1) do
{
// Record the old position:
_pos = getPos (_markers select _i);
_dir = getDir (_markers select _i);
// Mostly just use a standard target, but a few want to be specific vehicles.
_class = switch _i do
{
5: { "ACE_BRDM2" };
9: { "ACE_BMP2" };
10: { "ACE_BMP2" };
11: { "ACE_T72" };
default { "ACE_TARGET_GREEN_FACUMC" };
};
// Delete the old target, then replace it with a fresh one.
deleteVehicle (_targets select _i);
_target = _class createVehicle _pos;
_target setDir _dir;
};
(code tested for syntax errors, but not run)