Wing Commander CIC

Here is my full lua script:

dofile "flightcommander.lua"

killed = 0
identified = 0

function cratedestroy()
killed + 1
end

function begin()
Mission_setScriptControl(true)
Mission_setAutopilotEnabled(true)
end

function nav1()
Mission_setAutopilotEnabled(false)
Ship_setCargo(Ms-c4, "Marijuana");
Ship_setCargo(Ms-c2, "Food");
Ship_setCargo(Ms-c3, "Food");
Ship_setCargo(Ms-c1, "Organic Weapons");
if(Ship_isCargoIdentified(Ms-c1) ) then
Ship_setIff(Ms-c1, IFF_ENEMY);
Mission_setEnemiesAreAlive(true)
identified + 1
end
if(Ship_isCargo_Identified(Ms-c2) ) then
Ship_setIff(Ms-c2, IFF_FRIEND);
identified + 1
end
if(Ship_isCargo_Identified(Ms-c3) ) then
Ship_setIff(Ms-c3, IFF_FRIEND);
identified + 1
end
if(Ship_isCargo_Identified(Ms-c4) ) then
Ship_setIff(Ms-c4, IFF_ENEMY);
identified + 1
end
if(Ship_getNumTurrets(Ms-c4) == 0) then
Ship_setIff(Ms-c4, IFF_NEUTRAL);
killed + 1
end
if killed == 2 then
Mission_setAutopilotEnabled(true)
Mission_setEnemiesAreAlive(false)
Mission_setComplete();
Objective_setState(1, OBJECTIVE_COMPLETE)
end
if identified == 4 then
Objective_setState(0, OBJECTIVE_COMPLETE)
end
end

Can you please help me because I am trying to get the mission to work properly.

There is three cargo containers at nav 1

There is also a cargo ship at nav 1

The cargo ship and also one cargo container have illegal cargo (Marijuana and Organic weapons)

When you get there, you will not be able to autopilot

When you identify the cargo ship, it turns evil and enemies in the navpoint are toggled true

When you disable the cargo ship, it turns neutral

When you destroy the cargo box, nothing happens, except a value should be added to a variable (killed)

When you have destroyed the cargo box and disabled the cargo ship, an objective should be completed.

Each time you identify a cargo box/ship, a value should be added to a variable (identified)

That variable also deals with an objective. When you have identified the cargo of everything, an objective should be completed

The two cargo boxes that contain food should turn friendly when you identify their cargo.

Remember that I am a programmer in training. I don't understand Lua like you do. Please help me out

BTW it does not work in game:eek:
Back
Top