After multiple tests I'm still unable to find what is causing the client to crash (as I said earlier I'm lacking serious scripting skill) so i'm posting the script in its current state if someone wish to give a helping hand ^^
As it is the script works when playing in SP or for the host in MP. The client will crash with an "invalid bitset(N)" as soon as gameplay starts. I tried to comment some parts of the script but was unable to find what is really causing the crash.
I tried to put some comments in the script, the main functions that are problematic are InitPlayerVariables(name), RunHost() ad RunClient()
#Conditional Hooks
$Application: FS2_Open
$On Game Init:
[
debug = true
cloak_ships = {["Shroud"] = true,["Hades#Stealth"] = true,["Basilisk"] = true,["Kamov#Stealth"] = true}
spectral_ships = {["Crusader"] = true,["Naginata"] = true,["Shroud"] = true,["Tempest"] = true,["Azan"] = true,["Haidar"] = true}
ecm_ships = {["Grendel"] = true,["Loki"] = true,["Mirage"] = true,["Phoenix"] = true,["Wolverine"] = true,["Kossac"] = true,["Sailin"] = true}
blindfire_ships = {["Coyote"] = true,["Patriot"] = true,["Phoenix"] = true,["Predator"] = true,["Reaper"] = true,["Sai"] = true,["Shroud"] = true,["Karak"] = true,["Lagg"] = true}
reverse_ships = {["Phoenix"] = true,["Sai"] = true,["Shroud"] = true,["Wolverine"] = true,["Basilisk"] = true,["Sabre"] = true,["Saracen"] = true}
Settings = {}
-- Various settings (modified by difficulty setting)
-- player_difficulty_factor is a bonus/malus in seconds to the duration of special features (base duration is for medium difficulty)
-- ai_difficulty_factor is a bonus/malus in percent to the duration of special features (base duration is for medium difficulty)
Settings.player_cloak_duration = 30
Settings.player_spectral_duration = 30
Settings.player_ecm_duration = 30
Settings.player_difficulty_factor = 2.0
Settings.ai_cloak_duration = 20
Settings.ai_decloak_duration = 16
Settings.ai_spectral_duration = 12
Settings.ai_nospectral_duration = 20
Settings.ai_ecm_duration = 12
Settings.ai_noecm_duration = 20
Settings.ai_random_active = 8
Settings.ai_random_inactive = 6
Settings.ai_random_chance = 65
Settings.ai_difficulty_factor = 0.2
-- Keys settings (change to your liking)
Settings.cloak_key = "Alt-Shift-F"
Settings.spectral_key = "Alt-Shift-G"
Settings.ecm_key = "Alt-Shift-Q"
function isHost()
local state = ba.getCurrentMPStatus(NIL)
if debug then gr.drawString(state) end
if state == "SINGLEPLAYER" or state == "MULTIPLAYER_MASTER" then
return true
else
return false
end
end
function SetGameVar()
if ba.getCurrentMPStatus(NIL) == "SINGLEPLAYER" then
local level = ba.getGameDifficulty()
Settings.factor_up = 1 + (level - 3) * Settings.ai_difficulty_factor
Settings.factor_down = 1 - (level - 3) * Settings.ai_difficulty_factor
Settings.player_factor = (3 - level) * Settings.player_difficulty_factor
else
Settings.factor_up = 1
Settings.factor_down = 1
Settings.player_factor = 0
end
end
function SetPlayerVar(name)
mn.SEXPVariables[name .. "_cloakremaining"] = Settings.player_cloak_duration + Settings.player_factor
mn.SEXPVariables[name .. "_spectralremaining"] = Settings.player_spectral_duration + Settings.player_factor
mn.SEXPVariables[name .. "_ecmremaining"] = Settings.player_ecm_duration + Settings.player_factor
mn.SEXPVariables[name .. "_cloaked"] = "false"
mn.SEXPVariables[name .. "_cloaktime"] = 0
mn.SEXPVariables[name .. "_decloaktime"] = 0
mn.SEXPVariables[name .. "_spectral"] = "false"
mn.SEXPVariables[name .. "_spectraltime"] = 0
mn.SEXPVariables[name .. "_nospectraltime"] = 0
mn.SEXPVariables[name .. "_ecm"] = "false"
mn.SEXPVariables[name .. "_ecmtime"] = 0
mn.SEXPVariables[name .. "_noecmtime"] = 0
mn.SEXPVariables[name .. "_isplayer"] = "true"
if debug then ba.print("Initialized player " .. name) end
end
function StorePlayerVariables(name)
mn.SEXPVariables[name .. "_cloakremaining"] = shipvar[name .. "_cloakremaining"]
mn.SEXPVariables[name .. "_spectralremaining"] = shipvar[name .. "_spectralremaining"]
mn.SEXPVariables[name .. "_ecmremaining"] = shipvar[name .. "_ecmremaining"]
mn.SEXPVariables[name .. "_cloaked"] = shipvar[name .. "_cloaked"]
mn.SEXPVariables[name .. "_cloaktime"] = shipvar[name .. "_cloaktime"]
mn.SEXPVariables[name .. "_decloaktime"] = shipvar[name .. "_decloaktime"]
mn.SEXPVariables[name .. "_spectral"] = shipvar[name .. "_spectral"]
mn.SEXPVariables[name .. "_spectraltime"] = shipvar[name .. "_spectraltime"]
mn.SEXPVariables[name .. "_nospectraltime"] = shipvar[name .. "_nospectraltime"]
mn.SEXPVariables[name .. "_ecm"] = shipvar[name .. "_ecm"]
mn.SEXPVariables[name .. "_ecmtime"] = shipvar[name .. "_ecmtime"]
mn.SEXPVariables[name .. "_noecmtime"] = shipvar[name .. "_noecmtime"]
end
function AIcloak(name)
math.randomseed(os.time())
local time = mn.getMissionTime()
local rand = math.random(1, 100)
local f1 = math.random(0, Settings.ai_random_active)
local f2 = math.random(0, Settings.ai_random_inactive)
if debug then gr.drawString("Running AIcloak on " .. name) end
if not shipvar[name .. "_decloaktime"] then
if rand <= Settings.ai_random_chance then
shipvar[name .. "_decloaktime"] = Settings.factor_up * Settings.ai_cloak_duration + f1
else
shipvar[name .. "_decloaktime"] = 0
end
end
if not shipvar[name .. "_cloaktime"] then
if rand <= Settings.ai_random_chance then
shipvar[name .. "_cloaktime"] = Settings.factor_up * Settings.ai_cloak_duration + Settings.factor_down * Settings.ai_decloak_duration + f1 + f2
else
shipvar[name .. "_cloaktime"] = Settings.factor_down * Settings.ai_decloak_duration + f2
end
end
if time <= shipvar[name .. "_decloaktime"] then
mn.runSEXP(" (ship-stealthy !" .. name .. "!) ")
elseif time > shipvar[name .. "_decloaktime"] and time <= shipvar[name .. "_cloaktime"] then
mn.runSEXP(" (ship-unstealthy !" .. name .. "!) ")
else
mn.runSEXP(" (ship-stealthy !" .. name .. "!) ")
shipvar[name .. "_cloaktime"] = shipvar[name .. "_cloaktime"] + Settings.factor_up * Settings.ai_cloak_duration + Settings.factor_down * Settings.ai_decloak_duration + f1 + f2
shipvar[name .. "_decloaktime"] = shipvar[name .. "_decloaktime"] + Settings.factor_up * Settings.ai_cloak_duration + Settings.factor_down * Settings.ai_decloak_duration + f1 + f2
end
end
function AIspectral(name)
math.randomseed(os.time())
local time = mn.getMissionTime()
local rand = math.random(1, 100)
local f1 = math.random(0, Settings.ai_random_active)
local f2 = math.random(0, Settings.ai_random_inactive)
if debug then gr.drawString("Running AIspectral on " .. name) end
if not shipvar[name .. "nospectraltime"] then
if rand <= Settings.ai_random_chance then
shipvar[name .. "nospectraltime"] = Settings.factor_up * Settings.ai_spectral_duration + f1
else
shipvar[name .. "nospectraltime"] = 0
end
end
if not shipvar[name .. "spectraltime"] then
if rand <= Settings.ai_random_chance then
shipvar[name .. "spectraltime"] = Settings.factor_up * Settings.ai_spectral_duration + Settings.factor_down * Settings.ai_nospectral_duration + f1 + f2
else
shipvar[name .. "spectraltime"] = Settings.factor_down * Settings.ai_nospectral_duration + f2
end
end
if time <= shipvar[name .. "nospectraltime"] then
mn.runSEXP(" (set-armor-type !" .. name .. "! !True! !SL-Spectral Shield! !Shields!) ")
elseif time > shipvar[name .. "nospectraltime"] and time <= shipvar[name .. "spectraltime"] then
mn.runSEXP(" (set-armor-type !" .. name .. "! !True! !SL-Standard Shield! !Shields!) ")
else
mn.runSEXP(" (set-armor-type !" .. name .. "! !True! !SL-Spectral Shield! !Shields!) ")
shipvar[name .. "spectraltime"] = shipvar[name .. "spectraltime"] + Settings.factor_up * Settings.ai_spectral_duration + Settings.factor_down * Settings.ai_nospectral_duration + f1 + f2
shipvar[name .. "nospectraltime"] = shipvar[name .. "nospectraltime"] + Settings.factor_up * Settings.ai_spectral_duration + Settings.factor_down * Settings.ai_nospectral_duration + f1 + f2
end
end
function AIecm(name)
math.randomseed(os.time())
local time = mn.getMissionTime()
local rand = math.random(1, 100)
local f1 = math.random(0, Settings.ai_random_active)
local f2 = math.random(0, Settings.ai_random_inactive)
if debug then gr.drawString("Running AIecm on " .. name) end
if not shipvar[name .. "noecmtime"] then
if rand <= Settings.ai_random_chance then
shipvar[name .. "noecmtime"] = Settings.factor_up * Settings.ai_ecm_duration + f1
else
shipvar[name .. "noecmtime"] = 0
end
end
if not shipvar[name .. "ecmtime"] then
if rand <= Settings.ai_random_chance then
shipvar[name .. "ecmtime"] = Settings.factor_up * Settings.ai_ecm_duration + Settings.factor_down * Settings.ai_noecm_duration + f1 + f2
else
shipvar[name .. "ecmtime"] = Settings.factor_down * Settings.ai_noecm_duration + f2
end
end
if time <= shipvar[name .. "noecmtime"] then
mn.runSEXP(" (turret-protect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !flak! !" .. name .. "!) ")
elseif time > shipvar[name .. "noecmtime"] and time <= shipvar[name .. "ecmtime"] then
mn.runSEXP(" (turret-unprotect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !flak! !" .. name .. "!) ")
else
mn.runSEXP(" (turret-protect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !flak! !" .. name .. "!) ")
shipvar[name .. "ecmtime"] = shipvar[name .. "ecmtime"] + Settings.factor_up * Settings.ai_ecm_duration + Settings.factor_down * Settings.ai_noecm_duration + f1 + f2
shipvar[name .. "noecmtime"] = shipvar[name .. "noecmtime"] + Settings.factor_up * Settings.ai_ecm_duration + Settings.factor_down * Settings.ai_noecm_duration + f1 + f2
end
end
function Playercloak(name)
local time = mn.getMissionTime()
if debug then gr.drawString("Running Playercloak on " .. name) end
if shipvar[name .. "_cloaked"] == "true" and tonumber(shipvar[name .. "_cloakremaining"]) > 0 then
mn.runSEXP(" (ship-stealthy !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !flak! !" .. name .. "!) ")
shipvar[name .. "_cloakremaining"] = tonumber(shipvar[name .. "_cloaktime"]) + tonumber(shipvar[name .. "_cloakremaining"]) - time
shipvar[name .. "_cloaktime"] = time
elseif shipvar[name .. "_cloaked"] == "true" and tonumber(shipvar[name .. "_cloakremaining"]) <= 0 then
mn.runSEXP(" (ship-unstealthy !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !flak! !" .. name .. "!) ")
shipvar[name .. "_cloakremaining"] = 0
shipvar[name .. "_decloaktime"] = time
shipvar[name .. "_cloaked"] = "false"
else
mn.runSEXP(" (ship-unstealthy !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !flak! !" .. name .. "!) ")
if tonumber(shipvar[name .. "_cloakremaining"]) < Settings.player_cloak_duration + Settings.player_factor then
shipvar[name .. "_cloakremaining"] = time + tonumber(shipvar[name .. "_cloakremaining"]) - tonumber(shipvar[name .. "_decloaktime"])
shipvar[name .. "_decloaktime"] = time
elseif tonumber(shipvar[name .. "_cloakremaining"]) >= Settings.player_cloak_duration + Settings.player_factor then
shipvar[name .. "_cloakremaining"] = Settings.player_cloak_duration + Settings.player_factor
end
end
StorePlayerVariables(name)
end
function Playerspectral(name)
local time = mn.getMissionTime()
if debug then gr.drawString("Running Playerspectral on " .. name) end
if shipvar[name .. "_spectral"] == "true" and tonumber(shipvar[name .. "_spectralremaining"]) > 0 then
mn.runSEXP(" (set-armor-type !" .. name .. "! !True! !SL-Spectral Shield! !Shields!) ")
shipvar[name .. "_spectralremaining"] = tonumber(shipvar[name .. "_spectraltime"]) + tonumber(shipvar[name .. "_spectralremaining"]) - time
shipvar[name .. "_spectraltime"] = time
elseif shipvar[name .. "_spectral"] == "true" and tonumber(shipvar[name .. "_spectralremaining"]) <= 0 then
mn.runSEXP(" (set-armor-type !" .. name .. "! !True! !SL-Standard Shield! !Shields!) ")
shipvar[name .. "_spectralremaining"] = 0
shipvar[name .. "_nospectraltime"] = time
shipvar[name .. "_spectral"] = "false"
else
mn.runSEXP(" (set-armor-type !" .. name .. "! !True! !SL-Standard Shield! !Shields!) ")
if tonumber(shipvar[name .. "_spectralremaining"]) < Settings.player_spectral_duration + Settings.player_factor then
shipvar[name .. "_spectralremaining"] = time + tonumber(shipvar[name .. "_spectralremaining"]) - tonumber(shipvar[name .. "_nospectraltime"])
shipvar[name .. "_nospectraltime"] = time
elseif tonumber(shipvar[name .. "_spectralremaining"]) >= Settings.player_spectral_duration + Settings.player_factor then
shipvar[name .. "_spectralremaining"] = Settings.player_spectral_duration + Settings.player_factor
end
end
StorePlayerVariables(name)
end
function Playerecm(name)
local time = mn.getMissionTime()
if debug then gr.drawString("Running Playerecm on " .. name) end
if shipvar[name .. "_ecm"] == "true" and tonumber(shipvar[name .. "_ecmremaining"]) > 0 then
mn.runSEXP(" (turret-protect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-protect-ship !flak! !" .. name .. "!) ")
shipvar[name .. "_ecmremaining"] = tonumber(shipvar[name .. "_ecmtime"]) + tonumber(shipvar[name .. "_ecmremaining"]) - time
shipvar[name .. "_ecmtime"] = time
elseif shipvar[name .. "_ecm"] == "true" and tonumber(shipvar[name .. "_ecmremaining"]) <= 0 then
mn.runSEXP(" (turret-unprotect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !flak! !" .. name .. "!) ")
shipvar[name .. "_ecmremaining"] = 0
shipvar[name .. "_noecmtime"] = time
shipvar[name .. "_ecm"] = "false"
else
mn.runSEXP(" (turret-unprotect-ship !beam! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !laser! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !missile! !" .. name .. "!) ")
mn.runSEXP(" (turret-unprotect-ship !flak! !" .. name .. "!) ")
if tonumber(shipvar[name .. "_ecmremaining"]) < Settings.player_ecm_duration + Settings.player_factor then
shipvar[name .. "_ecmremaining"] = time + tonumber(shipvar[name .. "_ecmremaining"]) - tonumber(shipvar[name .. "_noecmtime"])
shipvar[name .. "_noecmtime"] = time
elseif tonumber(shipvar[name .. "_ecmremaining"]) >= Settings.player_ecm_duration + Settings.player_factor then
shipvar[name .. "_ecmremaining"] = Settings.player_ecm_duration + Settings.player_factor
end
end
StorePlayerVariables(name)
end
function SetCloak(name)
if not shipvar[name .. "_isplayer"] then
AIcloak(name)
else
Playercloak(name)
end
end
function SetSpectral(name)
if not shipvar[name .. "_isplayer"] then
AIspectral(name)
else
Playerspectral(name)
end
end
function SetECM(name)
if not shipvar[name .. "_isplayer"] then
AIecm(name)
else
Playerecm(name)
end
end
-- Main function (Runs only on host)
function RunHost()
local ship
local class
local name
local var
local i
for i = 1, #mn.SEXPVariables do
var = mn.SEXPVariables[i]
if var:isValid() then
shipvar[tostring(var)] = tostring(var.Value)
if debug then
gr.drawString(tostring(var) .. ": " .. tostring(var.Value))
end
end
end
for i = 1, #mn.Ships do
ship = mn.Ships[i]
if ship:isValid() and ship:hasShipExploded() == 0 then
class = ship.Class
if cloak_ships[class.Name] then
name = ship.Name
SetCloak(name)
end
if spectral_ships[class.Name] then
name = ship.Name
SetSpectral(name)
end
if ecm_ships[class.Name] then
name = ship.Name
SetECM(name)
end
if class == tb.ShipClasses['Mine'] then
name = ship.Name
mn.runSEXP(" (when (> (distance !" .. name .. "! !<any friendly>!) !500!) (ship-stealthy !" .. name .. "!)) ")
mn.runSEXP(" (when (<= (distance !" .. name .. "! !<any friendly>!) !500!) (ship-unstealthy !" .. name .. "!) (alter-ship-flag !hidden-from-sensors! !True! !False! !" .. name .. "!)) ")
mn.runSEXP(" (when (<= (distance !" .. name .. "! !<any friendly>!) !100!) (self-destruct !" .. name .. "!)) ")
end
end
end
if debug then gr.drawString("Running RunHost()") end
end
-- HUD display (Runs for everyone)
function RunClient()
local player = hv.Player
local name
local class
local display
if player:isValid() and player:getBreedName() == "Ship" then
name = player.Name
class = player.Class
display = 0
if cloak_ships[class.Name] then
display = math.floor(tonumber(mn.SEXPVariables[name .. "_cloakremaining"].Value))
if mn.SEXPVariables[name .. "_cloaked"].Value == "true" then
mn.runSEXP(" (hud-set-custom-gauge-active !false! !cloak!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !cloakactive!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !cloaktime!) ")
else
mn.runSEXP(" (hud-set-custom-gauge-active !true! !cloak!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !false! !cloakactive!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !cloaktime!) ")
end
mn.runSEXP(" (hud-set-text !cloaktime! !" .. display .. "!) ")
end
if spectral_ships[class.Name] then
display = math.floor(tonumber(mn.SEXPVariables[name .. "_spectralremaining"].Value))
if mn.SEXPVariables[name .. "_spectral"].Value == "true" then
mn.runSEXP(" (hud-set-custom-gauge-active !false! !spectral!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !spectralactive!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !spectraltime!) ")
else
mn.runSEXP(" (hud-set-custom-gauge-active !true! !spectral!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !false! !spectralactive!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !spectraltime!) ")
end
mn.runSEXP(" (hud-set-text !spectraltime! !" .. display .. "!) ")
end
if ecm_ships[class.Name] then
display = math.floor(tonumber(mn.SEXPVariables[name .. "_ecmremaining"].Value))
if mn.SEXPVariables[name .. "_ecm"].Value == "true" then
mn.runSEXP(" (hud-set-custom-gauge-active !false! !ecm!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !ecmactive!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !ecmtime!) ")
else
mn.runSEXP(" (hud-set-custom-gauge-active !true! !ecm!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !false! !ecmactive!) ")
mn.runSEXP(" (hud-set-custom-gauge-active !true! !ecmtime!) ")
end
mn.runSEXP(" (hud-set-text !ecmtime! !" .. display .. "!) ")
end
if blindfire_ships[class.Name] then
mn.runSEXP(" (hud-set-custom-gauge-active !true! !blindfire!) ")
end
if reverse_ships[class.Name] then
mn.runSEXP(" (hud-set-custom-gauge-active !true! !reverse!) ")
end
end
if debug then gr.drawString("Running RunClient()") end
end
]
$On Mission Start:
[
--Reset variables
shipvar = {}
SetGameVar()
]
$On Gameplay Start:
[
local player = hv.Player
if player:isValid() and player:getBreedName() == "Ship" then SetPlayerVar(player.Name) end
]
$State: GS_STATE_GAME_PLAY
$On Frame:
[
if isHost() then RunHost() end
RunClient()
]
$State: GS_STATE_GAME_PLAY
$On Key Pressed:
[
--------------------------------------------------
--Cloak/ECM/Spectral shields script by krevett62--
--------------------------------------------------
local player = hv.Player
local name
local class
local time
if player:isValid() and player:getBreedName() == "Ship" then
name = player.Name
class = player.Class
if hv.Key == Settings.cloak_key and cloak_ships[class.Name] then
time = mn.getMissionTime()
if mn.SEXPVariables[name .. "_cloaked"].Value == "false" then
mn.SEXPVariables[name .. "_cloaktime"] = time
mn.SEXPVariables[name .. "_cloaked"] = "true"
else
mn.SEXPVariables[name .. "_decloaktime"] = time
mn.SEXPVariables[name .. "_cloaked"] = "false"
end
end
if hv.Key == Settings.spectral_key and spectral_ships[class.Name] then
time = mn.getMissionTime()
if mn.SEXPVariables[name .. "_spectral"].Value == "false" then
mn.SEXPVariables[name .. "_spectraltime"] = time
mn.SEXPVariables[name .. "_spectral"] = "true"
else
mn.SEXPVariables[name .. "_nospectraltime"] = time
mn.SEXPVariables[name .. "_spectral"] = "false"
end
end
if hv.Key == Settings.ecm_key and ecm_ships[class.Name] then
time = mn.getMissionTime()
if mn.SEXPVariables[name .. "_ecm"].Value == "false" then
mn.SEXPVariables[name .. "_ecmtime"] = time
mn.SEXPVariables[name .. "_ecm"] = "true"
else
mn.SEXPVariables[name .. "_noecmtime"] = time
mn.SEXPVariables[name .. "_ecm"] = "false"
end
end
end
]
#End