Jump to content

Zyrac

Members
  • Posts

    75
  • Joined

  • Last visited

Everything posted by Zyrac

  1. So, I believe I've found a fix. I experimented with extruding the window faces a little and it seems to have made the problem go away. I've still no idea what caused the problem in the first place or why extruding the faces fixed it, but I suppose all that matters is that it did. EDIT: Well, it certainly mitigated the problem slightly, but it's not fixed, and in some cases it didn't really make any difference at all. What's weird is that the problem seems to be created between Unity and KSP, since there don't seem to be any signs of it in Blender or in Unity scene view.
  2. Well, I'm really at a loss. I tried the Unity fix, but the issue persists. What I don't understand is where exactly the problem is occurring. This is the original mesh in Blender (as you can see, there are no edges running across the faces where the issues appear):
  3. So, I'm making a habitat module thing, and I noticed a weird thing that happens when the part's in the dark. Some weird shadowy shape things appear on it that aren't visible in the VAB or when it gets light. Any idea what's going on? You can see them on the roof and window in the first image, and that they're gone in the second.
  4. Uh, sadly the answer to both those questions is currently no. It could very easily contain fuel with a change to the config file, however. I did play with the idea but ended up deciding against it. I guess I kinda thought it was doing a little too much with it, but I suppose it is sizable enough. To be honest, I was mainly using this as a trial part before attempting something more ambitious. I'm now working on a habitat module which means straying into internals territory for the first time. Little preview of the work in progress below:
  5. Tired of desperately trying to cram everything onto your probe? We've got you covered. The R-Universe Industries Probe Core features special landing leg placement areas, special slots suited perfectly to fit small radial solar panels (although I suppose you could put any old thing there), and special... uh... just space in general for putting stuff on! Hey, so I wanted to have another go at some modding, since I haven't done any in years. If you were on the KSP scene around 2012 - 2013, you might remember a rudimentary mod called R-Universe Industries Life-Tech. Since then, I've started university and am now coming close to graduation, and grown a beard! How time flies! So, anyway, this probe core is just a little something I made as a bit of fun to apply my new and improved Blender skills, and my not so new and improved texturing skills. Let me know if you have any suggestions! DOWNLOAD HERE: https://kerbal.curseforge.com/projects/r-universe-industries-probe-core
  6. Yeah, my bad, got my sentence mixed up haha! I'll try your advice and play around with multiple colliders. Thanks!
  7. Ah, I thought it might be that. I read on a tutorial site that mesh colliders have to be concave for them to work in KSP, but would it work fine if it were convex?
  8. So, I'm back on the KSP modding scene after years of inactivity, and I'm putting my newly acquired Blender knowledge to use in making what's essentially going to be a handy probe core. One issue I'm facing, however, is that I want the player to be able to attach things to the surface, but the surface of the part is irregular. KSP doesn't seem to like this. I'm attaching a screenshot with a radial solar panel just to show you what I mean. As you can see, the solar panel is just kind of awkwardly floating despite being "attached". My question is: is there a way to make the radial attachment fit more closely to the surface of the part? https://i.imgur.com/J5vW2eD.png
  9. Well, I found a solution. I modified the code to make this: foreach(Vessel targetvessel in FlightGlobals.Vessels) { foreach(Part targetpart in targetvessel.parts) { if(targetpart.name == "ruitelecheck") { if(VesselsWithUnit.Contains(targetvessel) == false) { VesselsWithUnit.Add(targetvessel); } VesselNames.Add(targetvessel.GetName()); } } if(VesselsWithUnit.Contains(targetvessel) == false) { if((targetvessel.transform.position - this.vessel.transform.position).magnitude > 2750f) { targetvessel.vesselRanges.landed.load = 2500f; targetvessel.vesselRanges.landed.unload = 2250f; targetvessel.vesselRanges.flying.load = 2500f; targetvessel.vesselRanges.flying.unload = 2250f; targetvessel.vesselRanges.orbit.load = 2500f; targetvessel.vesselRanges.orbit.unload = 2250f; targetvessel.vesselRanges.prelaunch.load = 2500f; targetvessel.vesselRanges.prelaunch.unload = 2250f; targetvessel.vesselRanges.splashed.load = 2500f; targetvessel.vesselRanges.splashed.unload = 2250f; targetvessel.vesselRanges.subOrbital.load = 2500f; targetvessel.vesselRanges.subOrbital.unload = 2250f; targetvessel.vesselRanges.escaping.load = 2500f; targetvessel.vesselRanges.escaping.unload = 2250f; } } } This waits for targetvessel to go comfortably outside of loading distance before it unloads it. The set up isn't ideal, but at least it's not producing anymore big red text in the debug console
  10. Well, it's coming up with this: [Exception]: NullReferenceException UnityEngine.Component.get_gameObject () Vessel.recurseCoMs (.Part part) Vessel.recurseCoMs (.Part part) Vessel.findLocalCenterOfMass () ProtoVessel..ctor (.Vessel VesselRef) Vessel.Unload () Vessel.Update () So I guess it is to do with the plugin trying to access information from a vessel that has been unloaded. I'm not sure how I'd prevent the code from trying to access the information it can't get to, while keeping it working as I want it to, short of eliminating vessel unloading completely, which really doesn't seem like a great idea.
  11. Thanks, Diazo, your help is really appreciated. Is there anything you don't know about KSP plugins? Haha
  12. Just wondering if there's any way to find out what part of my plugin is causing a null reference exception. I keep seeing it come up in in the debug menu under the same circumstances, but that message isn't particularly helpful when trying to find what's causing it. Otherwise would anyone be prepared to look at my code and see if they can tell what's going on? Thanks. Also, I know this isn't the right page to ask about it, but my plugin involves increasing the vessel load and unload distance (to cover the entire solar system, then it is returned to default for vessels that are not needed to prevent unnecessary vessel loading) and I've noticed an issue with overheating for no obvious reason occurring on vessels that are loaded but not the active vessel when I've been testing the plugin. Any ideas if there is some reason for this? Here's the code: http://pastebin.com/raw.php?i=8zMHDjiN The null reference exception always occurs after a vessel without the part the plugin is assigned to goes out of range and is unloaded, but only if the Activate() KSP Event is performed, even once, whilst the vessel is within the loading distance. If it is performed outside the loading distance, the issue does not occur.
  13. I see what you mean now. I tried making the changes you suggested, but the numbers for Electric Charge still just keep increasing. This is despite the fact that I wrote a print(ElectricChargeTotals.count.ToString()) into the code, and it consistently printed 0. I really don't get what's going on.
  14. To my knowledge, the problem isn't that the values for each vessel are being added together, if that's what you're suggesting. When I scroll through the pages for each vessel, the strings show different doubles for the Electric Charge totals of each vessel, as the Dictionary separates them out. As far as I can tell, the issue is that the += operator here... if(ElectricChargeTotals.ContainsKey(v.GetName())) { ElectricChargeTotals[v.GetName()] += battery.Resources["ElectricCharge"].amount; } ... is continuously adding on the amount of each part because it doesn't know when to stop. I've looked for ways around this but I really can't seem to find anything.
  15. Thank you for your help, but I think we had a misunderstanding on what exactly it was I wanted to do. I want to be able to display the resource totals of each vessel (eg. Vessel 1 Electric Charge: 50, Vessel 2 Electric Charge: 275, etc). A Dictionary did look like it might be what I needed, however, if I write a code like the one below, the numbers will just increase infinitely. I've been looking for a way around it but nothing seems to work. //vessels is a List<Vessel> //ElectricChargeTotals is Dictionary<string, double> foreach(Vessel v in vessels) { foreach(Part battery in v.parts) { if(battery.Resources.Contains("ElectricCharge")) { if(ElectricChargeTotals.ContainsKey(v.GetName())) { ElectricChargeTotals[v.GetName()] += battery.Resources["ElectricCharge"].amount; } else { ElectricChargeTotals.Add(vesselwithunit.GetName(), battery.Resources["ElectricCharge"].amount); } } } } //information is a string that is to be displayed in a GUI.Window //vesselnames is a List<string> containing the names of all the relevant vessels //index is an int to enable scrolling through pages of information for each vessel information = ElectricChargeTotals[vesselnames[index]].ToString("f0");
  16. I think we're on the same page. I'll see if I can apply your suggestion to my code.
  17. Hi, I'm writing a plugin, part of which requires lists of resource amounts across an indefinite number of vessels in a List<Vessel>, but I'm struggling on how to get around it. I know I can get a total amount of a resource in a vessel by using a foreach() statement to look for parts containing that resource in the vessel and getting the sum of the doubles, but I've been getting some odd results when I've been trying to get numbers for resource amounts across many vessels, I'm guessing this is because of the fact that it's all in one big foreach() statement spanning across multiple vessels or something. I want to get the resource amount totals of each vessel (bearing in mind the List is intended to contain an indefinite, non-restricted, number of vessels) and put those totals into a List so I can then call them by index. Is there some way to do this? Thanks.
  18. Ok, so this mod has gone cold since the summer when I made plans for development of version 0.05. Now, I feel I should make an official announcement that development of version 0.05 has stopped and I have no plans to continue work on it. The ideas I had for version 0.05 were simply beyond my knowledge of KSP scripting, and this combined with the fact that I have now started studies at university, means that realistically the no further development is likely to happen. If anyone feels they would like to pick up RUI Life-Tech where I left it, feel free, though some credit for the original creation would be nice. I honestly believe that this is the end of my work on this mod, so do not expect any further updates from me. Thank you, everyone, for your interest, feedback and support.
  19. Looks like we have a new comer to KSP modding! Well, you could make it with like that with a generator in a cfg. file, or if you want, you could do it with a plugin, though you'd need a program like SharpDevelop. The first issue with what you have there is that isAlwaysActive is set as true, when it should be false, if you want the options to activate and deactivate the generator, so you could make that change to the first one. However, if you were interested in making a plugin, it would be very simple to create one. Like I said, you would need SharpDevelop (version 3.2 or later I think) and create a Class Library file when you load the program. To produce something that looked good you would want a code something like this: using UnityEngine; namespace yourpluginname { public class yourpluginname : PartModule { // anything with "//" before it doesn't do anything, it's just a little note // of course, you can replace any names for things like class, bool, string, etc. // a bool is a value that returns true or false [KSPField(guiActive = true, guiName = "" ,isPersistant = true)] public bool generatoractive = false; // a string is a value that is in speech marks, usually a word, a phrase, etc. [KSPField(guiActive = true, guiName = "" ,isPersistant = true)] public string generatorstatus = "Generator Inactive"; // a float is a type of number value [KSPField(guiActive = true, guiName = "" ,isPersistant = true)] public float totalElectricCharge = 0; // this creates the buttons to activate and deactivate the generator [KSPEvent(guiActive = true, guiName = "Activate", active = true)] public void Activate() { Events["Activate"].active = false; Events["Deactivate"].active = true; generatoractive = true; } [KSPEvent(guiActive = true, guiName = "Deactivate", active = false)] public void Deactivate() { Events["Activate"].active = true; Events["Deactivate"].active = false; generatoractive = false; } void Update() { if(generatoractive) { part.RequestResource("ElectricCharge", 2 * TimeWarp.deltaTime); // this looks complicated but is necessary to check the electric charge amount of the whole vessel by finding and checking each part that contains electric charge foreach(part partwithcharge in vessel.parts) { if(partwithcharge.Resources.Contains("ElectricCharge")) { totalElectricCharge += partwithcharge.Resources["ElectricCharge"].amount } // this will check if you have any electric charge left if(totalElectricCharge > 0) { part.RequestResource("Tritium", -10 * TimeWarp.deltaTime); } // you want it set as 2 and -10 because RequestResource uses up the given resource, so a negative number will make it increase the resource } } } } } And that should work, let me know if you hit any problems.
  20. Hi, I've made a bit of progress on adding a science experiment module to a part through a KSP event button, but I'm having some problems. I have the following sections of code in my plugin: public class RUILifeTech005 : PartModule { [KSPEvent(guiActive = true, guiName = "Activate", active = true)] public void Activate() { Events["Activate"].active = false; Events["Deactivate"].active = true; print("Adding Module..."); part.AddModule("LifeTechScience"); } [KSPEvent(guiActive = false, active = false)] public void Deactivate() { Events["Activate"].active = true; Events["Deactivate"].active = false; } } and then: public class LifeTechScience : ModuleScienceExperiment { public override void OnSave(ConfigNode lifetechnode) { print("Added Module!"); lifetechnode.AddNode("MODULESCIENCEEXPERIMENT"); lifetechnode.AddValue(name, "MODULESCIENCEEXPERIMENT"); lifetechnode.AddValue(experimentID, "LifeTechAnalysis"); lifetechnode.AddValue(experimentActionName, "Conduct Analysis"); lifetechnode.AddValue(resetActionName, "Reset Data"); lifetechnode.AddValue("useStaging", true); lifetechnode.AddValue("useActionGroups", true); lifetechnode.AddValue("hideUIwhenUnavailable", true); lifetechnode.AddValue("xmitDataScalar", "0.2f"); lifetechnode.AddValue("dataIsCollectable", true); lifetechnode.AddValue(collectActionName, "Collect Data"); lifetechnode.AddValue("interactionRange", 1.2f); lifetechnode.AddValue("rerunnable", true); } } The problem seems to be with the actual values of the experiment module. It seems to register the addition of a new experiment module, coming up with buttons for Deploy, Review Data and Reset, though none of these actually do anything. The debug console prints the "Adding Module..." that I added to the code to see what bits work, but not "Added Module!". It also comes up with an error: "Reference not set to an instance of an object." I'm new to creating config nodes in plugins, so any help would be great. Thanks
  21. Right, looks like I've misunderstood how MM works. Thanks anyway!
  22. I may be asking a very obvious question, but does Module Manager have a way to check the amount of a resource stored in a part?
  23. Well, now I'm back to having a consistent internet connection so I can use the forum again. I've been trying a couple of things while I've been away, but they don't seem to be working out how I'd like them to. But now I have internet access again, I can take a look into possible solutions. The 0.04 version should work with 0.24 of KSP. As for other things, I had considered making some kind of processing lab that the player would park at the KSC and dock the science vessel with the lab when they get back, but that may be somewhat inconvenient. I'm basically going to have to take a look into things, as some of my hopes for the mod lead me on to new ground such as contracts.
  24. Well the reason was that I don't want the Science Experimented to be accessible unless the player clicks the KSPEvent button, which it would have been if I just added it in the cfg file. I'll have a look at ModuleManager. Thanks.
×
×
  • Create New...