Attachments in Spacecraft3 ini files

tgep

Tutorial Publisher
Tutorial Publisher
Joined
Apr 3, 2008
Messages
510
Reaction score
0
Points
0
Location
Next to the Stennis Space Center
It's a noob question I know but here goes. I searched through prior posts and found nothing in a similar vein soooooooo...

I'm building a vessel with three interior hangar bays. I'd like to use attachment points instaed of docking points to land vessels inside the bays. Docking points add to vessel mass which makes the bigger ship more sluggish and much harder to control.

When Writing the attachment points in the .ini file, should the bay points be writtin as [CHILD_ATTACH] or should they be [PARENT_ATTACH] ?
I've read Vinka's PDF but it's almost deliberately ambigous as to which should be used for what !
 

n0mad23

Addon Developer
Addon Developer
Joined
Feb 10, 2008
Messages
1,078
Reaction score
17
Points
0
Location
Montesano
Website
soundcloud.com
The parent is what's being attached to, the child does the attaching.

So you want Parent attachment's here.
 

tgep

Tutorial Publisher
Tutorial Publisher
Joined
Apr 3, 2008
Messages
510
Reaction score
0
Points
0
Location
Next to the Stennis Space Center
Many thanks for a quick responce ! It seams obviouse now but after reading so many PDF files and testing new modules, me brain gets a bit scrambled.
 

n0mad23

Addon Developer
Addon Developer
Joined
Feb 10, 2008
Messages
1,078
Reaction score
17
Points
0
Location
Montesano
Website
soundcloud.com
We were experiencing parallel problems, only I was an hour or two ahead of you. My brain does the same thing while I'm testing things, and find that posting the question can be the best course.

Isn't the exchange of information here a wonderful thing?
 

Topper

Addon Developer
Addon Developer
Donator
Joined
Mar 28, 2008
Messages
666
Reaction score
20
Points
33
Oh my brain was exploded when i have tried to attach and detach some missiles for my missile add-on in a "for" loop, principal it was a "for each" loop . I admit, i solved the problem by using the good old but reliable method of "try and error". (sorry i am not an ideal). Oh, i am not sure i have set the child's and parents right, but it is working.

ps.
here is the code if it can help you...

Code:
void AAMissileMFD::LoadPayload()
{
    //oapiSetPause(true);
    //const int MAXMISSILES = 4;
    OBJHANDLE hAimVessel[MAXMISSILES];
    MissileToFire=0;
    
    
    
    VESSEL *FocusedVessel=oapiGetFocusInterface(); //oapiGetFocusInterface();

    //Get the attach points of the carrier aircraft (K'33 F15)
    parser myparser;
    if (FocusedVessel->GetClassName()!=NULL)
    {
        MissileCount = myparser.GetParamStruct(FocusedVessel->GetClassName());
        
    }
    else return;
    if (MissileCount == 0) return;

    VECTOR3 m1offset[MAXMISSILES];
    for (int lauf = 0; lauf < MissileCount; lauf++)
    {
        m1offset[lauf].x = ATT_CFG[lauf].x;
        m1offset[lauf].y = ATT_CFG[lauf].y;
        m1offset[lauf].z = ATT_CFG[lauf].z;
    }

    const VECTOR3 Keiner = {0,0,1};
    const VECTOR3 ReleaseDir = {0,1,0};
    VESSEL *AimVessel[2];
    
    VESSELSTATUS VS;
    
    FocusedVessel->GetStatus(VS);

    if (FocusedVessel->GetClassName() == NULL) return;
    if (strcmp(FocusedVessel->GetClassName(),"AAMissile")== 0) return;


    //Creating missile vessels with it's names, attachmend points and attach the missile to this points
    for (lauf = 0; lauf != MissileCount; lauf++)
    {
        char MissileName[64];
        char* CarrierStr = FocusedVessel->GetName();
        char Strnumber[64];

        sprintf(Strnumber,"%i",lauf+1);
        strcpy(MissileName,CarrierStr);
        strcat(MissileName,"-AA-Missile-");
        strcat(MissileName,Strnumber);
        if (oapiGetObjectByName(MissileName) == NULL) //Create missile only if the name not exist
        {
            hAimVessel[lauf] = oapiCreateVessel(MissileName,"AAMissile", VS);
            AimVessel[lauf] = oapiGetVesselInterface(hAimVessel[lauf]);
            //Create Attachments on carrier only if they wheren't created before
            if (FocusedVessel->AttachmentCount(false) != MissileCount)
            {
                AtF151A[lauf] = FocusedVessel->CreateAttachment(false,m1offset[lauf],ReleaseDir,Keiner,"A",true);
            }
            AtAim[lauf] = AimVessel[lauf]->CreateAttachment(true,Keiner,ReleaseDir,Keiner,"A",true);
            AimVessel[lauf]->SetThrusterGroupLevel(THGROUP_MAIN,0);    
            FocusedVessel->AttachChild(hAimVessel[lauf],AtF151A[lauf],AtAim[lauf]);
        }
        
    }    
}
 
Top