Iceblade's lua question

Thanks, finally got part of it to work. Still don't know about the within distance function since I know I am not within 1000 klicks (WC slang apparently for one unit or meter), game units, meters, whatever you want to call it.

I have another problem, though. I have objectives that are set to primary, yet don't register as such. Is this because there is something in the script code that I have to do for them to be in the primary field or what?

Also what units is time in, milliseconds?

Also, do you have anything planned for nav buoys?

Just an FYI, there are several ship2d images that don't have pure black backgrounds, which makes them have a green background in the hud. Currently I have only found the pelican and the manta? I'll be on the lookout for more and send you the altered image files.

Later

PS Did you get the week off for Christmas?
 
Well, you have a multipler of 10 for your distance function, 300 is 3000 in game.

Now I have a code that doesn't make any sense why it doesn't work. I have a function that is in the on destroy of all of my enemies and it does not initiate (I know this because it did not print anything).

Then I had this crazy idea that it might be because not one of my enemies has a in script name. That fixed the problem. Why did this hinder the function being called?
 
Even though the shipid is not invoked in the lua script...that we see. Gotcha.

Oh, what is required to set an objective to be primary or secondary? Is there something that has to be set in the code or is this something that the mission editor is supposed to be able to do?
 
Iceblade said:
Oh, what is required to set an objective to be primary or secondary? Is there something that has to be set in the code or is this something that the mission editor is supposed to be able to do?

Both should work.
 
For some reason, the game is ignoring the fact that two of my objectives are set to primary.

Say, how can you tell an objective to be primary or secondary in a mission lua?
 
It is set to primary in the mission editor, yet I finish the mission and it is set to secondary. I'll send over the latest incarnation.
 
You're right, you can't set the primary/secondary from lua.

I confirmed secondary stuff works, look at your mission.xml file. You should see something like this

<objectives>
<objective name="Destroy all fighters" category="primary" default="complete" />
<objective name="Destroy all fighters in time" category="secondary" default="failed" />
</objectives>


So make sure your categories are setup like above for primary or secondary. The mission editor should generate something like this.

Another thing that might be tricky is to put the primary ones first, then do the secondary ones.
 
I specifically checked for that in the mission xml in notepad, it read the same with 2 primary and 2 secondary objectives.

obj0 - primary
obj1 - secondary
obj2 - seconary
obj3 - primary

all are reported as secondary at the end of the mission.
 
Again, its a spelling problem. Primary has to be spelled primary. This was a bug in the mission editor, so I've posted a new one (zip and jar). Apparently the order doesn't matter as I thought before.

By the way, this

if(targettime) then

is wrong. Think about why.
 
Found the solution to that in another mission I was doing dealing with defeating an enemy in a limited amount of time or else the player loses. I didn't even really realize that that targettime thing wasn't working until I was playing with this other mission. Thanks for finding that issue with the editor.

No more bugs, currently with my script/mission.
 
Hey, why is finishcount becaming true when my speed is greater than 200 game units?

Does the value from Ship_getSpeed not the exact speed seen in the mission?

function Home()
land = true;
end

function Land()
currentspeed = Ship_getSpeed("Player")
if(land and currentspeed < 200) then
finishcount = true;
land = false;
end

if(finishcount and Ship_isWithinRange("Player", "Relentless", 300)) then
finishcount = false;
Mission_doLanding();
end
end

edit: speeds have a multipler of 10, so if your in-game speed is 470, the value returned from the getspeed function is 47.
 
Back
Top