Toonu Posted December 17, 2017 Share Posted December 17, 2017 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. Quote Link to comment Share on other sites More sharing options...
gomker Posted December 20, 2017 Share Posted December 20, 2017 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 Quote Link to comment Share on other sites More sharing options...
Benjamin Kerman Posted December 20, 2017 Share Posted December 20, 2017 @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 Quote Link to comment Share on other sites More sharing options...
gomker Posted December 20, 2017 Share Posted December 20, 2017 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 Quote Link to comment Share on other sites More sharing options...
blowfish Posted December 20, 2017 Share Posted December 20, 2017 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. Quote Link to comment Share on other sites More sharing options...
NepalRAWR Posted January 9, 2018 Share Posted January 9, 2018 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. Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 9, 2018 Share Posted January 9, 2018 And where do you add your MonoBehaviour to an object ? Quote Link to comment Share on other sites More sharing options...
NepalRAWR Posted January 10, 2018 Share Posted January 10, 2018 16 hours ago, sarbian said: And where do you add your MonoBehaviour to an object ? Thank you that was the problem it works now Quote Link to comment Share on other sites More sharing options...
Li0n Posted January 12, 2018 Share Posted January 12, 2018 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. Quote Link to comment Share on other sites More sharing options...
Maxx Posted February 1, 2018 Share Posted February 1, 2018 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? Quote Link to comment Share on other sites More sharing options...
Booots Posted February 7, 2018 Share Posted February 7, 2018 (edited) 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 February 7, 2018 by Booots Quote Link to comment Share on other sites More sharing options...
Maxx Posted February 7, 2018 Share Posted February 7, 2018 (edited) 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 February 10, 2018 by Maxx Half blind.... it's funny cause I realy have one eye! Quote Link to comment Share on other sites More sharing options...
Maxx Posted February 12, 2018 Share Posted February 12, 2018 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? Quote Link to comment Share on other sites More sharing options...
severedsolo Posted March 4, 2018 Share Posted March 4, 2018 Does anyone know how to access a parts "friendly name" - ie for instance "LV-909 "Terrier" Liquid Fuel Engine" rather than just "liquidEngine3"? part.name returns the model name (liquidEngine3) - part.partName just returns "Part" and part.InternalModelName doesn't return anything at all. Quote Link to comment Share on other sites More sharing options...
sarbian Posted March 4, 2018 Share Posted March 4, 2018 2 hours ago, severedsolo said: Does anyone know how to access a parts "friendly name" - ie for instance "LV-909 "Terrier" Liquid Fuel Engine" rather than just "liquidEngine3"? part.name returns the model name (liquidEngine3) - part.partName just returns "Part" and part.InternalModelName doesn't return anything at all. It should be part.partInfo.title Quote Link to comment Share on other sites More sharing options...
katateochi Posted March 7, 2018 Share Posted March 7, 2018 Hey guys, I'm updating the KerbalX mod for 1.4.0, it uses UnityWebRequest and in KSP 1.3.1 I could call .isError on an instance of UnityWebRequest, but in 1.4.0 that method doesn't exist, but instead I can use .isNetworkError or .isHttpError. I could just make that change but then the latest version of the mod won't be backwards compatible with 1.3.1 and as it's just this one change I'd prefer to maintain a single version that supports 1.3.1 and 1.4.0. Is there anyway to say something like; bool request_error = false; try{ request_error = request.isNetworkError; }catch{ request_error = request.isError; } That won't compile against either version, but is there some cunning C# way of checking if a method exists before trying to call it and if not falling back to another method? Quote Link to comment Share on other sites More sharing options...
katateochi Posted March 8, 2018 Share Posted March 8, 2018 Another question: It seems that textures used for this like the icon in the toolbar are now affected by the texture quality setting. In 1.3.1 with the texture quality set to half res or full res the toolbar icons looked the same. In 1.4.0 with texture quality at half res the toolbar icons are, well, at half res. Is this intentional? is there a way to disregard the texture quality setting for a specific texture? Quote Link to comment Share on other sites More sharing options...
sarbian Posted March 8, 2018 Share Posted March 8, 2018 9 hours ago, katateochi said: I'd prefer to maintain a single version that supports 1.3.1 and 1.4.0. Both versions uses a different Unity engine and it s not just a minor upgrade. Have different versions for 1.3 and 1.4. Some Unity calls changed their signature and while they compile without changes they will not work on both version. Quote Link to comment Share on other sites More sharing options...
katateochi Posted March 8, 2018 Share Posted March 8, 2018 3 hours ago, sarbian said: Both versions uses a different Unity engine and it s not just a minor upgrade. Have different versions for 1.3 and 1.4. Some Unity calls changed their signature and while they compile without changes they will not work on both version. I did find a (rather messy) way using reflection to see if a method exists and then call accordingly, but that just raised further problems and resulted in clunky code pasta, so yes, I'll take your advice and have different versions. Thanks! Quote Link to comment Share on other sites More sharing options...
nightstalker101s Posted March 14, 2018 Share Posted March 14, 2018 (edited) I have looked through so much of the modding tutorials and API on doxygen. I have a few questions as I am really interesting in creating a mod that will hopefully add some very interesting features to the game. 1. I get the feeling that I need some .dll file in the actual KSP game folder somewhere to create a plugin. Where do I find it? 2. If (1) is true, will monodeveloper in Unity3D see the namespaces, classes, and variables allowing me to create my plugin directly in Unity3d? By this I mean when I type "KSPclass." Mono will give me all the options in that specific class. 3. Which Unity version is the current build for KSP after 1.4.1 (Unity3d 2017 1.3f1)? Background: I have created a game in Unity and released it back in 2014ish. I am a beginner to intermediate level self taught C# and C++ programmer (with some knowledge of JavaScript). I will not be asking anyone to do anything for me which includes writing scripts for me since I am perfectly capable and excited about doing it myself. I may have some questions about how to access KSP classes and variables appropriately. If anyone is willing to work with a KSP modding noob on a PM basis for silly basic questions I would appreciate it. Also, I am tracking all the current EULA issues. Edited March 14, 2018 by nightstalker101s Grammatical Error, Found an Answer Quote Link to comment Share on other sites More sharing options...
Next_Star_Industries Posted March 14, 2018 Share Posted March 14, 2018 (edited) 4 hours ago, nightstalker101s said: I have looked through so much of the modding tutorials and API on doxygen. I have a few questions as I am really interesting in creating a mod that will hopefully add some very interesting features to the game. 1. I get the feeling that I need some .dll file in the actual KSP game folder somewhere to create a plugin. Where do I find it? 2. If (1) is true, will monodeveloper in Unity3D see the namespaces, classes, and variables allowing me to create my plugin directly in Unity3d? By this I mean when I type "KSPclass." Mono will give me all the options in that specific class. 3. Which Unity version is the current build for KSP after 1.4.1 (Unity3d 2017 1.3f1)? Background: I have created a game in Unity and released it back in 2014ish. I am a beginner to intermediate level self taught C# and C++ programmer (with some knowledge of JavaScript). I will not be asking anyone to do anything for me which includes writing scripts for me since I am perfectly capable and excited about doing it myself. I may have some questions about how to access KSP classes and variables appropriately. If anyone is willing to work with a KSP modding noob on a PM basis for silly basic questions I would appreciate it. Also, I am tracking all the current EULA issues. 1. KSP_x64_Data folder 2. no 3.yes Edited March 14, 2018 by Next_Star_Industries Quote Link to comment Share on other sites More sharing options...
DMagic Posted March 14, 2018 Share Posted March 14, 2018 @nightstalker101s If you are asking if you can add a reference to a KSP dll to a Unity project (for use in the Unity Editor) then the answer is no. Unity just won't load anything with a reference to KSP's Assembly-CSharp.dll (I think maybe this is because of some kind of circular referencing, or it just doesn't accept a reference to a dll that was made in Unity). For a regular C# project you can do that, but for anything to be used in the Unity Editor it won't work. You can create a new project with custom scripts imported into Unity, but for it to work I think you have to create it outside of Unity (ie don't add scripts directly through your Unity project, instead make an assembly, compile it, and import the .dll into your Unity project), then you can use it for anything you make in Unity (like a UI). But that assembly can't contain any references to any KSP assemblies, which makes everything a pain to work with. There is a tutorial for how to work-around this for a UI, it's not that hard, mostly just tedious: Quote Link to comment Share on other sites More sharing options...
ByteArts Posted March 14, 2018 Share Posted March 14, 2018 (edited) I'm just getting started with a project that will use a mobile device to interact with KSP via a socket connection and kRPC. I'm using the socket interface because I can't use the provided client framework (at least not easily) on all the different platforms I'm targeting (iOS, Android, macOS, and Windows). I already have working code (in Delphi on Windows, Mac, Android and iOS) that makes the connection to kRPC and processes the protocol buffer data, but am having problems figuring out the next steps, namely how to figure out the names of the other available services and procedures that can be accessed using the socket interface in kRPC. I've tried using the KRPC.GetServices procedure, but it returns over 300KB of data -- is there a way to just enumerate the available services first, and then query them individually to get more info? Any info, advice, or comments are welcome. Thanks! Edited March 15, 2018 by ByteArts Quote Link to comment Share on other sites More sharing options...
sarbian Posted March 15, 2018 Share Posted March 15, 2018 You are more likely to get an answer in kRPC thread than here. Quote Link to comment Share on other sites More sharing options...
ByteArts Posted March 15, 2018 Share Posted March 15, 2018 Thanks -- I was looking for that. The link to the kRPC forum from the kRPC git page is broken. 5 hours ago, sarbian said: You are more likely to get an answer in kRPC thread than here. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.