Jump to content

MrHappyFace

Members
  • Posts

    485
  • Joined

  • Last visited

Everything posted by MrHappyFace

  1. How could I call a function before any flight change or scene transition. I want to save some vessel data in a config before switching or scene transitioning.
  2. You could also find and sell precious minerals for money to spend on the next mission.
  3. I am: http://www.reddit.com/r/KerbalSpaceProgram/comments/1uio7b/poll_would_you_be_interested_in_an_interstellar/
  4. My current code does not work: http://forum.kerbalspaceprogram.com/threads/64212-Code-not-working-cant-change-mun-s-textures-heightmap so I was wondering if there was another way, or if I was doing something wrong.
  5. Samio, I would like to add these planets in my interstellar travel mod. I sent you a PM with details, I hope you consider it! -MrHappyFace, CEO of HappyFace Industries
  6. At the beginning of Update(), I could move it to Start() though
  7. I am trying to find the active vessel in flight
  8. How can I find the active vessel? FlightGlobals.ActiveVessel does not work for me
  9. I have a few months of KSP scripting experience, but i know that this is possible with KSP and Unity, but it would require you to create a new planet, which is a very difficult thing (only one mod does it), or edit an existing planet. This sub-Forum is your best friend if you're stuck on something!
  10. What in the configs can I edit to get a faster max speed out of wheels
  11. Thanks for the quick reply, ill try that. another related question: what is the error message mean? EDIT: i added this: Debug.Log("Crap: Changing mun..."); Mun.orbitDriver.orbitColor = XKCDColors.ReddishBrown; if(MunHeight != null) { ChangeHeightMap(MunHeight, Mun, 700f, 1400d, -2000d); } else Debug.Log("AndrewCrap: MunHeight = null..."); if(MunColor != null) { ChangeColorMap(MunColor, Mun, 1.0f); } else Debug.Log("Crap: MunColor = null..."); And it still sadi the same debug message, but didnt say that MunColor or MunHeight were null either
  12. This code is based off of some code from NovaSilisko's mod, Alternis Kerbol, but I cant figure out whats wrong public CelestialBody Mun; public CelestialBody Kerbin; public Texture2D MunColor; public Texture2D MunHeight; public Texture2D MunBump; private string path = "HappyFaceIndustries/Crap/Textures/"; public void ChangeHeightMap(Texture2D map, CelestialBody cb, float deformity, double heightMapDeformity, double heightMapOffset) { GameObject OldHeight = cb.pqsController.transform.FindChild("_Height").gameObject; if (OldHeight != null) { //sets deformity foreach (PQSMod_VertexHeightNoiseVertHeightCurve2 c in OldHeight.GetComponentsInChildren<PQSMod_VertexHeightNoiseVertHeightCurve2>()) { c.deformity = deformity; } //creates VertexMap PQSMod_VertexHeightMap VertexMap = OldHeight.GetComponent<PQSMod_VertexHeightMap>(); //edits VertexMap, sets height map if (VertexMap != null && map != null) { VertexMap.heightMap.CreateMap(MapSO.MapDepth.Greyscale, map); VertexMap.heightMapDeformity = heightMapDeformity; VertexMap.heightMapOffset = heightMapOffset; } if(map = null) {Debug.Log("Crap: map null...");} } } public void ChangeColorMap(Texture2D color, /*Texture2D bumpMap,*/ CelestialBody cb, float blend) { //sets color map PQSMod_VertexColorMapBlend OldColor = cb.transform.GetComponentInChildren<PQSMod_VertexColorMapBlend>(); if (OldColor != null) { OldColor.vertexColorMap.CreateMap(MapSO.MapDepth.RGB, color); OldColor.blend = blend; } //sets color noise PQSMod_VertexSimplexNoiseColor oldColorNoise = cb.transform.GetComponentInChildren<PQSMod_VertexSimplexNoiseColor>(); if (oldColorNoise != null) { oldColorNoise.order = OldColor.order + 1; oldColorNoise.blend = 0.1f; } //sets scaledspace maps foreach (Transform t in ScaledSpace.Instance.scaledSpaceTransforms) { t.gameObject.renderer.material.SetTexture("_MainTex", color); } } public void Awake() { MunColor = GameDatabase.Instance.GetTexture(path + "MunColor", false); MunHeight = GameDatabase.Instance.GetTexture(path + "MunHeight", false); } public void Start() { foreach(CelestialBody CB in FlightGlobals.Bodies) { if(CB.name == "Mun") Mun = CB; } //Mun Mun.orbitDriver.orbitColor = XKCDColors.ReddishBrown; ChangeHeightMap(MunHeight, Mun, 700f, 1400d, -2000d); ChangeColorMap(MunColor, Mun, 1f); } When i run KSP, it gives me this error: NullReferenceException: Object reference not set to an instance of an object at Crap.BaseCrap.ChangeColorMap (UnityEngine.Texture2D color, .CelestialBody cb, Single blend) [0x00000] in <filename unknown>:0 at Crap.BaseCrap.Start () [0x00000] in <filename unknown>:0
  13. Whenever i try to write a foreach loop, nothing pops up in the auto-complete field, and when i try to just go ahead and type it, it does not recognize the code and gives me errors. I am using monodevelop unity because I am too lazy to install regular monodevelop, but it has worked perfectly for me in the past so it might not be the problem.
  14. You should release LightShifter seperatly because it seems to increase my fps
  15. Maybe vessel.goOnRails or something along those lines
  16. You could do something similar to this, however, I am not at my computer so this exact code might not work. Just put this code in a class extending partmodule in the OnUpdate function and put the module in your part, no code in the config required! float ResourceRate; If(vessel.mainBody.name = "Kerbin") ResourceRate = 0.21; If(vessel.main body.name = "Laythe") ResourceRate = 0.15; Part.RequestResource("Oxygen", ResourceRate); [\CODE]
  17. using code similar to this: foreach(CelestialBody body in FlightGlobals.fetch.bodies) { if(body.bodyName == "Kerbin") { body.atmosphere = true; body.atmosphericAmbientColor = Color(0.99, 0.67, 0.11, 1); } } it says that 'UnityEngine.Color' is a 'type' but is used like a 'variable'. What kind of variable does atmosphereicAmbientColor use and how can I set it?
×
×
  • Create New...