Jump to content

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


nightingale

Recommended Posts

Quick question related to a contract pack I'm hoping to make: Any chance of making Vessel name searchable by expressions? I couldn't find anything in the wiki regarding this. (I really wish there was a way to search the wiki only on GitHub)

If it could support wildcards that would be even better!

Vessel Parameter Group would not help me in this situation, as there would be no previous contracts to mark it with the identifier. I want to give the player a way of marking a vessel as stranded. Then, I'll offer a contract to rescue the crew.

Basically I want something like this:


DATA
{
type = Vessel
targetVessel = AllVessels().Where(v => v.VesselName() == *Lost).Random()
}

Raised [#336]. What I'll do is get you some string functions, so you can do this:


DATA
{
type = Vessel
targetVessel = AllVessels().Where(v => v.VesselName().Contains("Lost")).Random()
}

Note that I don't really like what you're suggesting as a game mechanic though. You could try looking for vessels with fuel under a certain level (which could be modified by vessel mass and planet mass) to be able to look at vessels with crew but not enough delta-v to make it into orbit.

Link to comment
Share on other sites

So I was thinking of a idea for some contracts (circumnavigating Kerbin in an aircraft is the obvious example) where you fail if you land anywhere but the Runway, i.e. even if you touch down then take off again and continue and then land on the runway, too bad - contract failed!

Now the obvious way to implement this is to have a None Parameter with a ReachState child Parameter for landing anywhere else. So my question is is it possible to do something where you have ReachState Situation Landed and Biome NOT Runway, so something like this:


PARAMETER
{
name = DontLand
type = None
title = Don't land anywhere else but the Runway.
completeInSequence = true

PARAMETER
{
name = LandedNotRunway
type = ReachState
situation = LANDED
biome != Runway
}

PARAMETER
{
name = InTheDrink
type = ReachState
situation = SPLASHED
}

PARAMETER
{
name = GoingToSpaceIsNotAllowed
type = ReachState
situation = SUB_ORBITAL
}
}

or instead do I have to enumerate every other Biome in an Any Parameter like so: (possible, but annoying)

PARAMETER{
name = DontLand
type = None
title = Don't land anywhere else but the Runway.
completeInSequence = true

PARAMETER
{
name = NothingButRunway
type = Any
PARAMETER
{
name = LandedNotRunway
type = ReachState
situation = LANDED
biome = Shores
}
//Repeat ad infinitum for every other Biome......
}

PARAMETER
{
name = InTheDrink
type = ReachState
situation = SPLASHED
}

PARAMETER
{
name = GoingToSpaceIsNotAllowed
type = ReachState
situation = SUB_ORBITAL
}
}

I guess if it is not possible currently then it would come with support for logical ORs in parameters (this issue on GitHub).

I suspect it is not possible, but thought I'd ask. Love this Mod and the contract variety it gives either way. :)

Edited by Chonner
Link to comment
Share on other sites

So I was thinking of a idea for some contracts (circumnavigating Kerbin in an aircraft is the obvious example) where you fail if you land anywhere but the Runway, i.e. even if you touch down then take off again and continue and then land on the runway, too bad - contract failed!

Now the obvious way to implement this is to have a None Parameter with a ReachState child Parameter for landing anywhere else. So my question is is it possible to do something where you have ReachState Situation Landed and Biome NOT Runway, so something like this:

I've not tested this, but have you tried failWhenCompleteOutOfOrder?

Something like this:


PARAMETER
{
name = Sequence
type = Sequence
failWhenCompleteOutOfOrder = true

PARAMETER
{
name = ReachState
type = ReachState
situation = LANDED
biome = Runway
}

PARAMETER
{
name = ReturnHome
type = ReturnHome
}
}

I'm 95% certain that will cause the contract to fail if the player touches Kerbin without being on the runway. I'm also 5% certain that it may cause it to fail even if he does touch the runway.

Link to comment
Share on other sites

So I was thinking of a idea for some contracts (circumnavigating Kerbin in an aircraft is the obvious example) where you fail if you land anywhere but the Runway, i.e. even if you touch down then take off again and continue and then land on the runway, too bad - contract failed!

Now the obvious way to implement this is to have a None Parameter with a ReachState child Parameter for landing anywhere else. So my question is is it possible to do something where you have ReachState Situation Landed and Biome NOT Runway, so something like this:


PARAMETER
{
name = DontLand
type = None
title = Don't land anywhere else but the Runway.
completeInSequence = true

PARAMETER
{
name = LandedNotRunway
type = ReachState
situation = LANDED
biome != Runway
}

PARAMETER
{
name = InTheDrink
type = ReachState
situation = SPLASHED
}

PARAMETER
{
name = GoingToSpaceIsNotAllowed
type = ReachState
situation = SUB_ORBITAL
}
}

or instead do I have to enumerate every other Biome in an Any Parameter like so: (possible, but annoying)

PARAMETER{
name = DontLand
type = None
title = Don't land anywhere else but the Runway.
completeInSequence = true

PARAMETER
{
name = NothingButRunway
type = Any
PARAMETER
{
name = LandedNotRunway
type = ReachState
situation = LANDED
biome = Shores
}
//Repeat ad infinitum for every other Biome......
}

PARAMETER
{
name = InTheDrink
type = ReachState
situation = SPLASHED
}

PARAMETER
{
name = GoingToSpaceIsNotAllowed
type = ReachState
situation = SUB_ORBITAL
}
}

I guess if it is not possible currently then it would come with support for logical ORs in parameters (this issue on GitHub).

I suspect it is not possible, but thought I'd ask. Love this Mod and the contract variety it gives either way. :)

In general I can't implement the !=, because that's part of the ConfigNode handling code (ie. stock KSP). There's a good chance that severedsolo's suggestion will work.

I'm not sure if I'm ever going to do #143 due to the complexity. ;)

If severedsolo's suggestion doesn't work, I can't think of another suggestion. The best change that could be made to support this to would be to allow lists for some of the ReachState attributes, then you could do something like (I didn't look up the exact functions, so might've gotten this wrong):


PARAMETER
{
name = AnyBiomeButRunway
type = ReachState
situation = LANDED
biome = @/targetBody.Biomes().Where(b => b != Runway)
}

... but that is a non-trivial change. Anyway, if you do need it, raise an enhancement and I'll see what I can do.

Link to comment
Share on other sites

I've not tested this, but have you tried failWhenCompleteOutOfOrder?

Something like this:

I'm 95% certain that will cause the contract to fail if the player touches Kerbin without being on the runway. I'm also 5% certain that it may cause it to fail even if he does touch the runway.

In general I can't implement the !=, because that's part of the ConfigNode handling code (ie. stock KSP). There's a good chance that severedsolo's suggestion will work.

I'm not sure if I'm ever going to do #143 due to the complexity. ;)

If severedsolo's suggestion doesn't work, I can't think of another suggestion. The best change that could be made to support this to would be to allow lists for some of the ReachState attributes, then you could do something like (I didn't look up the exact functions, so might've gotten this wrong):


PARAMETER
{
name = AnyBiomeButRunway
type = ReachState
situation = LANDED
biome = @/targetBody.Biomes().Where(b => b != Runway)
}

... but that is a non-trivial change. Anyway, if you do need it, raise an enhancement and I'll see what I can do.

Thank you for the reply guys. I implemented Severedsolo's suggestion in a test contract (A simple reach 500m then land back on the runway) and it seems to be a bit temperamental. Occasionally when taking off it would trigger the failure, despite using completeInSequence = true and not having completed preceding parameters. (Maybe I'm reading the explanation of completeInSequence wrong, but I thought it meant a parameter wouldn't even be tested for until previous parameters are completed.)

I understand about the != not being possible (was just an example syntax anyway), so no worries there. The lists for attributes would be awesome, allowing it to be done dynamically as opposed to specifying every other biome manually but maybe a very niche use case and not worth your effort, will see how much I use this kind of thing anyway.

I also just implemented the same simple test contract using the None of ReachStates enumerated over a few biomes and it seems to work and could be a suitable brute force method, the only problem seems to be that being on the Runway is actually being in two Biomes simultaneously, as both biome = Runway and biome = Shores returns true when you are there, so I can't prohibit landing at Shores. I guess that is just an unavoidable idiosyncrasy of the KSC Biomes that will be liveable. :)

Link to comment
Share on other sites

Has anyone compiled a video showing off some basics on how to create a contract in KSP? I'm looking for a tutorial. Totally new to modding. Thought I'd start with creating a Contract Pack for regular charter flights to KSC Island for funds. Is there an absolute bare-minimum basic Contract Pack example I can look at? The wiki has lots of good info, but the info is all over the place.

Edited by inigma
Link to comment
Share on other sites

Thank you for the reply guys. I implemented Severedsolo's suggestion in a test contract (A simple reach 500m then land back on the runway) and it seems to be a bit temperamental. Occasionally when taking off it would trigger the failure, despite using completeInSequence = true and not having completed preceding parameters. (Maybe I'm reading the explanation of completeInSequence wrong, but I thought it meant a parameter wouldn't even be tested for until previous parameters are completed.)

I understand about the != not being possible (was just an example syntax anyway), so no worries there. The lists for attributes would be awesome, allowing it to be done dynamically as opposed to specifying every other biome manually but maybe a very niche use case and not worth your effort, will see how much I use this kind of thing anyway.

I also just implemented the same simple test contract using the None of ReachStates enumerated over a few biomes and it seems to work and could be a suitable brute force method, the only problem seems to be that being on the Runway is actually being in two Biomes simultaneously, as both biome = Runway and biome = Shores returns true when you are there, so I can't prohibit landing at Shores. I guess that is just an unavoidable idiosyncrasy of the KSC Biomes that will be liveable. :)

Ugh, that Runway/Shores biome thing sucks. I suppose you could use a waypoint instead - although it won't have the same accuracy.

Oh, and the completeInSequence does not prevent parameters from being tested - it'll only prevent them from completing. Works that way for technical reasons.

Has anyone compiled a video showing off some basics on how to create a contract in KSP? I'm looking for a tutorial. Totally new to modding. Thought I'd start with creating a Contract Pack for regular charter flights to KSC Island for funds. Is there an absolute bare-minimum basic Contract Pack example I can look at? The wiki has lots of good info, but the info is all over the place.

As far as I know, nobody has done a video tutorial (Contract Configurator isn't very visual). Best thing to do once you've read the How-To page on the wiki would be to look at examples. You can have a look at one of the Anomaly Surveyor contracts for visiting the island runway, and the contracts in Tourism Plus. Pretty much combining those two concepts would get you the contract you're looking to start with.

If there's specific things that you think are unclear/missing in the wiki, I can look at making changes there too.

Link to comment
Share on other sites

Thanks nightingale

I just got my first contract to show up. Now on to configure it. I'll look at the anomaly and tourism plus contracts for reference and see if I can't make this work out on my own. Thanks again!

Update:

Looking great. Kerbal Aircraft Builders by maculator was a great starting point, as well as Tourism Plus and the examples on the wiki. I hope to explore further parameters so this is crafted to what I have in mind. I'll need to add the passengers param next.

QeczqeI.png

Thanks for inspiring me to get started modding, even if its only dealing with contracts at the moment. I've not settled on a new name for the agency, so I rehashed my old SSI craft building company as a reference point. I'll post when I have questions I can't find an answer to. Hopefully this contract will be fleshed out in time for 1.0.5 and that cool mk1 passenger module. :)

Edited by inigma
Link to comment
Share on other sites

Hi nightingale, I've updated Contract Configurator to your latest version but I'm not getting any contracts in Mission Control, despite having checked the debug menu and found 231 out of 261 contracts loaded OK (of the 30 contracts not apparently loaded you might want to note that quite a lot are in your contract packs; namely the Anomaly, Field Research, RemoteTech, and Tourism packs). I can provide further info about other mods I'm running if you like, but I can't think what else would have affected the contracts system.

Link to comment
Share on other sites

Hi nightingale, I've updated Contract Configurator to your latest version but I'm not getting any contracts in Mission Control, despite having checked the debug menu and found 231 out of 261 contracts loaded OK (of the 30 contracts not apparently loaded you might want to note that quite a lot are in your contract packs; namely the Anomaly, Field Research, RemoteTech, and Tourism packs). I can provide further info about other mods I'm running if you like, but I can't think what else would have affected the contracts system.

Are you running SCANsat? Looks like there will need to be a new update, the current release version fails to load. Otherwise, provide a log, and I'll take a look.

Link to comment
Share on other sites

Nightingale, is there a way to fix the heading of a spawned kerbal on land? I want passengers at KSC Island to spawn facing the runway, heading 0.0. Currently they default to heading of 180.0. The heading attribute is not recognized by Contract Configurator for SpawnKerbals unlike SpawnVessel. Also, any way to spawn a kerbal with their helmet off?

I completed my contract successfully. I completed my first fly over to the island, picked up the spawned kerbals, and came back to KSC runway and returned the kerbals. Lots of fun. Was much simpler than I thought it would be.

and Im all in a giggle since I just figured out how to spawn a craft... on the island, for one way return flight contracts if desired. HA! thanks nightingale for an awesome mod.

Edited by inigma
Link to comment
Share on other sites

Nightingale, is there a way to fix the heading of a spawned kerbal on land? I want passengers at KSC Island to spawn facing the runway, heading 0.0. Currently they default to heading of 180.0. The heading attribute is not recognized by Contract Configurator for SpawnKerbals unlike SpawnVessel. Also, any way to spawn a kerbal with their helmet off?

I completed my contract successfully. I completed my first fly over to the island, picked up the spawned kerbals, and came back to KSC runway and returned the kerbals. Lots of fun. Was much simpler than I thought it would be.

and Im all in a giggle since I just figured out how to spawn a craft... on the island, for one way return flight contracts if desired. HA! thanks nightingale for an awesome mod.

Raise a feature request on GitHub for adding support for the heading attribute in SpawnKerbal. I'm pretty sure right now they just spawn with their heads pointing at the global "up" (kerbin north), fall to the ground and get up.

There's no way to spawn them without their helmets - mods that do remove their helmets (ie. Texture Replacer) do it on the fly. It's not impossible, but would require me saving info to the persistence file about whether their helmet is on/off, and then writing code to use that. In other words, a lot of work. Better bet is to recommend players use Texture Replacer (with its default settings, Kerbals on Kerbin EVA don't wear helmets).

Link to comment
Share on other sites

New release with KSP 1.0.5 support! Download now!

Contract Configurator 1.8.0

  • Support for KSP 1.0.5

Heya nightingale! Great job as always :)

I'm just curious since that was a super quick turnaround for a new CC version. Don't the contract changes to stock in 1.0.5 make the way CC has previously tracked persistence obsolete now? I don't pretend to understand your code :) but it seems there's now stock APIs that can be called in place of custom entries in the sfs?

Is that something you plan on switching over to or do I totally misunderstand the changes to stock contracts?

Link to comment
Share on other sites

Heya nightingale! Great job as always :)

I'm just curious since that was a super quick turnaround for a new CC version. Don't the contract changes to stock in 1.0.5 make the way CC has previously tracked persistence obsolete now? I don't pretend to understand your code :) but it seems there's now stock APIs that can be called in place of custom entries in the sfs?

Is that something you plan on switching over to or do I totally misunderstand the changes to stock contracts?

There's really nothing to switch over to. Most of the work for contextual contracts is around selecting "appropriate" vessels for that contextual contract (example: you don't want to choose something landed on the surface for a "reposition satellite" contract). As far as I know, this logic is baked right into each type of contract. Also, Contract Configurator provides modders with the ability to do that type of thing through its expression syntax.

There's some new logic in 1.0.5 for tracking a numeric "progress" variable that is used internally to determine when certain types of contracts get offered. I'll have to do some research to understand the details, but it might be worthwhile to expose that one (but this would only benefit modders looking to do new contracts). Aside from that, wasn't much for me to do for the 1.0.5 release, just a couple API updates.

Link to comment
Share on other sites

Nightingale. Thanks. You're awesome.

Dev Thread: http://forum.kerbalspaceprogram.com/threads/138997-WIP-SSI-Aerospace-Contract-Pack-%280-0-1a%29-Early-Career-Air-Charters-%28Giving-Aircraft-a-Purpose%29?p=2287639#post2287639

SSI Aerospace Contract Pack

http://www./download/4ml3kij5jad3py1/SSI_Aerospace_Contract_Pack_0.0.1a.zip

just gettin' started... ;)

Btw, trying to spawn my STS-7E (see my sig) on the island is making for very funny and explosive results. I might ask for help with it if I can't figure it out. My goal its to create a test contract requiring pick up of kerbals from island, and fly them back to ksc, drive them in a spawned astrovan waiting at the sph to the astronaut complex to pick up more crew, drive them to launch pad, load spawned space shuttle and complete fuel pod delivery to orbit with safe return to KSC. Might even try to launch space shuttle from island or even KSC2.

Edited by inigma
Link to comment
Share on other sites

Can you please find a way to switch off the very stupid contract decline penalties. I know they nothing to do with you but I am only asking because your probably the best qualified person around. I know there is work around where we can stop any type of contract at will with Contract Configurer settings. That is what I am using now to fine tune progression and timing when all the various contract packs appear. However this new game play feature in stock where contracts can't be avoided is so dumb. Lets kill if off please.

There's some new logic in 1.0.5 for tracking a numeric "progress" variable that is used internally to determine when certain types of contracts get offered. I'll have to do some research to understand the details, but it might be worthwhile to expose that one (but this would only benefit modders looking to do new contracts). Aside from that, wasn't much for me to do for the 1.0.5 release, just a couple API updates.
I seen this one coming and was actually going to ask you do something similar. Then changed my mind because it is mostly done in another way in the SETI contracts pack. I don't know the exact way it was put in but my idea was based on the diagram of SETI http://forum.kerbalspaceprogram.com/threads/106130#SETIcontracts . Take a ruler and draw lines across in and you see a pattern. At the top is low technology contracts and at the bottom is high technology contacts. As the player moves along the flow chart give him an increasing score and use that to judge what the next technology tier is available to spawn contracts. So if orbit and recovery is unlocked you can use this score to trigger say the Remote tech pack. That way Remote tech does not appear until after the first successful orbit. It just gets toggled on in settings when the score hits the right number. Right now I deselect the pack in settings and switch it back on when appropriate manually. It could be a way to automate this based on progress.

Anyway. It will be interesting to see what you turn up.

Edited by nobodyhasthis
Link to comment
Share on other sites

Can you please find a way to switch off the very stupid contract decline penalties. I know they nothing to do with you but I am only asking because your probably the best qualified person around.

An addon is not necessary to turn these off, simply tune them to zero in the difficulty settings.

Link to comment
Share on other sites

Yup, like Arsonide said, me doing it would be somewhat redundant, since it can be disabled as part of the game settings. If it's for an existing save, Torgo mentioned how to do it in the contract decline penalty thread:

You can adjust the rep penalty when starting a new game.

If you're in a current game, find this line in your persistence file:

RepLossDeclined = 1

And set it to:

RepLossDeclined = 0

Link to comment
Share on other sites

Yup, like Arsonide said, me doing it would be somewhat redundant, since it can be disabled as part of the game settings. If it's for an existing save, Torgo mentioned how to do it in the contract decline penalty thread:

Thank you! Did not see the answer from Torgo. Save game has been saved by using the manual adjustment.

Link to comment
Share on other sites

I'm playing RO/RSS/RP-0 with FASA, KCT and various other mods. I've currently got an Apollo CSM in orbit and am in the process of running an RP-0 "3/LEO" contract which requires me to maintain a specific orbit for 13 days. I've completed just shy of 10 days of the contract so far. Rather than hang about in orbit, I wanted to prepare some new rockets for some other contracts. So I returned to KSC, loaded into the VAB, built and "launched" the rockets then returned to my Apollo CSM. That's when I noticed that the timer on the contract was reset back to 13 days. So after a bunch of testing I came to discover that if you launch a craft (presumably from the VAB or SPH but I only tested from the VAB), any contract timers get reset.

I should point out that I'm still using CC 1.7.7 and KSP 1.0.4.

Link to comment
Share on other sites

I'm playing RO/RSS/RP-0 with FASA, KCT and various other mods. I've currently got an Apollo CSM in orbit and am in the process of running an RP-0 "3/LEO" contract which requires me to maintain a specific orbit for 13 days. I've completed just shy of 10 days of the contract so far. Rather than hang about in orbit, I wanted to prepare some new rockets for some other contracts. So I returned to KSC, loaded into the VAB, built and "launched" the rockets then returned to my Apollo CSM. That's when I noticed that the timer on the contract was reset back to 13 days. So after a bunch of testing I came to discover that if you launch a craft (presumably from the VAB or SPH but I only tested from the VAB), any contract timers get reset.

I should point out that I'm still using CC 1.7.7 and KSP 1.0.4.

There were some fixes related to this in Contract Configurator 1.7.8. If you're able to reproduce on that version I'll take a look.

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...