Jump to content

JuhaJGamer

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by JuhaJGamer

  1. Thanks, will look into it. Stupid that there doesn't seem to be an obvious way to do it, since so many nearly useless events have an obvious way to intercept them. Then again, the launch function was probably one of the first implemented, ever.
  2. So, I've got a bit of a problem. 1: I haven't coded since like 0.90, and 2: I need to get myself a dialog box BEFORE the loading screen on launches. That is, execute a function when the "Launch" button is pressed in either the editor or the ksc screens, preventing the loading until the function returns and/or is resolved in another way. For example, the recovery warning when trying to launch with a vessel on pad does this. I merely ask for two things: Is it possible, and if, how. And of course I have the alternative of using onVesselRollout or something, but I really want to do it before the loading screen. Before attacking me for this, I have spent the last hour trying to figure it out. Sorry for the possibly stupid question, just looking for help, and thanks in advance! For context I'm using a ScenarioModule with the [KSPScenario] attribute.
  3. Alright thanks, but now I have an another problem, I can get any other resource, but I cant get EC for some reason, I have tried if (part.RequestResource("ElectricCharge", rayPowerUsage / 1000) < chargeFuelUsage / 1000) if (part.RequestResource("Electric Charge", rayPowerUsage / 1000) < chargeFuelUsage / 1000) and if (part.RequestResource("EC", rayPowerUsage / 1000) < chargeFuelUsage / 1000) None of them seem to work though
  4. So, I fixed my rendezvous problem by stealing some Hyperedit code(totally legal) but i might have a small problem... I have a [KSPEvent] but it cant bind for some reason: [EXC 00:25:12.469] ArgumentException: Couldn't bind to method 'fireCannon'. System.Delegate.GetCandidateMethod (System.Type type, System.Type target, System.String method, BindingFlags bflags, Boolean ignoreCase, Boolean throwOnBindFailure) System.Delegate.CreateDelegate (System.Type type, System.Object target, System.String method, Boolean ignoreCase, Boolean throwOnBindFailure) System.Delegate.CreateDelegate (System.Type type, System.Object target, System.String method, Boolean ignoreCase) BaseEventList.CreateDelegates (System.Object part) BaseEventList..ctor (.Part part, .PartModule module) PartModule.ModularSetup () PartModule.Awake () UnityEngine.GameObject:AddComponent(Type) Part:AddModule(String, Boolean) Part:AddModule(ConfigNode, Boolean) PartLoader:ParsePart(UrlConfig, ConfigNode) <CompileParts>c__Iterator62:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) [ERR 00:25:12.473] PartLoader: Encountered exception during compilation. System.NullReferenceException: Object reference not set to an instance of an object at PartModule.Load (.ConfigNode node) [0x00000] in <filename unknown>:0 at Part.AddModule (.ConfigNode node, Boolean forceAwake) [0x00000] in <filename unknown>:0 at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0 at PartLoader+<CompileParts>c__Iterator62.MoveNext () [0x00000] in <filename unknown>:0 [ERR 00:25:12.475] PartCompiler: Cannot compile part My code consists of: [KSPEvent(guiActive = true, guiName = "Fire cannon")] public bool fireCannon() { ScreenMessages.PostScreenMessage("The precharge will not check if you have fuel, and just use it. Check to have 7.5 units of Korex and plenty of EC"); //check if enough fuel if (part.RequestResource(korexID, chargeFuelUsage) == chargeFuelUsage) { //start charge coroutine StartCoroutine(prechargeThing()); } return false; } And this prevents PartCompiler from loading the part
  5. So to me any nuke can destroy any vessel within ~30km radius. even the small 340kt. the bomber at 10km going at over 400 m/s away from the bomb. speeding up to 25 horizontal distance away from the b-61 can get destroyed in the explosion.
  6. So I have a mod, and it's in VS2015. Also it uses the Vwctor3d class Vessel.obt_velocity. Now VS says I need KSPUtil for that class. What do? http://imgur.com/a/GJlMq
  7. None of this helped, even rebooted my computer(dont know why I did that tbh.) hello?
  8. Tried it. It points to "J:\Ohjelmat\Pelit\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp.dll" which is my KSP Install. It is up-to-date(Steam) and rebooting VS didn't really help.
  9. I have the newest version of KSP and its Assembly-CSharp. VS still insists on the KSPUtil refrence http://imgur.com/gallery/GJlMq
  10. Vessel.obt_velocity is of the type Vector3d. for some reason VS2015 wants KSPUtil for this (KSP cant recognise KSPUtil.dll anymore, because it was all moved to Assembly-CSharp.dll)
  11. Ok, these are the two methods that I have tried. Directly editing the "quicksave" file takes time. There could be more vessels of the same name. And after that you must load it which may give you a quick fps-spike. The stock debug tool I cant find. Anywhere. No docs, no classes, no functions, It's like it doesn't exist. Velocity, I learned it actually today so that's great
  12. Has anyone got any idea of how to make a vessel rendezvous with another vessel, and then set the velocity relative to the target at ~50m/s. Rendezvous in kind of like the in-game cheat rendezvous which sets the vessel 150m away from the target.
  13. Thanks! I dont know why Visual Studio tried to forcefully have KSPUtil refrenced
  14. Thank you, I'm just starting. Also im trying to use ConfigNode but ksp just doesn't like it: System.IO.FileNotFoundException: Could not load file or assembly 'KSPUtil, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. File name: 'KSPUtil, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
  15. Sorry if this has been asked before, how to add particle effects to modules in C#
  16. I have been making a PartModule class and in the part.cfg file of my part, there is the ModuleScienceExperiment. It has arguments as experiment ID and stuff. How do you add those to a custom PartModule class. Just asking, but if anyone knows let me know. I'll mention all helpful people in the readme of my mod.
  17. Yaa that works. I'll mention you two in the readme file when I get my mod ready
  18. Ok I'll try. Hope it works - - - Updated - - - I dont think it works. My code: public override void OnUpdate () { double anti = this.part.RequestResource ("Antimatter", 20); double EM = this.part.RequestResource ("Electric Matter", 1); if (anti <= 20 ^ EM >= 1) stabilizeField (antiFieldState); else calculateExplosions (antiFieldState); } It should work and I actually have a debug messaging after that but it shows nothing in the log. Stabilize field shows in the debug that it works and calculate explosions explodes the part.
  19. I think that the ksp "meter" might be a 3dsmax "centimeter" or a "millimeter". Try that out.
  20. I'm trying to make a PartModule class which would explode if it has too much antimatter but no electric matter to contain it. I have a tempature increasing every frame by a bit in a function which runs every frame by the if-statement in the onUpdate() function. For some reason the onUpdate isn't called even once after I load it to the editor. Also, I would like to see how I could make it not explode in the editor, which it would probably do if I would get this working. Also it should use 1 Electric matter and 20 Antimatter every second. HOW DO I DO THAT. HELP. SOrry if this post contains bad English. I'm not really good at that.
  21. Can someone help? I'm having problems with my code. I'm trying to make a part module which would trigger some functions when part cant get any fuel. in my codepart its like public void onUpdate () { double anti = this.part.RequestResource ("Antimatter", 20); double EM = this.part.RequestResource ("Electric Matter", 1); if (anti <= 20 ^ EM >= 1) stabilizeField (antiFieldState); else calculateExplosions (antiFieldState); }
×
×
  • Create New...