Jump to content

Recommended Posts

Hello everyone, so I love KSP and I decided to create my own science mod, and I have the texture, and the 3d modelling but I have one probleme, this is the C code, I saw the code of Dmagic or the code of other science mod but, like I am a begniner in mod in KSP,I don't understand the C code of their parts. today, I would like what my part can have a point of science (just that) and be able to see my new part.

 

If someone can help me in the C code or explaine me, it will be very sympathetic.

 

thank you.

Link to comment
Share on other sites

You don't have to touch the actual code at all to make a new science experiment part.   Everything you should need is in the .cfg file for the part. :)  I'd go ahead and get your part through unity and into the game with a working .cfg file (follow the basic part tutorials - they're all the same!)  then you just need to add the experiment module to that cfg file. 

Something like:

MODULE
    {
        name = ModuleScienceExperiment
        experimentID = MYEXPERIMENT
        experimentActionName =  Perform Experiment
        resetActionName = Reset Experiment
        useStaging = False
        useActionGroups = True
        hideUIwhenUnavailable = True
        xmitDataScalar = 0.3
        FxModules = 0
        dataIsCollectable = True
        collectActionName =  Collect Data
        rerunnable = True
        interactionRange = 1.5
        usageReqMaskInternal = 1
        usageReqMaskExternal = 8
    }

Link to comment
Share on other sites

GREATE THANKS TO YOU, REALLY. So I have one probleme and this is the mesh collider, because I colliade anythings sniff but my part is in KSP !!!!!!!

 

http://www.noelshack.com/2017-25-3-1498071115-opa.png

 

Yeah, I know for the texture but it is a pre-alpha-alpha lol

 

Il hope I can continue in this way.

 

Link to comment
Share on other sites

Just a quick caution as I didn't see it posted above, if you use 'MYEXPERIMENT' in your config (or whatever you want to call it) and its not a Stock experiment, you will need to add 'MYEXPERIMENT' to the science definitions, example: 

{	
	id = MYEXPERIMENT
	title = A Custom Mod Experiment
	baseValue = 5
	scienceCap = 10
	dataScale = 1
	requireAtmosphere = False
	situationMask = 1
	biomeMask = 1
	RESULTS
	{
	default = An accurate reading of the local Custom Science Data is recorded.
	default = Local variations in the Custom Science Data are observed.
	}
}

There is a vast wall of text that is the RESULTS, basically you need to populate an answer based on where you can collect data. after the default responses there is an equivalent for every biome (see DMagic's repo or Stock Science Definitions for examples, there are a lot).

Also you can tweak the baseValue and scienceCap values to suite your needs.

Link to comment
Share on other sites

I decided to use a 5000*5000 (economical lol) because, I have shape which are very small, bu very, very, very small.

I will finish the txture and use unity.

So, for the momment it this

 

Link to comment
Share on other sites

SO, I have a question for the cfg config.

 

PART
{
    name = Horloge Cezium 231
    module = Part
    author = Oursshinigami
    mesh = HorlogeCezium.mu
    scale = 0.1
    node_stack_top = 0.0, 1, 0.0, 0.0, 1.0, 0.0
    node_stack_bottom = 0.0, -1, 0.0, 0.0, -1.0, 0.0
    node_attach = 0.0, 0.0, 1, 1.0, 0.0, -90.0, 1
    TechRequired = scienceTech
    entryCost = 40000
    cost = 40000
    category = Science
    subcategory = 0
    title = Horloge Cezium 231
    manufacturer = Oursshinigami
    description = NOTHING FOR THE MOMENT
    attachRules = 1,0,1,0,0
    mass = 1
    dragModelType = default
    maximum_drag = 0.2
    minimum_drag = 0.3
    angularDrag = 2
    crashTolerance = 50
    maxTemp = 1200 // = 2900
    breakingForce = 50
    breakingTorque = 50
    childStageOffset = 1
    bulkheadProfiles = size1
    tags = experiment research


    MODULE
    {
        name = Horloge Cezium 231

        experimentID = Horloge Cezium 231

        experimentActionName = Analyse's Time
        resetActionName = Reset Materials Bay
        useStaging = False
        useActionGroups = True
        hideUIwhenUnavailable = True
        hideFxModuleUI = False
        xmitDataScalar = 0.35
        FxModules = 0
        dataIsCollectable = True
        collectActionName = Collect Data
        interactionRange = 1.85
        usageReqMaskExternal = 8
        
    }
}

 

the cfg don't work but I don't understand where is the probleme, if you can help me please.

Link to comment
Share on other sites

What ? (I stupid, it is normal) I don't understant.

Can you use the cfg who I create and change the probleme (like this (I m really visual) I can understand) or an exemple.

And sorry for my stupiditie in this code cfg.

Edited by Ourshinigami
Link to comment
Share on other sites

8 minutes ago, Ourshinigami said:

What ? (I stupid, it is normal) I don't understant.

Can you use the cfg who I create and change the probleme (like this (I m really visual) I can understand) or an exemple.

And sorry for my stupiditie in this code cfg.

PART
{
    name = Horloge Cezium 231
    module = Part
    author = Oursshinigami
    mesh = HorlogeCezium.mu
    scale = 0.1
    node_stack_top = 0.0, 1, 0.0, 0.0, 1.0, 0.0
    node_stack_bottom = 0.0, -1, 0.0, 0.0, -1.0, 0.0
    node_attach = 0.0, 0.0, 1, 1.0, 0.0, -90.0, 1
    TechRequired = scienceTech
    entryCost = 40000
    cost = 40000
    category = Science
    subcategory = 0
    title = Horloge Cezium 231
    manufacturer = Oursshinigami
    description = NOTHING FOR THE MOMENT
    attachRules = 1,0,1,0,0
    mass = 1
    dragModelType = default
    maximum_drag = 0.2
    minimum_drag = 0.3
    angularDrag = 2
    crashTolerance = 50
    maxTemp = 1200 // = 2900
    breakingForce = 50
    breakingTorque = 50
    childStageOffset = 1
    bulkheadProfiles = size1
    tags = experiment research


    MODULE
    {
        name = ModuleScienceExperiment

        experimentID = Horloge Cezium 231

        experimentActionName = Analyse's Time
        resetActionName = Reset Materials Bay
        useStaging = False
        useActionGroups = True
        hideUIwhenUnavailable = True
        hideFxModuleUI = False
        xmitDataScalar = 0.35
        FxModules = 0
        dataIsCollectable = True
        collectActionName = Collect Data
        interactionRange = 1.85
        usageReqMaskExternal = 8
        
    }
}

 

The bold part is what I was talking about in my last post

Link to comment
Share on other sites

so now I have this probleme

 and the new cfg is that (I can, finally, take data :) )

 PART
{
    name = Horloge Cezium 231
    module = Part
    author = Oursshinigami
    mesh = HorlogeCezium.mu
    scale = 2
    node_stack_top = 0.0, 1, 0.0, 0.0, 1.0, 0.0
    node_stack_bottom = 0.0, -0.6, 0.0, 0.0, -1.0, 0.0
    node_attach = 0.0, 0.0, 1, 1.0, 0.0, -90.0, 1
    TechRequired = scienceTech
    entryCost = 40000
    cost = 40000
    category = Science
    subcategory = 0
    title = Horloge Cezium 231
    manufacturer = Oursshinigami
    description = NOTHING FOR THE MOMENT
    attachRules = 1,0,1,1,0
    mass = 10
    dragModelType = default
    maximum_drag = 0.2
    minimum_drag = 0.2
    angularDrag = 1
    crashTolerance = 50
    maxTemp = 1200 // = 2900
    breakingForce = 50
    breakingTorque = 50
    childStageOffset = 1
    bulkheadProfiles = size1
    tags = experiment research

   MODULE
    {
        name = ModuleScienceExperiment
        experimentID = mobileMaterialsLab
        experimentActionName = Analyse's Time
        resetActionName = Reset Analyse's Time
        useStaging = False
        useActionGroups = True
        hideUIwhenUnavailable = True
        hideFxModuleUI = False
        xmitDataScalar = 0.35
        FxModules = 0
        dataIsCollectable = True
        collectActionName = Collect Data
        interactionRange = 1.85
        usageReqMaskInternal = 1
        usageReqMaskExternal = 8
    }

 

What does change so as to have two point (Green spheres) in the middle ?

 

Link to comment
Share on other sites

The problem is that KSP uses a z-up reference frame. Try replacing the nodes with the stuff below (I just switched the second/third and fifth/sixth terms)

node_stack_top = 0.0, 0.0, 1.0, 0.0, 0.0, 1.0
node_stack_bottom = 0.0, 0.0, -0.6, 0.0, 0.0, -1.0

This is a useful tool for setting up nodes.

Link to comment
Share on other sites

So, it isn't this

node_stack_top = 0.0, 0.0, 1.0, 0.0, 0.0, 1.0
node_stack_bottom = 0.0, 0.0, -0.6, 0.0, 0.0, -1.0

 

But thanks for the NodeHelper, I think what I will use this, it will be easy with this.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...