Jump to content

[1.10.1+] Contract Configurator [v1.30.5] [2020-10-05]


nightingale

Recommended Posts

Oh, great Kerbal in the clouds, thank you!!! Procedural contracts are fine, but do not nudge in any particular direction. I much prefer having a story, so I wiil at some time be able to say "I did it! OK, time to start a new game."

If possible:

- Keep track of a custom variable and its label. I want contracts to study anomalies and make further contracts available after XX ponts of 'Anomaly Research'. This way you don't have to complete all anomaly contracts before moving the story along.

- Not sure how to phrase this: After contract 'Annual Review- Year 1' is completed, 'Annual Review- Year 2' has to wait a year before becoming available.

- Make a contract repeatable. Every XX days, it will became available again. This is for automated incomes or resupply missions. Not sure what to do if the vessel to be resupplied no longer exists. If there was a way to choose automatically refuelling the vehicle and getting 80% of what you got last time, that much better.

I did some work on getting the 'Kerbals in Space' mission set for MCE updated, but that mod went in a procedural direction. I look forward to converting it.

Link to comment
Share on other sites

Oh, great Kerbal in the clouds, thank you!!! Procedural contracts are fine, but do not nudge in any particular direction. I much prefer having a story, so I wiil at some time be able to say "I did it! OK, time to start a new game."

Thanks! That's the exact kind of contract I want to see created from this!

- Keep track of a custom variable and its label. I want contracts to study anomalies and make further contracts available after XX ponts of 'Anomaly Research'. This way you don't have to complete all anomaly contracts before moving the story along.

Are you willing to do a little coding? What you'd need is a ContractBehaviour (new thing, more on this when 0.3.0 drops in a few days) that increments the Anomaly Research points. You'd also need a ContractRequirement that makes a contract require a certain minimum/maximum of AR points. What I'd provide for sure is some functions/classes for a generic persistant data store - ie. pass a config node and I'll store it in the save file.

It *may* get to the point where I've got enough generic stuff so you could do all this without coding anything yourself. However, I think you'd want a way to display to the players how much AR they've accumulated, and *that* would definitely be outside the scope of Contract Configurator.

- Not sure how to phrase this: After contract 'Annual Review- Year 1' is completed, 'Annual Review- Year 2' has to wait a year before becoming available.

That's cool, I think I can add something for this. Right now you can require another contract to be complete (see the CompleteContract requirement), but there's nothing for the date piece. GitHub issue created.

- Make a contract repeatable. Every XX days, it will became available again. This is for automated incomes or resupply missions. Not sure what to do if the vessel to be resupplied no longer exists. If there was a way to choose automatically refuelling the vehicle and getting 80% of what you got last time, that much better.

Very similar to above, I think once I get that one working you'd be able to do this as well.

Link to comment
Share on other sites

Thanks! That's the exact kind of contract I want to see created from this!

I think you'd want a way to display to the players how much AR they've accumulated.

Actually no, I want it to be a hidden variable, an unknown element.

Looking at the wiki now. I'll start work on getting KIS (Kerbals in Space, originally by Geckgo) converted to your format. I look forward to v0.3!

Link to comment
Share on other sites

Version 0.3.0 is out, with still more new features! Download it now!

Contract Configurator 0.3.0

- Support for ContractBehaviour - extensible behaviours at the contract level.

- Support for a persistent data store.

- Support for disabling other contract types

- Support for contract level notes.

- Support for using TextGen generated descriptions.

- Added Timer parameter.

- Added Expression requirement.

- Added SpawnKerbal behaviour.

- Added Expression behaviour.

- Added cooldownDuration to CompleteContract requirement.

- Added weight to CONTRACT_TYPE to support genering some contract types with higher/lower probability.

- Increase the odds of a ContractConfigurator contract being generated (versus a stock or traditionally defined contract) based on the number of configured contracts.

- VesselParameterGroup now works with deeply nested children (previously would only work with direct children).

- Various minor bug-fixes.

Some focus on a few of the more interesting features:

Disabling Stock Contracts

You asked for it, you got it! You can now have full contractual control.

Contract Behaviours

Contract behaviours are the new system (the others being parameters and requirements). A behaviour is a contract-level hook that can be used to introduce logic on the contract. This can be used for things that aren't appropriate for a parameter (as a parameter forces the player to meet it) or is common across multiple parameters. Right now there is out of the box behaviours for spawning Kerbals, and another special one (that I'll get to in a moment).

Persistent Data Store

The persistent data store is of interest to anyone who is extending Contract Configurator. This gives an easy way to store data in the player's save file. Use this to track data across different contracts.

Expression Behaviours and Requirements

There is now an expression parser that uses the persistent data store. The behaviour side of the house gives the ability to store data (based on an expression) on certain contract events (accepted, failed, succeeded). The requirement side is used to make a contract only show up if the expression is true.

For example, if I wanted to use it to keep track of something we'll call... "Anomaly Research" (@Space_Nomad, I hope you're listening :wink:) we would have the following behaviour:


BEHAVIOUR
{
name = AnomalyResearch
type = Expression


CONTRACT_COMPLETED_SUCCESS
{
AnomalyResearch = AnomalyResearch + 1
}
}

... which could be matched with a requirement like this on another contract:


REQUIREMENT
{
name = AnomalyResearch
type = Expression


expression = (AnomalyResearch >= 10)
}

There will be plenty more to come in the next release. The only question is... will it be 0.25 or 0.90? In the meantime, happy contracting!

Edited by nightingale
Link to comment
Share on other sites

And the TextGen stuff? How do we enable that?

This is totally completely not relevant to my mod.

From the wiki page for the CONTRACT_TYPE node:


[COLOR=#333333][FONT=Consolas] // Two options for specifying the description:
[/FONT][/COLOR] // 1) Supply the full text here in the description field
//description = A more detailed description of the contract.

// NEW!
// 2) Supply the following fields, which will be fed into the text
// generator. Use of the CoherentContracts mod is highly recommended,
// as it generates far more meaningful text.
topic = ContractConfigurator // Topic of the contract. Should be a
// singular noun.
subject = Kerbal // Subject of the contract. See
// CoherentContracts for some possible values.
// Includes stuff like Kerbal, Experiment,
// Parts, Mun, MunSrf, etc.
motivation = test // Motivation for why we are doing the
// contract. See CoherentContracts for some
// possible values. Some values used are:
// flags, test, rescue.

I'm going to be doing some wiki cleanup today, I think maybe I'll add some more around this, as what's there is woefully inadequate for anyone not familiar with the different values that can be passed in.

Link to comment
Share on other sites

Heh, for some reason I expected 0.90 to drop on a Tuesday.

Contract Configurator failed the smoke test - there's issues that need to be fixed to make it run under 0.90, but most things seem good at a glance. Should have the 0.90 compatible version out soon enough (tonight, perhaps).

Link to comment
Share on other sites

Version 0.3.2 is out, with basic support for KSP 0.90. Download it now!

Contract Configurator 0.3.2

- (0.90) Support for KSP 0.90

- (0.90) Fixed VesselHasVisited (note the valid values for situation changed)

- Fixed a bug in the handling of VesselParameterGroup that would cause the countdown timer to reset when switching vessels.

Time to play with 0.90 for a bit and get some of the new features integrated!

Edited by nightingale
Link to comment
Share on other sites

nightingale

sorry for getting back to you so late, thank you so much for the quick reply earlier about the mod checking :)

I have a new issue for you. I'm trying to create a contract for KSA and I believe I'm doing something wrong.

First parameter of my contract is to achieve orbit around kerbin, however after getting to orbit I get no green checkmark :(

2ZmFZ76.png

EDIT: Ran over to the Mun as well, and no green checkmark for getting in orbit around either.

My contract: http://pastebin.com/ridKKg0N

Edited by scerion
Link to comment
Share on other sites

nightingale

sorry for getting back to you so late, thank you so much for the quick reply earlier about the mod checking :)

I have a new issue for you. I'm trying to create a contract for KSA and I believe I'm doing something wrong.

First parameter of my contract is to achieve orbit around kerbin, however after getting to orbit I get no green checkmark :(

http://i.imgur.com/2ZmFZ76.png

EDIT: Ran over to the Mun as well, and no green checkmark for getting in orbit around either.

My contract: http://pastebin.com/ridKKg0N

Your config looks good at a glance, but I won't be able to look in detail until tomorrow. Are you using hyperedit to test? I had some issues where hyperedit wouldn't fire all the expected events, which would prevent some parameters from firing at the right time. If that's the case and it works from a "manual" launch then we're okay. If that's not the problem then I'll do a bit more digging tomorrow.

Oh and nothing to do with your issue, but the way you have your contract set up with disableOnStateChange = true means you'd have to be doing all 4 of those things simultaneously, which is not likely what you want. Try without disableOnStateChange.

EDIT: Looking closer, I see you have the anti-hyperedit line in there, so safe to say you didn't use hyperedit. I'll dig into this.

EDIT2: I should wait until morning for these things. :) Your use of disableOnStateChange is fine - since the EnterOrbit parameter you've used (a stock one) would be better named HasEnteredOrbit (ie. having done it at some point in the past would be sufficient). Anyway, the contract you supplied worked perfectly for my quick test. Can you confirm you're on Contract Configurator 0.3.3 and KSP 0.90?

Edited by nightingale
Link to comment
Share on other sites

Your config looks good at a glance, but I won't be able to look in detail until tomorrow. Are you using hyperedit to test? I had some issues where hyperedit wouldn't fire all the expected events, which would prevent some parameters from firing at the right time. If that's the case and it works from a "manual" launch then we're okay. If that's not the problem then I'll do a bit more digging tomorrow.

Oh and nothing to do with your issue, but the way you have your contract set up with disableOnStateChange = true means you'd have to be doing all 4 of those things simultaneously, which is not likely what you want. Try without disableOnStateChange.

EDIT: Looking closer, I see you have the anti-hyperedit line in there, so safe to say you didn't use hyperedit. I'll dig into this.

EDIT2: I should wait until morning for these things. :) Your use of disableOnStateChange is fine - since the EnterOrbit parameter you've used (a stock one) would be better named HasEnteredOrbit (ie. having done it at some point in the past would be sufficient). Anyway, the contract you supplied worked perfectly for my quick test. Can you confirm you're on Contract Configurator 0.3.3 and KSP 0.90?

Yup no hyperedit :)

Definitely using ContractConfigurator 0.3.3, and KSP 0.90.

Here's the test bed. I'm starting up a brand new career, edited in enough funds and science to upgrade some of the facilities and purchase some science nodes to use a stock Munar craft (btw is there a way to check if a specific craft is used?). I only have Kerbal Engineer installed for mods and module manager (along with CC of course). And I edited in my own special agency (KSA).

From there basically the requirement is to plant a flag on the Mun but I wanted to add a few more checks along the way to ensure they start up a new craft.

So far I can get the contract to load and such, it just hasn't checked off whenever I expect those contract sections to complete.

I'll start up another brand new one and get the log to you if it doesn't key off for me again :)

Link to comment
Share on other sites

So far I can get the contract to load and such, it just hasn't checked off whenever I expect those contract sections to complete.

I was looking in all the wrong places. The reason it worked for me is I actually changed your contract - I removed the !ReachSpace requirement (so I could load it into my existing save). What happens is that KSP checks the contract requirements *every single frame*. As soon as the requirement is no longer true, the contract becomes invalid. But silently invalid - it removes it from your list, but never updates the contract GUI.

Anyway, obviously not what's intended here, and I already have the logic to handle this for another requirements. So I'll do a pass looking for all the requirements that shouldn't be re-checked after the contract is accepted. You'll have a fix in 0.4.0, which will come sometime before Christmas.

Link to comment
Share on other sites

This is all cleaned up now:

  1. By default, most requirements don't get checked for active requirements
  2. If someone wanted to change this behaviour, the attribute checkOnActiveContract is exposed for REQUIREMENT nodes.
  3. If it *does* get set up that way, instead of silently failing, now the contract is force-failed (with the notification going to the player), and the contract is removed from the window.

EDIT: Oh, and one last note - for the type of contract you're building, consider using the Sequence type to group instead of All. It won't make a difference in this instance, but you may run into cases where you want to the force the player into following the steps in the order given.

Edited by nightingale
Link to comment
Share on other sites

I was looking in all the wrong places. The reason it worked for me is I actually changed your contract - I removed the !ReachSpace requirement (so I could load it into my existing save). What happens is that KSP checks the contract requirements *every single frame*. As soon as the requirement is no longer true, the contract becomes invalid. But silently invalid - it removes it from your list, but never updates the contract GUI.

Anyway, obviously not what's intended here, and I already have the logic to handle this for another requirements. So I'll do a pass looking for all the requirements that shouldn't be re-checked after the contract is accepted. You'll have a fix in 0.4.0, which will come sometime before Christmas.

This is all cleaned up now:

  1. By default, most requirements don't get checked for active requirements
  2. If someone wanted to change this behaviour, the attribute checkOnActiveContract is exposed for REQUIREMENT nodes.
  3. If it *does* get set up that way, instead of silently failing, now the contract is force-failed (with the notification going to the player), and the contract is removed from the window.

EDIT: Oh, and one last note - for the type of contract you're building, consider using the Sequence type to group instead of All. It won't make a difference in this instance, but you may run into cases where you want to the force the player into following the steps in the order given.

wow awesome, thanks! :D Ooo guess I actually found a bug huh? Shall remote the requirement and see how it works then.

I actually initially had it set up as Sequence but thought that might have been making something invalid so changed it to All. Shall go ahead and fix too.

Link to comment
Share on other sites

Oh man, I'v been keeping an eye on github commits and I see scansat support is added. This is awesome. I can't wait for some kind of remotetech support. Keep up the awesome work!

Actually the SCANsat support wasn't planned for a little bit.... but Tattagreis was kind enough to code it up for me. :)

Oh, and RemoteTech support will be coming - just not in the next release (likely the one after). I may need to wait until their 0.90 release though - and I don't know when that will be.

Link to comment
Share on other sites

Hello,

I have a problem with funds this will fix it for now - nice mod !! Only thing is is this like Mission Extension mod I dont want bugs and mission mods to screw up the game long term (even tho I do gamesaves it is possible that once a bug hits a mission series it may mess it up forever and you have to start all over again.

I may look at it to look at contracts and manually write in a contract to solve my problem as well.

Zeta

Link to comment
Share on other sites

Hello,

I am in Debug and try to add contracts...where do I put them I have tried the contract config dir and others..it doesnt see the config files?

Coherent fig?? These are just dlls I see the program in debug mode but all add contracts doesnt work??

What is "E" "H" and "M" I click them nothing happens? What is TextGen where and how do I use it; there is no documentation.

Zeta

Link to comment
Share on other sites

Hello,

I am in Debug and try to add contracts...where do I put them I have tried the contract config dir and others..it doesnt see the config files?

Coherent fig?? These are just dlls I see the program in debug mode but all add contracts doesnt work??

What is "E" "H" and "M" I click them nothing happens? What is TextGen where and how do I use it; there is no documentation.

Zeta

From the first post:

Documentation

The user guide is hosted on the GitHub wiki.

Unless your no documentation comment was regarding TextGen. In that case, TextGen is the stock contract text generator, how it is used with Contract Configurator is documented here.

The short version of how to create contracts using Contract Configurator is:

  1. Create a new .cfg file in any directory you want under GameData.
  2. Read through the documentation, starting with the section on the main CONTRACT_TYPE node.
  3. If you're still not sure, take a look at some of the test contracts that I use for unit tests here. That should give you an idea of what to do.

Link to comment
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.

×
×
  • Create New...