nightingale

[1.8.x+] Contract Configurator [v1.28.0] [2019-10-17]

Recommended Posts

I GOT IT. WOO HOO GO ME

The list can't have spaces after the part name, or the spaces get counted as part of the name. So [ fuelTankSmallFlat , liquidEngine ] fails but [ fuelTankSmallFlat, liquidEngine] works like a charm.

GitHub issue reported.

Oooh, that's tricksey. There's a reason I don't having to support spaces as part of identifiers, but Kerbal Names, Vessel Names, Parts and other things forced me into it. Anyway, easy enough fix - just need to strip those trailing spaces.

Share this post


Link to post
Share on other sites

New release, download now!

Contract Configurator 1.6.5

  • Fix some parsing issues with the Duration class (thanks Nori).
  • Re-did fix to exception in ContractVesselTracker.
  • Fixed rare exception when removing a planet pack (thanks AlonzoTG).
  • Added support in SpawnVessel for spawning a vessel from a single part (a bit buggy, read caveats in documentation).
  • Improved SpawnVessel validation (thanks 5thHorseman).
  • Fixed issues with parsing identifiers with trailing spaces (thanks 5thHorseman).
  • Minor bug fixes.

Share this post


Link to post
Share on other sites

Thanks for the release (Particularly the parsing issue fix!).

I should maybe probably be thinking about releasing what I got so far this weekend. :P

Up to 16 contracts, though that is misleading as 7 of those are very wide contracts that can apply to a lot of different stuff.

Having loads of fun with all of your extra little functions like random number of crew members, making everything planet size/pack agnostic, having scaling rewards, optional parameters, awarding experience... :)

Share this post


Link to post
Share on other sites
Thanks for the release (Particularly the parsing issue fix!).

I should maybe probably be thinking about releasing what I got so far this weekend. :P

Up to 16 contracts, though that is misleading as 7 of those are very wide contracts that can apply to a lot of different stuff.

Having loads of fun with all of your extra little functions like random number of crew members, making everything planet size/pack agnostic, having scaling rewards, optional parameters, awarding experience... :)

Nice, can't wait to see what you've come up with.

Share this post


Link to post
Share on other sites

I've been following the documentation and trying to create my own contracts and I was wondering if there was a way to override the parameter titles e.g "Collect Science:" with my own such as "Achieve Goal:" or "Perform a blah while flying over blah:". Is it possible to do so? Really been enjoying creating them so far thanks for the mod!

Edit: Nvm I can't believe I missed the title field :( but when I hide children params the Recovery param still shows up is there a way to change that one?

Edited by Tidal
Found out how

Share this post


Link to post
Share on other sites

I am having a small problem.

If I uncheck a contract type in the configurator window, eg: "Field Research", the setting is not remembered - later when I look back, the contract type has been re-checked and the contracts are showing up. Am i missing something?

Also, but less important, is there a way to limit the number of contracts that are available at any one time?

Share this post


Link to post
Share on other sites
when I hide children params the Recovery param still shows up is there a way to change that one?

You'll have to be more specific as to the behaviour you're seeing. I checked the code and everything looks okay for the RecoverKerbal parameter.

- - - Updated - - -

I am having a small problem.

If I uncheck a contract type in the configurator window, eg: "Field Research", the setting is not remembered - later when I look back, the contract type has been re-checked and the contracts are showing up. Am i missing something?

Also, but less important, is there a way to limit the number of contracts that are available at any one time?

One thing to keep in mind is that it's a per-save setting. If it's happening within the same save, then I need to see the logs from saving/loading (ie. when it's getting reset) to know what's going on.

For limiting contracts, in the Contracts.cfg in the Squad folder you can increase/decrease the number of offered contracts. There is not a way that is specific to only Contract Configurator contracts.

Share this post


Link to post
Share on other sites

Might be easier to show you it is a bit odd though. I use CapCom as well and that shows it correctly, so I am not sure what it is.

Mission Control Screenshot:

l7zUGtbm.jpg

CapCom Screenshot:

wYANyTmm.jpg

Share this post


Link to post
Share on other sites
You'll have to be more specific as to the behaviour you're seeing. I checked the code and everything looks okay for the RecoverKerbal parameter.

- - - Updated - - -

One thing to keep in mind is that it's a per-save setting. If it's happening within the same save, then I need to see the logs from saving/loading (ie. when it's getting reset) to know what's going on.

For limiting contracts, in the Contracts.cfg in the Squad folder you can increase/decrease the number of offered contracts. There is not a way that is specific to only Contract Configurator contracts.

Thanks for the responses, thats just what I need for the contract limit, cheers.

For the re-set problem, it does occur within the same save, it seems to happen if I leave KSC and come back (ie: fly a rocket and return). I'll see if I can find the logs when I get a chance.

Share this post


Link to post
Share on other sites

Small (maybe?) feature request. In the ALT+F10 menu would it be possible to allow seeing a list of the planets eligible for a contract? Either being able to go to the balance tab and clicking the planet to cycle through, or some other way.

Ninja Edit - Soooo, activeUniqueValue on a DATA node. Does that just apply to that DATA node on that contract? So it wouldn't restrict a separate contract type?

Ok, so I applied activeUniqueValue to this DATA node:

    DATA
{
type = CelestialBody
activeUniqueValue = true
validTarget = @homeIsPlanet ? HomeWorld().Children().Where(cb => cb.HaveReached() == false).Random() : HomeWorld().Parent().Children().Where(cb => cb.HaveReached() == false && cb.IsHomeWorld() == false).Random()
}

But it would appear that it isn't allowing the two simultaneous max that I have. Basically I want it to be able to offer up to two contracts, but they have to be different bodies. Should I just be using UniqueValue instead?

Edited by Nori

Share this post


Link to post
Share on other sites
Small (maybe?) feature request. In the ALT+F10 menu would it be possible to allow seeing a list of the planets eligible for a contract? Either being able to go to the balance tab and clicking the planet to cycle through, or some other way.

Eligible how so? It's whatever's specified by the contract config. Keep in mind that you can see the value of all contract attributes too. So you could do this:


DATA
{
type = List<CelestialBody>

validBodies = OrbitedBodies()
}

targetBody = @validBodies.Random()

And then mouse-over the contract, and find the value for validBodies (which would say something like [ Kerbin, Mun, Minmus]).

- - - Updated - - -

Edit 2.5 - Ok, so I applied activeUniqueValue to this DATA node:

    DATA
{
type = CelestialBody
activeUniqueValue = true
validTarget = @homeIsPlanet ? HomeWorld().Children().Where(cb => cb.HaveReached() == false).Random() : HomeWorld().Parent().Children().Where(cb => cb.HaveReached() == false && cb.IsHomeWorld() == false).Random()
}

But it would appear that it isn't allowing the two simultaneous max that I have. Basically I want it to be able to offer up to two contracts, but they have to be different bodies. Should I just be using UniqueValue instead?

Use uniqueValue if you only ever want it offered once for a given body (like the SCANsat or RemoteTech contract packs). Use activeUniqueValue if you just only want one contract at a time for a given body. So sounds like you should use activeUniqueValue.

When you say it's not working - is it that you're only getting one contract? Or two contracts for the same body?

Share this post


Link to post
Share on other sites
Eligible how so? It's whatever's specified by the contract config. Keep in mind that you can see the value of all contract attributes too. So you could do this:


DATA
{
type = List<CelestialBody>

validBodies = OrbitedBodies()
}

targetBody = @validBodies.Random()

And then mouse-over the contract, and find the value for validBodies (which would say something like [ Kerbin, Mun, Minmus]).

- - - Updated - - -

Use uniqueValue if you only ever want it offered once for a given body (like the SCANsat or RemoteTech contract packs). Use activeUniqueValue if you just only want one contract at a time for a given body. So sounds like you should use activeUniqueValue.

When you say it's not working - is it that you're only getting one contract? Or two contracts for the same body?

Hmm, currently with the DATA node that I put in my previous post, I don't see a way to view those values. Can/should I change the type to be List<CelestialBody>?

Yeah uniqueValue wouldn't help me as the body is no longer eligible after you HaveReached(). activeUniqueValue seems spot on, but unless I'm doing something wrong, or getting some really insanely unlucky RNG, it most certainly isn't offering both of the eligible bodies at the same time.

So yeah before it was offering the same contract twice for the same body, now it will only show one contract for one body.

Share this post


Link to post
Share on other sites
Hmm, currently with the DATA node that I put in my previous post, I don't see a way to view those values. Can/should I change the type to be List<CelestialBody>?

Yeah uniqueValue wouldn't help me as the body is no longer eligible after you HaveReached(). activeUniqueValue seems spot on, but unless I'm doing something wrong, or getting some really insanely unlucky RNG, it most certainly isn't offering both of the eligible bodies at the same time.

So yeah before it was offering the same contract twice for the same body, now it will only show one contract for one body.

Yeah, just break it up into two different steps if you want to see the intermediate values. It very feasible that it's bad RNG luck... I know I've hit the same issue many times when testing this stuff... if you want to make really sure, then make the conditions for you test as ideal as possible (disable other contracts, increase your prestige, increase the max number of offered contracts, etc.).

Share this post


Link to post
Share on other sites

Ok, just did a dozen clear all active contracts and finally got it to consistently show two. That be some seriously crazy RNG...

Share this post


Link to post
Share on other sites

Is there a way to have a cooldown on a repeatable contract? I'm seeing the cooldown as a requirement, but not something to apply to a contract on say completion.

Share this post


Link to post
Share on other sites

I keep receiving this error.

Exception occured while saving contract parameter 'Orbit' in contract 'first_OrbitUncrewed':

System.NullReferenceException: Object reference not set to an instance of an object

at ContractConfigurator.Parameters.OrbitParameter.OnParameterSave (.ConfigNode node) [0x00000] in <filename unknown>:0

at ContractConfigurator.Parameters.ContractConfiguratorParameter.OnSave (.ConfigNode node) [0x00000] in <filename unknown>:0

Share this post


Link to post
Share on other sites
I keep receiving this error.

Exception occured while saving contract parameter 'Orbit' in contract 'first_OrbitUncrewed':

System.NullReferenceException: Object reference not set to an instance of an object

at ContractConfigurator.Parameters.OrbitParameter.OnParameterSave (.ConfigNode node) [0x00000] in <filename unknown>:0

at ContractConfigurator.Parameters.ContractConfiguratorParameter.OnSave (.ConfigNode node) [0x00000] in <filename unknown>:0

Can you confirm which version of Contract Configurator you're on, as well as what contract pack(s) you have installed?

- - - Updated - - -

Is there a way to have a cooldown on a repeatable contract? I'm seeing the cooldown as a requirement, but not something to apply to a contract on say completion.

Hmm.... I thought there was a better way, but this is all I could think of at the moment:

REQUIREMENT
{
type = Any

REQUIREMENT
{
type = CompleteContract

contractType = MyContract

cooldownDuration = 10d
}

REQUIREMENT
{
type = CompleteContract

contractType = MyContract

invertRequirement = true
}
}

Share this post


Link to post
Share on other sites

Ok I'll try that. If it isn't too much work I would love to have a simple cooldown option. :)

Share this post


Link to post
Share on other sites

I'm on 1.6.5 and I have Realistic Progression Zero and DMagic Science as my only contract packs I believe. Also, all of my altitude requirements have become "Below 0 m".

Edited by Hlaford
Added more details.

Share this post


Link to post
Share on other sites
Ok I'll try that. If it isn't too much work I would love to have a simple cooldown option. :)

I double-checked, there is an easier way:

REQUIREMENT
{
type = CompleteContract

contractType = MyContract

minCount = 0
cooldownDuration = 10d
}

I'm on 1.6.5 and I have Realistic Progression Zero and DMagic Science as my only contract packs I believe. Also, all of my altitude requirements have become "Below 0 m".

The altitude makes sense - it's directly caused by the previous failure. Have you had and issues with RSS? Installed/uninstalled planet packs?

Share this post


Link to post
Share on other sites

I have not had any issues with RSS, only the contracts. Everything else seems to be working fine. I'm not sure what causes this. I have uninstalled and reinstalled RSS. I don't want to uninstall all of my mods and reinstall since this happened before and I did that and fixed it for a little while, but then it started up again.

Share this post


Link to post
Share on other sites
I have not had any issues with RSS, only the contracts. Everything else seems to be working fine. I'm not sure what causes this. I have uninstalled and reinstalled RSS. I don't want to uninstall all of my mods and reinstall since this happened before and I did that and fixed it for a little while, but then it started up again.

If it happens again, please provide your KSP.log file... I've got sort of a fix for 1.6.6.... but I think I'm just fixing the symptom, I can't figure out a good reason why it would be happening (and it may not be Contract Configurator, but Kopernicus). It seems that CC isn't able to find the saved body by name (not sure which contract, but likely it's looking for "Earth"). So the only thing that makes sense is if you loaded without the RSS configuration or something odd like that (ie. it's looking for "Earth", but "Kerbin" is there).

Share this post


Link to post
Share on other sites

So working on some new ideas and it got me to wondering if there is a way to say complete a task for all of these bodies.

For example. Lets say we take the code you posted for me last page:


DATA
{
type = List<CelestialBody>

validBodies = OrbitedBodies()
}

Ok, so I got a list of bodies that have been Orbited.

From the list documentation I know that you can take, first, last, 1,2,3 etc... of that list.

But is there a way to take everything and have a task to complete?

For instance, something like this would grab Mun and Minmus and require you to hit 10km on each.


DATA
{
type = List<CelestialBody>

validBodies = HomeWorld().Children()
}
PARAMETER
{
name = ReachState
type = ReachState
targetBody = validBodies
maxAltitude = 10000
}

Share this post


Link to post
Share on other sites
So working on some new ideas and it got me to wondering if there is a way to say complete a task for all of these bodies.

For example. Lets say we take the code you posted for me last page:


DATA
{
type = List<CelestialBody>

validBodies = OrbitedBodies()
}

Ok, so I got a list of bodies that have been Orbited.

From the list documentation I know that you can take, first, last, 1,2,3 etc... of that list.

But is there a way to take everything and have a task to complete?

For instance, something like this would grab Mun and Minmus and require you to hit 10km on each.


DATA
{
type = List<CelestialBody>

validBodies = HomeWorld().Children()
}
PARAMETER
{
name = ReachState
type = ReachState
targetBody = validBodies
maxAltitude = 10000
}

It's been requested a few times, but something like that would be a pretty big thing to do. Right now the only way is to manually expand it, and have a REQUIREMENT to check if you've gone off the end of the list (example from here):

       PARAMETER
{
name = InnerTarget
type = Any
title = Point a dish at ONE of the inner planets


disableOnStateChange = false


PARAMETER
{
name = HasAntenna
type = HasAntenna


antennaType = Dish
targetBody = @/targetBodies.ElementAt(0)
}


PARAMETER
{
name = HasAntenna
type = HasAntenna


antennaType = Dish
targetBody = @/targetBodies.ElementAt(1)


REQUIREMENT
{
type = Expression
expression = @/targetBodies.Count() > 1
}
}
...

Share this post


Link to post
Share on other sites

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.