cloakOthers = true;
cloakRadius = 30; //adjust for radius you want
Update: Console spam fix in CloakLoop and StartCloakLoop (1/11)
Update: Minor changes/info added to function CloakLoop. (12/7)
Step #1 // ------------------------------------------ // cloakingpack.cs // ------------------------------------------ Add all this to the bottom of the file: function CloakLoop() { %packradius = 30; //Radius of cloaking pack mass cloak if (!(isObject(MissionCleanup))) { schedule(10000, 0, "StartCloakLoop"); return; } %dep = nameToID("MissionCleanup/Deployables"); %count = ClientGroup.getCount(); %count2 = %dep.getCount(); %count3 = MissionCleanup.getCount(); for (%i=0;%i<%count;%i++) { ClientGroup.getObject(%i).shouldCloak = 0; } for (%i=0;%i<%count2;%i++) { %dep.getObject(%i).shouldCloak = 0; } for (%i=0;%i<%count3;%i++) { %obj = MissionCleanup.getObject(%i); if (%obj.getType() & $TypeMasks::VehicleObjectType) %obj.shouldCloak = 0; } for (%i=0;%i<%count;%i++) { %obj = ClientGroup.getObject(%i).player; if(%obj) { if ((%obj.getMountedImage($BackpackSlot) $= CloakingPackImage.getID()) && (%obj.getImageState($BackpackSlot) $= "activate")) { %obj.client.shouldCloak = 1; %pos = %obj.getPosition(); for(%i2=0;%i2<%count;%i2++) //Pack cloaks players { %obj2 = ClientGroup.getObject(%i2).player; if ((%obj2) && (%obj2 != %obj) && (%obj2.team == %obj.team)) { %pos2 = %obj2.getPosition(); if (VectorDist(%pos, %pos2) < %packradius) %obj2.client.shouldCloak = 1; } } for(%i2=0;%i2<%count2;%i2++) //Pack cloaks deployables { %obj2 = %dep.getObject(%i2); if ((%obj2) && (%obj2 != %obj) && (%obj2.team == %obj.team)) { %pos2 = posFromTransform(%obj2.getTransform()); if (VectorDist(%pos, %pos2) < %packradius) %obj2.shouldCloak = 1; } } for (%i2=0;%i2<%count3;%i2++) //Pack cloaks vehicles { %obj2 = MissionCleanup.getObject(%i2); if ((%obj2.getType() & $TypeMasks::VehicleObjectType) && (%obj2.team == %obj.team)) { %pos2 = posFromTransform(%obj2.getTransform()); if (VectorDist(%pos, %pos2) < %packradius) %obj2.shouldCloak = 1; } } } } } for (%i=0;%i<%count2;%i++) { %obj = %dep.getObject(%i); if (isObject(%obj)) { %data = %obj.getDataBlock(); if ((%data.cloakOthers) && (%obj.getDamageState() $= "Enabled")) { %pos = posFromTransform(%obj.getTransform()); for(%i2=0;%i2<%count;%i2++) //Deployables cloak players { %obj2 = ClientGroup.getObject(%i2).player; if ((%obj2) && (%obj2 != %obj) && (%obj2.team == %obj.team)) { %pos2 = %obj2.getPosition(); if (VectorDist(%pos, %pos2) < %data.cloakRadius) %obj2.client.shouldCloak = 1; } } for(%i2=0;%i2<%count2;%i2++) //Deployables cloak deployables { %obj2 = %dep.getObject(%i2); if ((%obj2) && (%obj2 != %obj) && (%obj2.team == %obj.team)) { %pos2 = posFromTransform(%obj2.getTransform()); if (VectorDist(%pos, %pos2) < %data.cloakRadius) %obj2.shouldCloak = 1; } } for (%i2=0;%i2<%count3;%i2++) //Deployables cloak vehicles { %obj2 = MissionCleanup.getObject(%i2); if ((%obj2.getType() & $TypeMasks::VehicleObjectType) && (%obj2.team == %obj.team)) { %pos2 = posFromTransform(%obj2.getTransform()); if (VectorDist(%pos, %pos2) < %data.cloakRadius) %obj2.shouldCloak = 1; } } } } } for (%i=0;%i<%count3;%i++) { %obj = MissionCleanup.getObject(%i); if (%obj.getType() & $TypeMasks::SensorObjectType) { %data = %obj.getDataBlock(); if ((%data.cloakOthers) && (%obj.getDamageState() $= "Enabled")) { %pos = posFromTransform(%obj.getTransform()); for(%i2=0;%i2<%count;%i2++) //Beacons cloak players { %obj2 = ClientGroup.getObject(%i2).player; if ((%obj2) && (%obj2 != %obj) && (%obj2.team == %obj.team)) { %pos2 = %obj2.getPosition(); if (VectorDist(%pos, %pos2) < %data.cloakRadius) %obj2.client.shouldCloak = 1; } } for(%i2=0;%i2<%count2;%i2++) //Beacons cloak deployables { %obj2 = %dep.getObject(%i2); if ((%obj2) && (%obj2 != %obj) && (%obj2.team == %obj.team)) { %pos2 = posFromTransform(%obj2.getTransform()); if (VectorDist(%pos, %pos2) < %data.cloakRadius) %obj2.shouldCloak = 1; } } for (%i2=0;%i2<%count3;%i2++) //Beacons cloak vehicles { %obj2 = MissionCleanup.getObject(%i2); if ((%obj2.getType() & $TypeMasks::VehicleObjectType) && (%obj2.team == %obj.team)) { %pos2 = posFromTransform(%obj2.getTransform()); if (VectorDist(%pos, %pos2) < %data.cloakRadius) %obj2.shouldCloak = 1; } } } } } for (%i=0;%i<%count;%i++) //Cloaks players { %client = ClientGroup.getObject(%i); %obj = %client.player; if (%obj) { if ((%client.shouldCloak) && (!%obj.isCloaked())) %obj.setCloaked(true); else if ((!%client.shouldCloak) && (%obj.isCloaked())) %obj.setCloaked(false); } } for (%i=0;%i<%count2;%i++) //Cloaks deployables { %obj = %dep.getObject(%i); if (isObject(%obj)) { %data = %obj.getDataBlock(); if (%data.cloakOthers) { if (%obj.isCloaked()) %obj.setCloaked(false); } else if ((%obj.shouldCloak) && (!%obj.isCloaked())) %obj.setCloaked(true); else if ((!%obj.shouldCloak) && (%obj.isCloaked())) %obj.setCloaked(false); } } for (%i=0;%i<%count3;%i++) //Cloaks vehicles { %obj = MissionCleanup.getObject(%i); if (%obj.getType() & $TypeMasks::VehicleObjectType) { if ((%obj.shouldCloak) && (!%obj.isCloaked())) %obj.setCloaked(true); else if ((!%obj.shouldCloak) && (%obj.isCloaked())) %obj.setCloaked(false); } } schedule(1000, 0, "cloakLoop"); } function StartCloakLoop() { $CloakLoop = 1; if (!(isObject(MissionCleanup))) { schedule(10000, 0, "StartCloakLoop"); return; } %depGroup = nameToID("MissionCleanup/Deployables"); if(%depGroup <= 0) { %depGroup = new SimGroup("Deployables"); MissionCleanup.add(%depGroup); } CloakLoop(); } Step #2 // ------------------------------------------ // Server.cs // ------------------------------------------ In function loadMissionStage2, under this line: new SimGroup (MissionCleanup); add this: if ($CloakLoop != 1) StartCloakLoop();Function CloakLoop is a continous loop that is run every second, but when tested with 17 players and a couple dozen deployables, it still ran at <1ms. So, it shouldn't cause any lag.