Jump to content

jim1240

Members
  • Posts

    8
  • Joined

  • Last visited

Reputation

0 Neutral
  1. So, thanks to QuickGo mode code, i've found this: static IEnumerator loadScene(GameScenes scenes , EditorFacility facility = EditorFacility.None) { yield return new WaitForEndOfFrame(); HighLogic.LoadScene(scenes); } It seems working cause loading screen appears, but scene returns to SpaceCenter. Log says there's no vessel in AssemblyShip, so i've tried to focus on landed vessel with this: DebugFunctions.SendLog("Searching vessels"); foreach (Vessel vessel in FlightGlobals.Vessels ) { DebugFunctions.SendLog("Vessel found"); if ( vessel.vesselType == VesselType.Ship ) { if ( !vessel.loaded ) { DebugFunctions.SendLog("Vessel not loaded, loading.."); vessel.Load(); } if ( vessel.LandedInKSC ) { DebugFunctions.SendLog("Vessel landed"); FlightGlobals.SetActiveVessel(vessel); } else { DebugFunctions.SendLog("Vessel not landed"); } } else DebugFunctions.SendLog("Vessel not a ship"); } scenario.StartCoroutine(loadScene(GameScenes.FLIGHT)); Her's log: I can't fond out how to solve this. Maybe it's not a solution to load LaunchPad scene...
  2. Hi. Is anyone has any idea how to change scene on the fly (ex: from SpaceCenter to LaunchPad) ? I tried to load a new game with "Game.Load()", after reading an existing save with "GamePersistence.LoadGameCfg()" method. Existing save was taken in the LaunchPad with an active vessel (starting scene is 7 = FLIGHT). The game loading works perfectly but scene remains in SpaceCenter. I tried: "HighLogic.LoadScene", game crash. "HighLogic.bufferedLoad", nothing happens. Thank you for answers.
  3. It seems effectively more efficient to pass module name to the function, to avoid searching a parameter in all modules of a part. Thank you everyone
  4. It's for stock modules for the moment, but it will be also for custom modules and parameters. So effectively, i can give module name to the function for stock parts, it will be simpler. I'll try partPrefab too, maybe interesting. Thanks you
  5. I can't find another method to get actual parameter of a part in editor. This method is working but i'm thinking it's actually a bit too complicated. If you've a simpler way to do this, i'll use it with enthusiasm. I tried: Part.partInfo (not actual parameter) Part.internalModel.internalConfig (internal config) Actual code: public static string GetAttribute(string partName, string parameterName) { Part part = VesselFunctions.GetVesselPart(partName); string value; foreach ( PartModule module in part.Modules ) { value = module.Fields.GetValue(parameterName).ToString(); DebugFunctions.SendLog("Parameter " + parameterName + " found: " + value); return value; } DebugFunctions.SendLog("Parameter " + parameterName + " NOT found"); return null; } Thanks you for answer
  6. Nevermind, just found the right method in this post: (cast) module.Fields.GetValue(parameterName) with cast, desired value format.
  7. Hi Maybe a stupid answer but, did you upgrade your tracking station and your mission control buildings to level 2?
  8. Hi everyone. I'm trying to retrieve a value of a part, used in an edited ship For example, i'm trying here to retrieve CURRENT 'deployAltitude' value of the 'parachuteSingle' part, used in the currently edited ship (VAB): Notes: GetVesselPart and DebugFunctions.SendLog are working. public static string GetAttribute(string partName, string parameterName) { Part part = GetVesselPart(partName); string value; foreach ( PartModule module in part.Modules ) { foreach ( BaseField field in module.Fields ) { DebugFunctions.SendLog("Checking field " + field.name); if ( field.name == parameterName ) { value = (string)field.GetValue(parameterName); DebugFunctions.SendLog("Parameter found : actual string -> " + value); return value; } } } DebugFunctions.SendLog("Parameter " + parameterName + " NOT found"); return null; } Used values in this example: partName = "parachuteSingle" parameterName = "deployAltitude" Here's produced log: [LOG 16:03:29.929] [7]Checking field invertCanopy. [LOG 16:03:29.929] [7]Checking field semiDeployedAnimation. [LOG 16:03:29.930] [7]Checking field fullyDeployedAnimation. [LOG 16:03:29.930] [7]Checking field autoCutSpeed. [LOG 16:03:29.930] [7]Checking field rotationSpeedDPS. [LOG 16:03:29.931] [7]Checking field capName. [LOG 16:03:29.931] [7]Checking field canopyName. [LOG 16:03:29.931] [7]Checking field persistentState. [LOG 16:03:29.932] [7]Checking field stowedDrag. [LOG 16:03:29.932] [7]Checking field semiDeployedDrag. [LOG 16:03:29.932] [7]Checking field fullyDeployedDrag. [LOG 16:03:29.933] [7]Checking field animTime. [LOG 16:03:29.933] [7]Checking field clampMinAirPressure. [LOG 16:03:29.933] [7]Checking field minAirPressureToOpen. [LOG 16:03:29.934] [7]Checking field deployAltitude. [ERR 16:03:29.934] Value could not be retrieved from field 'deployAltitude' [LOG 16:03:29.934] [7]Parameter found : actual string -> . [EXC 16:03:29.935] ArgumentNullException: Argument cannot be null. I can't find the good method to get value of this parameter. I tried field.GetStringValue without success. Have you any idea how to do this? Thank you
×
×
  • Create New...