working on a night attack mission and have run into a bit of a snag.
there are 10 lights; 6 halogen, 4 street, in a rather large area i want disabled.
being new to scripting (well, newish), i googled it to find the normal way of doing it with "switchlight" won't work
so i can't just attach a game logic to the nearest power station (2 Klicks away) that says
{_x switchLight "OFF"} forEach ((getPos this) nearObjects ["StreetLamp",5000]);
now in my search i found 2 sets of work-arounds
one using sethit
_lamp = nearestObject [player, "Lamps_base_F"];
_lamp setHit ["light_1_hitpoint", 0.97]; //off
_lamp setHit ["light_1_hitpoint", 0]; //on
and this one by Pirin
// off: 0 = [0.95] execVM "lights.sqf";
// on: 0 = [0] execVM "lights.sqf";
_types = ["Lamps_Base_F", "PowerLines_base_F"];
_onoff = _this select 0;
for [{_i=0},{_i < (count _types)},{_i=_i+1}] do
{
// powercoverage is a marker I placed.
_lamps = getMarkerPos "someMarkerName" nearObjects [_types select _i, 500];
sleep 1;
{_x setDamage _onoff} forEach _lamps;
};
i have only vauge ideas on how to use either of these.
specifically i need some instruction on how to apply them.
i get that the set hit has to be applied to the object in question, but i don't know how, and i think i'd have to do it 4 times on each of the 6 halogen lamps, as each of those have 4 individual lights that i've had to shoot out in the past. i also understand that the Pirin method involves a some kind of map marker, but that's about all i understand.
my scripting ability goes about as far as making loadouts and everything i've learned through trial and error and quick looking things up, please try to keep that in mind.