Jump to content

[1.8] KerbalStats v3.1.0


taniwha

Recommended Posts

I've released version 1.1.0 of KerbalStats. Links in the first post.

Changes from 1.0.0:

  • Update for KSP 0.90.
  • Avoid NREs when Extraplanetary Launchpads loads a craft file.
  • Catch SOI changes that do not involve a situation change (both trajectories are escaping)

Link to comment
Share on other sites

Here's a... probably really silly question, but does this actually have a readout in-game somewhere?

Or is this a background mod that is hooked into by other mods, such as your Extraplanetary Launchpads mod?

EDIT: Never mind. I'm a tit. Read the ReadMe. (In my defense, it's a file I can't actually open on my PC. :P)

Edited by Melfice
Link to comment
Share on other sites

Weird that you can't, unless you mean it winds up all on one line, in which case you need either a smarter editor or to run unix2dos on the file (line ending issue).

It is currently only background, but I have plans to put some info up once I figure out how (I want to get it into the astronaut complex).

Link to comment
Share on other sites

I'm the author of Kerbal Construction Time and I received a log from a user who was having issues consistent with persistence loading not completing, which unfortunately can be caused by other mods encountering errors during a persistence load event. The log indicated the issue was with KerbalStats, so I figured I'd post the snippet that I believe is the issue, along with a link to the log file.

log file: https://www.dropbox.com/s/r5uttn62fgttjmc/output_log.txt?dl=0


[KS] OnLoad

ArgumentOutOfRangeException: Cannot be negative.
Parameter name: length
at System.String.Substring (Int32 startIndex, Int32 length) [0x00000] in <filename unknown>:0
at KerbalStats.Gender.PickGender (System.String name) [0x00000] in <filename unknown>:0
at KerbalStats.Gender.AddKerbal (.ProtoCrewMember kerbal) [0x00000] in <filename unknown>:0
at KerbalStats.Gender.Load (.ProtoCrewMember kerbal, .ConfigNode node) [0x00000] in <filename unknown>:0
at KerbalStats.KerbalExt.Load (.ProtoCrewMember kerbal, .ConfigNode ext) [0x00000] in <filename unknown>:0
at KerbalStats.KerbalStats.OnLoad (.ConfigNode config) [0x00000] in <filename unknown>:0
at ScenarioModule.Load (.ConfigNode node) [0x00000] in <filename unknown>:0
at ScenarioRunner.AddModule (.ConfigNode node) [0x00000] in <filename unknown>:0
at ProtoScenarioModule.Load (.ScenarioRunner host) [0x00000] in <filename unknown>:0
at ScenarioRunner+ .MoveNext () [0x00000] in <filename unknown>:0

Link to comment
Share on other sites

Oh dear, that's a bit of a problem. While I certainly need to check for errors, the bigger question is: why is there no space in the kerbal's name? Is the name blank at the time, or was the kerbal renamed to not have a space? (ie, not "something Kerman")

Thank you.

Link to comment
Share on other sites

Oh dear, that's a bit of a problem. While I certainly need to check for errors, the bigger question is: why is there no space in the kerbal's name? Is the name blank at the time, or was the kerbal renamed to not have a space? (ie, not "something Kerman")

Thank you.

I'll have to ask the user who reported the issue, I'll edit this when I find out (if I ever do).

Link to comment
Share on other sites

I rather hope the user did edit the kerbal's name, as I really do not want it to be a bit of funkiness with KSP, though I do vaguely remember something about unnamed kerbals at certain stages. Still, I shall put in some code to cope with either situation.

Link to comment
Share on other sites

Oh dear, that's a bit of a problem. While I certainly need to check for errors, the bigger question is: why is there no space in the kerbal's name? Is the name blank at the time, or was the kerbal renamed to not have a space? (ie, not "something Kerman")

Thank you.

This was my error report. It's probably due to my use of Kpseudonym to replace the usual names with a custom namelist. Never realized there would be a problem with Kerbals with no space in their name - I'll change the config around and try it with spaces instead and see what happens.

Link to comment
Share on other sites

lordyod: ah, good. I'm glad it was something like that and not KSP being... KSP.

- - - Updated - - -

I've released version 1.1.1 of KerbalStats. Just a couple of bug fixes:

  • Avoid an indexing error in the Astronaut Complex. This needs a proper fix as the current fix might mix up some kerbal stats.
  • Handle names that have no spaces when picking the gender.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
Hi,

I guess you have to be a computer programmer to use this?! Any tutorials?

Zeta

With that being said. I'm developing such a mod: Roster Manager. I was turned on to this thread by enceos. I will look at leveraging this mod for my needs.

Link to comment
Share on other sites

Papa_Joe: ah, then you might like the new feature pushed to github: it saves and restores the kerbal's experience trait. It doesn't do switching yet, though.

I was looking at that in your code.

I have working experience trait changes and renaming in Ship Manifest. I'm moving that over to Roster manager. It uses a trick passed to me by 5thHorseman where we add ascii 1s to the end of the name in order to "spoof" the hash algorithm KSP uses. I can then persist what ever Trait I desire, by adding ascii chars to the end of the name. They are non printable so it seems to work just fine. I've had it in the wild for a week or so or more. Only issue reported was that the chars show up in map view when a kerbal is on the surface... cosmetic only. I'm going to take a look to see if it impacts your mod in any way.

Feel free to check out what I did. Works pretty nicely.

Edited by Papa_Joe
Link to comment
Share on other sites

I find such hacks to be... messy at best. I find the whole concept of basing (beyond initial generation) the profession on the name to be icky.

I agree. I'm in principle against such hacks as well, including the Hack we are battling against from Squad. I'm surprised at the association of the profession to the name... you should never tie things like that together at all, first generation or not. Some other, more robust method should have been used.

So, Squad has kind of forced our hand here. I wanted a means to persist it to the save, rather than relying on an external means, as that meant that removing the addon meant "losing" the changes. I didn't want such "loss" of critical data to happen, and I didn't want the user to be "Forced" to continue using my addon because I changed such critical data.

This is also why I have the feature turned off by default. If you want to use it, you can, but with the above awareness. 5thHoresman has been testing it and it seems to be working good. I've heard no negative feedback as yet.

Hopefully, Squad will address this and provide for a means to elegantly make such changes via the API.

Edited by Papa_Joe
Link to comment
Share on other sites

Well, one thing I can say is KerbalStats will override your method is someone uses both. Yours just tricks KSP into using the desired profession, mine tells KSP "no, that kerbal is this profession".

Probably the biggest thing that bugs me about KSP's (and your) handling of professions is if you add a new one via a mod (which is trivial to do), then already established kerbals will get a random profession, which could prove rather unfortunate.

How to add a new profession: define one by studying Squad/Experience/Traits.cfg. However, to have real meaning, you want new effects. They take code, but I did that for engineers in EL: ExConstructionSkill. That said, you can create new professions that have a mix and match of other professions' skills.

Link to comment
Share on other sites

Well, one thing I can say is KerbalStats will override your method is someone uses both. Yours just tricks KSP into using the desired profession, mine tells KSP "no, that kerbal is this profession".

Probably the biggest thing that bugs me about KSP's (and your) handling of professions is if you add a new one via a mod (which is trivial to do), then already established kerbals will get a random profession, which could prove rather unfortunate.

How to add a new profession: define one by studying Squad/Experience/Traits.cfg. However, to have real meaning, you want new effects. They take code, but I did that for engineers in EL: ExConstructionSkill. That said, you can create new professions that have a mix and match of other professions' skills.

Point taken. I will evaluate this in light of your statements. Mine is indeed only "tricking" KSP into using the desired profession. Now that I'm looking at kerbals in more detail and considering using your API, I will evaluate my options.

I may end up providing both means such as in a standalone vs Kerbalstats compliant, and let the user decide the path they choose.

Link to comment
Share on other sites

That sounds good: the more options available, the better :)

I'm sorry things took a bit: you asked me about interaction between KS and RM and it took me a while to figure out what they would be.

Link to comment
Share on other sites

Hey taniwha, my next contract pack is going to involve a new profession, and I'm planning on having KerbalStats as a dependency rather than having to solve the profession persistence problem myself. A few questions for you, although some are more about adding experience traits in general:

  1. If I add a new trait and DO NOT have KerbalStats I assume will "regenerate" professions for Kerbals in an existing save. So if a user installs my mod with a new trait and KerbalStats at the same time, professions will be reshuffled. If they install KerbalStats first, start KSP and save, then install my mod, things will be happy. Can you think of a better way, or will I just need to have BIG RED TEXT warning users about this?
  2. Do you plan to have KerbalStats do anything with the professions of the starting 3 when starting a new game. Specifically, I'm concerned that adding a new profession would change what "the 3" start with - although I haven't yet tested this - maybe Squad has magic to handle this already.
  3. I'd like the profession that I'm adding to not come up automatically for new recruits (it'll be assigned in a different way, through code). Any chance you'd have something in KerbalStats's profession module to prevent a specific profession from being assigned automatically to a new Kerbal? Or will I end up needing to code this one myself?

Link to comment
Share on other sites

Well...

  1. I'm pretty certain adding both mods at the same time will randomize the professions.
  2. The big three (four when 1.0 comes out) are hard-coded.
  3. A little tricky, but probably doable. I'm pretty sure KerbalExt's AddKerbal() can be used to check for blacklisted professions and re-roll when appropriate.

BTW, I plan on making the Profession module save/restore flight logs allowing for multiple professions. Switch to a new profession, start at level zero, but switch to a previous profession and return to the previous level.

Link to comment
Share on other sites

BTW, I plan on making the Profession module save/restore flight logs allowing for multiple professions. Switch to a new profession, start at level zero, but switch to a previous profession and return to the previous level.

Awesome, sounds good. If this feature's there, I'd definitely need support for #3 though. :)

Link to comment
Share on other sites

  • 3 weeks later...

How does this handle gender assignment for existing saves? Basically, if I drop it into an existing save which already has kerbals in it, what will it do? Is there a way to manually assign gender? Does it add any new prefixes/suffixes to the name generator?

Link to comment
Share on other sites

GreenWolf: Any kerbal that does not yet have gender assigned to it (freshly generated or loaded from a save) will have gender assigned to it based on the name: certain names are always male, certain name endings are always male, certain other name endings are always female, otherwise random (20% chance of female, iirc). Gender can be manually assigned by editing the save, but it's a bit awkward as the kerbal stats array is separate to the stock roster array, and it's not clear other than order which kerbal stats slot is which kerbal.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...