Cephei

The official unoffical "help a fellow plugin developer" thread

Recommended Posts

 

Hello, I know this is not that much plugin related, but when I was making engine today, I wasn't sure from the wiki and other sources how do the curves. I know how to do them, but I found many post that describes them differently. The engine have to have velCurve or VelocityCurve and AtmCurve or AtmosphereCurve, also does it need to have     

atmChangeFlow = True
    useVelCurveIsp = False
    useVelCurve = True
    useAtmCurveIsp = False
    useAtmCurve = True

these ones that aren't described anywhere?

Because when I set up the engine like this 

EDIT1: Eh and now when I tried the engine, I instantly get into space and game crashes...

 

   atmosphereCurve
    {
       key = 1 9000
       key = 0.5 8000
       key = 0.3 2000
       key = 0 0
    }
    atmChangeFlow = True
    useVelCurveIsp = False
    useVelCurve = True
    useAtmCurveIsp = False
    useAtmCurve = True
    VelCurve
        {
            key = 0 1 0 0
            key = 0.174927 0.9 0 0
            key = 0.204082 0.75 0 0
            key = 0.233236 0.55 0 0
            key = 0.262391 0.25 0 0
            key = 0.276968 0 0 0
        }
    }

 So does the VelCurve have the first number in Mach or in m/s because wiki says m/s and other forum topics Mach number.... I'm simply confused so can someone please describe it for me?

Thanks!

Toonu

Edited by Toonu

Share this post


Link to post
Share on other sites

@Toonu the crash is because it's case sensitive, you want velCurve not VelCurve.  I will attempt to give an explanation of what is what in your other thread.

Share this post


Link to post
Share on other sites
11 hours ago, blowfish said:

@Toonu the crash is because it's case sensitive, you want velCurve not VelCurve.  I will attempt to give an explanation of what is what in your other thread.

Thanks, sorry for the tread but I thought it will be more visible than just post there. Thank you for any help from you. :) 

Share this post


Link to post
Share on other sites

Does anyone know if it is possible to  ADD a UI_FloatRange to an existing KSPField?  What I am trying to do is have a "advanced" mode that has a slider for a value that is normally just a Read only field for normal users. For Development I would like a slider

I found this post describing a situation close to what I am trying to accomplish but am running into a problem with a Cast exception. 

I tried the following

        [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = false, guiName = "TNT mass equivalent"),
        UI_Label(affectSymCounterparts = UI_Scene.All, controlEnabled = true, scene = UI_Scene.All)]
		public float tntMass = 1;

....
public override void OnStart (StartState state)
		{
                
            if (BDArmorySettings.ADVANCED_EDIT)
            {
              ((UI_FloatRange)Fields["tntMass"].uiControlEditor).minValue = 0f;
              ((UI_FloatRange)Fields["tntMass"].uiControlEditor).maxValue = 3000f;
              ((UI_FloatRange)Fields["tntMass"].uiControlEditor).stepIncrement = 5f;
....

It errors out with a  "System.InvalidCastException: Cannot cast from source type to destination type."

Thanks

Share this post


Link to post
Share on other sites
22 minutes ago, Benjamin Kerman said:

@gomker, I belive that you can put a tag in the KSPField


[KSPField(advancedTweakables = false, …)]
float myField;

https://kerbalspaceprogram.com/api/class_k_s_p_field.html

That can work, I would just need two fields though, I need it "seen" / readonly for regular float slider for Advanced so they developer can quickly change the field for testing.

I suppose it has to start with the UI_FloatRange

Share this post


Link to post
Share on other sites
1 hour ago, gomker said:

Does anyone know if it is possible to  ADD a UI_FloatRange to an existing KSPField?  What I am trying to do is have a "advanced" mode that has a slider for a value that is normally just a Read only field for normal users. For Development I would like a slider

I found this post describing a situation close to what I am trying to accomplish but am running into a problem with a Cast exception. 

I tried the following


        [KSPField(isPersistant = true, guiActive = true, guiActiveEditor = false, guiName = "TNT mass equivalent"),
        UI_Label(affectSymCounterparts = UI_Scene.All, controlEnabled = true, scene = UI_Scene.All)]
		public float tntMass = 1;

....
public override void OnStart (StartState state)
		{
                
            if (BDArmorySettings.ADVANCED_EDIT)
            {
              ((UI_FloatRange)Fields["tntMass"].uiControlEditor).minValue = 0f;
              ((UI_FloatRange)Fields["tntMass"].uiControlEditor).maxValue = 3000f;
              ((UI_FloatRange)Fields["tntMass"].uiControlEditor).stepIncrement = 5f;
....

It errors out with a  "System.InvalidCastException: Cannot cast from source type to destination type."

Thanks

You don't actually have a UI_FloatRange property on that field.  uiControlEditor will return the UI_Label you have defined.

Share this post


Link to post
Share on other sites

How can I play sounds from a sound file? Im trying to play a sound file but it does not work.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace NodeAlert
{
    public class SoundPlayer : MonoBehaviour
    {
        FXGroup audioSource = null;
        
        public void PlaySound()
        {
            if (!audioSource.audio.isPlaying)
            {

                if (audioSource != null)
                { 
                    
                    audioSource.audio.Play();
                    if (audioSource.audio.isPlaying)
                    {
                        Debug.Log("audio playing");
                    }
                }
            }
        }

        public void LoadSound(string FXGroupName)
        {

                audioSource = new FXGroup("alert");
                audioSource.audio = Camera.main.gameObject.AddComponent<AudioSource>();
                audioSource.audio.clip = GameDatabase.Instance.GetAudioClip("NodeAlert/files/alarm.ogg");
               
                audioSource.audio.volume = GameSettings.SHIP_VOLUME;
                Debug.Log("Loaded");
                

        }
    }
}

The LoadSound function is called by Start and the PlaySound function is called by update.

Share this post


Link to post
Share on other sites

And where do you add your MonoBehaviour to an object ?

Share this post


Link to post
Share on other sites
16 hours ago, sarbian said:

And where do you add your MonoBehaviour to an object ?

Thank you that was the problem it works now:)

Share this post


Link to post
Share on other sites

Hey guys

I'm searching for a way to access PartModule data from ships in construction (which exist as .craft file but has never been launched so not in persistent.sfs), is there something in the API that can help me ?

I guess I can manually parse each .craft file but I was wondering if those info were already stored somewhere in the game.

Share this post


Link to post
Share on other sites

Hello all

I'm trying to make an engine that runs on enriched uranium from NFE but i can't get thrust. It says EN depleted as reason for flameout but the craft has plenty. What have I missed? Is it because it's not really a fuel just a resource?

Share this post


Link to post
Share on other sites
On 1/31/2018 at 9:59 PM, Maxx said:

I'm trying to make an engine that runs on enriched uranium from NFE but i can't get thrust. It says EN depleted as reason for flameout but the craft has plenty. What have I missed? Is it because it's not really a fuel just a resource?

I'm seeing that EnrichedUranium has flowMode = NO_FLOW which means unless your engine part itself has EnrichedUranium in it, you'll get the EN depleted message because the engine can't draw any.

Edited by Booots

Share this post


Link to post
Share on other sites

Sweet thank you I'll see if I get it to fire later today!

Edit - It worked but I can't refuel it... Is there a way to Change the "FlowMode" within the engine or would I have to change the resource itself? I want to be able to mine and refuel the craft with said engine...

 

2nd edit - nevermind I missed the module to transfer fuel right above the tank part...sigh.

Edited by Maxx
Half blind.... it's funny cause I realy have one eye!

Share this post


Link to post
Share on other sites

Everything works with the engine. But I've got a weird thing on reentry the overheat meter on the engine panel (left) is tiny and just a letter C. When I mouse over it says text missing or some such (on phone can't see exact spelling) its by no means critical, the hovering part temp meter works still. Thoughts?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now