TriggerAu Posted January 2, 2014 Share Posted January 2, 2014 Another source for adjusting the warp code is on this page http://wiki.kerbalspaceprogram.com/wiki/Module_code_examples Quote Link to comment Share on other sites More sharing options...
Morx Posted January 2, 2014 Share Posted January 2, 2014 thanks a lot for replying, my problem is that i don't know how to implement the code in the game or modify the values from existing game files Quote Link to comment Share on other sites More sharing options...
track122 Posted January 3, 2014 Share Posted January 3, 2014 I'm not sure if this has come up yet although I read through a couple dozen pages so here goes. I have an OK amount of experience with C#, but have no idea what most of the KSPField methods are used for. I'm trying to implement my own ambient sounds for when ships are landed on different celestial bodies, and am wondering how I might go about detecting a) when a ship is landed and which celestial body it's landed on. Any advice would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
TriggerAu Posted January 3, 2014 Share Posted January 3, 2014 thanks a lot for replying, my problem is that i don't know how to implement the code in the game or modify the values from existing game filesWell thats a whole nother set of answers really. The best thing to do to learn how these work is to have a go, and look at others source. This link by TaranisElsu has some good startpoints for new modders - http://forum.kerbalspaceprogram.com/threads/56053-Example-plugin-projects-to-help-you-get-started Quote Link to comment Share on other sites More sharing options...
Magion Posted January 3, 2014 Share Posted January 3, 2014 I'm trying to implement my own ambient sounds for when ships are landed on different celestial bodies, and am wondering how I might go about detecting a) when a ship is landed and which celestial body it's landed on. Any advice would be greatly appreciated.I would do it somehow like this: MusicLogic ml = new MusicLogic(); if (FlightGlobals.ActiveVessel.Landed) { if (FlightGlobals.ActiveVessel.mainBody.name == "Kerbin") { ml.spacePlaylist.Clear(); ml.spacePlaylist.Add(AudioClip clip); } else if (FlightGlobals.ActiveVessel.mainBody.name == "Duna") { ml.spacePlaylist.Clear(); ml.spacePlaylist.Add(AudioClip clip); } } Quote Link to comment Share on other sites More sharing options...
Morx Posted January 3, 2014 Share Posted January 3, 2014 Well thats a whole nother set of answers really. The best thing to do to learn how these work is to have a go, and look at others source. This link by TaranisElsu has some good startpoints for new modders - http://forum.kerbalspaceprogram.com/threads/56053-Example-plugin-projects-to-help-you-get-startedThanks sir, now that i have that example i may be on the right way Quote Link to comment Share on other sites More sharing options...
bglen Posted January 6, 2014 Share Posted January 6, 2014 I have a simple question:Can I use javascript to create plugins instead of C#?I know KSP uses Unity and I use Unity a lot, and I know you can use C# or Javascript for scripting. Quote Link to comment Share on other sites More sharing options...
track122 Posted January 6, 2014 Share Posted January 6, 2014 I would do it somehow like this: MusicLogic ml = new MusicLogic(); if (FlightGlobals.ActiveVessel.Landed) { if (FlightGlobals.ActiveVessel.mainBody.name == "Kerbin") { ml.spacePlaylist.Clear(); ml.spacePlaylist.Add(AudioClip clip); } else if (FlightGlobals.ActiveVessel.mainBody.name == "Duna") { ml.spacePlaylist.Clear(); ml.spacePlaylist.Add(AudioClip clip); } }Thanks a lot that's exactly what I needed! Quote Link to comment Share on other sites More sharing options...
Faark Posted January 6, 2014 Share Posted January 6, 2014 Can I use javascript to create plugins instead of C#? I know KSP uses Unity and I use Unity a lot, and I know you can use C# or Javascript for scripting.You can use whatever language you like, as long as you can create a proper .NET dll from it. That means no, you can't rly use Unity to create the mod. For example with a Project from MonoDevelop's UnityScript Project category, as mentioned here. Quote Link to comment Share on other sites More sharing options...
CiberX15 Posted January 8, 2014 Share Posted January 8, 2014 So I don't know if someone has already pointed this out or not but it is a useful tidbit of info that took me two days to figure out so I figured I post it here for all to see.you cannot make a persistent double variable using [KSPField(isPersistant = true)] it will just default to zero instead of keeping the value. floats however work fine. Quote Link to comment Share on other sites More sharing options...
CiberX15 Posted January 8, 2014 Share Posted January 8, 2014 I have a simple question:Can I use javascript to create plugins instead of C#?I know KSP uses Unity and I use Unity a lot, and I know you can use C# or Javascript for scripting.Bad news: I dont think so.Good news, C# is almost identical to java scriptThe only major differences is instead of the keyword "function" you use "void"and instead of declaring a variable like this "var NewVar : int = 5;" you would use "int NewVar = 5; "There are of course other minor differences but if you already know JavaScript its just a mater of learning what order things go in. Quote Link to comment Share on other sites More sharing options...
blizzy78 Posted January 8, 2014 Share Posted January 8, 2014 Good news, C# is almost identical to java scriptThat is so wrong, I don't even know where to begin to describe how this statement makes me feel. Quote Link to comment Share on other sites More sharing options...
miracmert Posted January 8, 2014 Share Posted January 8, 2014 I'm trying to make a plugin about kerbals. I tried looking all the codes in the game but I can't find the ones that are about kerbal individuals. Where can I find them? Quote Link to comment Share on other sites More sharing options...
TriggerAu Posted January 8, 2014 Share Posted January 8, 2014 I'm trying to make a plugin about kerbals. I tried looking all the codes in the game but I can't find the ones that are about kerbal individuals. Where can I find them?Vessel.GetVesselCrew() will get you a list of ProtoCrewMember objects in a vessel. Is that the sort of thing, or do you mean the Kerbals in the Astronaut Complex list? Quote Link to comment Share on other sites More sharing options...
miracmert Posted January 8, 2014 Share Posted January 8, 2014 Vessel.GetVesselCrew() will get you a list of ProtoCrewMember objects in a vessel. Is that the sort of thing, or do you mean the Kerbals in the Astronaut Complex list?Actually what I'm trying to make is creating a "cockpit" for kerbals in EVA but I'm curious if kerbals in EVA are considered as "spaceships" in the code so that's what I was looking for. Is it quite possible? Quote Link to comment Share on other sites More sharing options...
stupid_chris Posted January 9, 2014 Share Posted January 9, 2014 Actually what I'm trying to make is creating a "cockpit" for kerbals in EVA but I'm curious if kerbals in EVA are considered as "spaceships" in the code so that's what I was looking for. Is it quite possible?Kerbals are technically one part vessels, yes. They're essentially a part with a KerbalEVA PartModule, iirc. I believe adding a first person view would work like adding a normal IVA. Quote Link to comment Share on other sites More sharing options...
MrHappyFace Posted January 9, 2014 Share Posted January 9, 2014 How can I kill the crew of a vessel? Quote Link to comment Share on other sites More sharing options...
stupid_chris Posted January 9, 2014 Share Posted January 9, 2014 I believe something as simple as this should do it:foreach (ProtoCrewMember member in this.vessel.GetVesselCrew()) { member.Die(); } Quote Link to comment Share on other sites More sharing options...
MrHappyFace Posted January 9, 2014 Share Posted January 9, 2014 I believe something as simple as this should do it:foreach (ProtoCrewMember member in this.vessel.GetVesselCrew()) { member.Die(); }Thanks! now where should I hide the bodies? Quote Link to comment Share on other sites More sharing options...
TriggerAu Posted January 9, 2014 Share Posted January 9, 2014 Actually what I'm trying to make is creating a "cockpit" for kerbals in EVA but I'm curious if kerbals in EVA are considered as "spaceships" in the code so that's what I was looking for. Is it quite possible?yep, an EVA'd kerbal is a vessel with a crew of one from memory Quote Link to comment Share on other sites More sharing options...
miracmert Posted January 9, 2014 Share Posted January 9, 2014 Kerbals are technically one part vessels, yes. They're essentially a part with a KerbalEVA PartModule, iirc. I believe adding a first person view would work like adding a normal IVA.yep, an EVA'd kerbal is a vessel with a crew of one from memoryThanks for the answers, working on it! Quote Link to comment Share on other sites More sharing options...
MrHappyFace Posted January 9, 2014 Share Posted January 9, 2014 How could I set a ship's mass to 1% of its original mass? Quote Link to comment Share on other sites More sharing options...
NathanKell Posted January 9, 2014 Share Posted January 9, 2014 Do you mean dry mass (not including resources) or gross mass (including resources)?Dry mass is easy: foreach part, part.mass = 0.01 * part.massNote that that won't persist, you'll have to do it after each load or vessel switch.Gross is harder: resource mass per unit is defined in the resource definition. I guess you *could* maybe change them on the fly...But they'd take effect globally... Quote Link to comment Share on other sites More sharing options...
pizzaoverhead Posted January 9, 2014 Share Posted January 9, 2014 Actually what I'm trying to make is creating a "cockpit" for kerbals in EVA but I'm curious if kerbals in EVA are considered as "spaceships" in the code so that's what I was looking for. Is it quite possible?There was a mod that used to do this that you may be able to use as a reference: CreationMe's BBI First Person View mod. It stopped working a while back and has been missed since. Its thread was lost in one of the forum crashes. Quote Link to comment Share on other sites More sharing options...
miracmert Posted January 9, 2014 Share Posted January 9, 2014 (edited) There was a mod that used to do this that you may be able to use as a reference: CreationMe's BBI First Person View mod. It stopped working a while back and has been missed since. Its thread was lost in one of the forum crashes.Oh thank you so much! I've been searching this for hours but I couldn't find anything. It is going to help a lot with coding part. I used the mod back then, but it was annoying for me to add a part to the vessel and then have the first person view. I am trying to avoid that in my mod. Thank you so much again!EDIT: Unfortunately the mod doesn't come with the source code in it :/ So now, my question is (I know I asked a lot of questions for a tiny little mod but I'm new to C# and modding so please don't mind me ) how can I set the interior for KerbalEVA vessel? I read B9 interior source codes and also the stock ones and in all of them the interior file is stated in the Part.CFG so the game knows the interior of that part belongs to internal.cfg. But how can I change information of KerbalEVA so I can assign my interior as internal view in its codes? Edited January 9, 2014 by miracmert 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.