Script question

Winnyfred

Rear Admiral
Ok, I found a Mission_setFriendlyEjectPickup, is this used to make certain nav points friendly eject pickups, or the entire mission friendly eject pickup. :confused:
 
Entire mission, but you change it every nav point if you like. It's the latest setting that is used. But you only really need to set it once.
 
Here is another one for you all to solve, this time it is a cutscene:

<?xml version="1.0" encoding="UTF-8"?>
<mission name = "" sector="blue" can_eject="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="mission.xsd">
<navpoints number="1">
<navpoint numships="3" numwaves="1" name="nav1" >
<ship name="midway" comm="" autopilot="false" land="true" alignment="friend" wave="0">
<location>
<point x="2.6711185" y ="0.0" z ="-261.76962" />
</location>
<rotation>
<point x="0.0" y ="0.0" z ="0.0" />
</rotation>
</ship>
<ship name="sar" comm="" autopilot="false" alignment="friend" wave="0" scriptid="sar">
<location>
<point x="18.69783" y ="0.0" z ="-48.08013" />
</location>
<rotation>
<point x="0.0" y ="0.0" z ="0.0" />
</rotation>
</ship>
<ship name="vampire" pilot="player" comm="" autopilot="true" alignment="friend" wave="0" scriptid="player">
<location>
<point x="66.77796" y ="0.0" z ="-227.04507" />
</location>
<rotation>
<point x="0.0" y ="0.0" z ="0.0" />
</rotation>
<script oncreate="printlocation" />
</ship>
<script oncreate="nav1_create" during="nav1_during" />
</navpoint>
</navpoints>
</mission>
Now here is the cutscene part:
dofile "flightcommander.lua"

function nav1_create()
start_time = Mission_getElapsedTime();
focus = start_time + 2000
donetime = start_time + 25000
end

function mycallback()
end

function nav1_during()
now= Mission_getElapsedTime()
if not started then
if now > start_time then
Music_play("Saviour_Dead.mp3");
Cutscene_start("mycallback");
Overlay_setEnabled(true);
Overlay_setText("...Death was the price S*****r paid, but he saved hundereds.")
Ship_setAIEnabled("sar", "false")
Ship_MaxVelocity ("sar", 100.0)
Ship_SetDesiredVelocity("sar", 4.0)
Camera_setCameraType(CAMERA_AUTOPILOT)
Camera_setFocuseShip("sar")
end

else

if now > donetime then

Mission_exit()

end
end

end

What do you see wrong in it? I have checked it over and over, and FC does not see anything wrong, and it just crashes. Mabye you all see something wrong?
 
I see a couple of bugs right away:

1) You never set started to true or false. You need to take care of initializing it, then setting it after you do actually get started

2)
Ship_setAIEnabled("sar", "false")

Is wrong
The second parameter is a boolean, NOT a string.
 
eddieb, are you sure I need to say

Cutscene_start(true, "mycallback")? Because your script example doesn't do that...
 
Look at my cutsceneexample.lua. I do call Cutscene_start. Read the scripting documentation, Cutscene_start only takes 1 parameter, not 2.
 
Ok I did that and it still will not work here is an updated version:


dofile "flightcommander.lua"

function mycallback()
end

function nav1_create()
start_time = Mission_getElapsedTime();
donetime = start_time + 27000;


end

function nav1_during();
now = Mission_getElapsedTime();
if not started then
if now > start_time then
Music_play("Saviour_Dead.mp3");
Cutscene_start(true, "mycallback");
Overlay_setEnabled(true);
Overlay_setText("...Death was the price Saviour paid, but he saved hundereds.");
Ship_setAIEnabled("sar", false);
Ship_setMaxVelocity("sar", 150.0);
Ship_setDesiredVelocity("sar", 1.0);
Camera_setCameraType(CAMERA_AUTOPILOT);
Camera_setFocusShip(true, "sar");
started = true;
end

else
if now > donetime then
Mission_exit();
end
end

end

I have compared it to yours eddieb, and it looks like everything is in order, yet its still a crash to desktop, and I think it has something to do with the camera... or the disable AI, but I can't figure out what it is.
 
First: run from the command line, that may help you debug.

Everything isn't in order, you still have the wrong number of parameters for Cutscene_start and Camera_setFocusShip. You should look at my scripting documentation page to confirm this. Also, as I said before, you never initialized started.
 
Back
Top