# Programming QuestionMaking a module-file for a spacecraft

#### Pinguinboy

##### 50.000 years old lifeform
Hello, I was wondering how to make a module-file for a spacecraft that you can't select from the scenario-editor. Well, I searched on Orbiter Hangar, but I found no tutorials for it.
So, does someone know how to make these module-files for a spacecraft?

P.S: Sorry if there was already a thread like this, I'm not very much online here

#### Moach

##### Crazy dude with a rocket
check the addon development board - there are tutorials stickied in there :thumbup:

#### Pinguinboy

##### 50.000 years old lifeform
Thanks Moach, I'm checking right now

#### orb

I was wondering how to make a module-file for a spacecraft that you can't select from the scenario-editor.

I don't know if you find a tutorial that will tell you how to hide a vessel from the scenario editor.

You can hide a vessel from gaining focus, but it still will be visible in the scenario editor, by adding this to its configuration file:
Code:
EnableFocus = FALSE

#### martins

##### Orbiter Founder
Orbiter Founder
You can't hide vessels from being listed by the scenario editor, but you can prevent a vessel type from being listed in the editor's "new vessel" page by setting
Code:
EditorCreate = FALSE
in the def file.

#### Moach

##### Crazy dude with a rocket
could one not have further vessels "hidden" inside a single module? - it would be useful for spawning debris and such... although i figure there's probably a better way of doing that, no?

#### orb

could one not have further vessels "hidden" inside a single module?
There is a way of doing it from a plug-in module, but it requires hooking the oapiGetVesselCount and oapiGetVesselByIndex, that will return the count decreased by the number of hidden vessels via API, and a vessel's object handle with appropriately changed index (array of vessels wouldn't be changed at all, but it would be filtered out of hidden vessels by changed oapiGetVesselByIndex function). The used by Orbiter internal count and array of vessels wouldn't be changed, because Orbiter doesn't use these API functions internally, but those arrays and counters are accessed directly.

#### computerex

could one not have further vessels "hidden" inside a single module? - it would be useful for spawning debris and such... although i figure there's probably a better way of doing that, no?

Do you mean more then one vessel from a single module? You can create some generic debris.dll, then simply change the mesh in the cfg file. Or have that debris.dll pick a random mesh and scale accordingly. For the orbDamage module (unreleased) when a vessel breaks, I create debris pieces and set their size so that their sum would equal the size of the broken vessel. I have one wreck.dll that picks a random debris mesh, and scales it according to its size.

OR:

You can define multiple vessel classes in your module, then check the classname of the vessel being created:

Code:
DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
char cname[512];
// oapiGetVesselInterface will return NULL at this point, so do this
strcpy(cname, VESSEL(hvessel).GetClassName());
if ( !strnicmp(cname, "ShuttlePB", 9))
return new ShuttlePB(hvessel, flightmodel);
else
return new EmptyPB(hvessel, flightmodel);
return 0;
}

cfg file for EmptyPB:

Code:
; === Configuration file for vessel class EmptyPB ===
ClassName = EmptyPB
Module = ShuttlePB

Last edited:

#### Moach

##### Crazy dude with a rocket
wait did you say "orbDamage"? :blink:

i can see this going violently off-topic from here on :hail: