nightingale

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

Recommended Posts

Ah, alrighty, well i guess ckan didnt update you mod in it's list. X3

edit: yeah, that did fix it. stupid ckan. XD

Ugh, it's because I never updated the .version file. The last time I tried to fix something like that with CKAN on the fly it just made a big mess of things... so I'll release 1.6.3 shortly to clean everything up.

Share this post


Link to post
Share on other sites

Release 1.6.3 without much new due to the version file not getting updated correctly in CKAN for 1.6.2 and it causing all kinds of problems. Download now!

Contract Configurator 1.6.3

  • New Tech methods Parents() and IsReadyToUnlock().

Share this post


Link to post
Share on other sites

Question about the optional parameter setting.

So a contract completes when all required parameters are completed. But what if you wanted, say, a optional return home parameter? Wouldn't the contract complete before you had a option to do the optional parameter? Or can you be rewarded on optional after a contract has completed?

I'm wanting to setup a series of probe missions that award extra science and funds if you return the probe. But I'm scratching my head on how you can do this since you would be returning potentially years after the other required parameters are done.

Ran across a strange issue. I'm loving the random kerbal name generator and am using it heavily in the descriptions. But for whatever reason, if I start with a name it won't output, even if the whole string is in quotes.

description =  "RandomKerbalName(Male) and RandomKerbalName(Female) something something (spoilers)"

That won't work, well it does, but it spits out RandomKerbalName(Male) and Valentina Kerman something something (spoilers)

But this does:

description = " RandomKerbalName(Male) and RandomKerbalName(Female) something something (spoilers)"

And one last question. Promise (well for at least a couple hours).

I could get the title = "Reach the edge: @/altkm" + "km" to work. Anything after the "+" doesn't even appear. I am just working around it by typing out meters or kilometers for now but wouldn't mind if I could go to abbreviations.

Edited by Nori

Share this post


Link to post
Share on other sites
Question about the optional parameter setting.

So a contract completes when all required parameters are completed. But what if you wanted, say, a optional return home parameter? Wouldn't the contract complete before you had a option to do the optional parameter? Or can you be rewarded on optional after a contract has completed?

I'm wanting to setup a series of probe missions that award extra science and funds if you return the probe. But I'm scratching my head on how you can do this since you would be returning potentially years after the other required parameters are done.

Yeah, this is tough to do. Optional parameters really need to be something that's done "in the middle" of the contract. The best alternative I can suggest would be a follow up contract - use the define attribute on the VesselParameterGroup parameter to "name" the vessel, and then have a contract that is for bringing <vessel> home.

Ran across a strange issue. I'm loving the random kerbal name generator and am using it heavily in the descriptions. But for whatever reason, if I start with a name it won't output, even if the whole string is in quotes.

description =  "RandomKerbalName(Male) and RandomKerbalName(Female) something something (spoilers)"

That won't work, well it does, but it spits out RandomKerbalName(Male) and Valentina Kerman something something (spoilers)

But this does:

description = " RandomKerbalName(Male) and RandomKerbalName(Female) something something (spoilers)"

And one last question. Promise (well for at least a couple hours).

I could get the title = "Reach the edge: @/altkm" + "km" to work. Anything after the "+" doesn't even appear. I am just working around it by typing out meters or kilometers for now but wouldn't mind if I could go to abbreviations.

These both sound buggy. Raised [#286] to look into it.

Share this post


Link to post
Share on other sites
Yeah, this is tough to do. Optional parameters really need to be something that's done "in the middle" of the contract. The best alternative I can suggest would be a follow up contract - use the define attribute on the VesselParameterGroup parameter to "name" the vessel, and then have a contract that is for bringing <vessel> home.

These both sound buggy. Raised [#286] to look into it.

Hmm, a follow up contract eh? That actually sounds like a pretty cool idea. Thanks for the suggestion.

Thanks for looking into that.

Share this post


Link to post
Share on other sites

How do you call the current vessel in a VesselParameterGroup?

For instance I'm trying to setup a reward so that you get x funds * Vessel().EmptyCrewSpace()

But CC says it doesn't know what Vessel it should have.

Share this post


Link to post
Share on other sites
How do you call the current vessel in a VesselParameterGroup?

For instance I'm trying to setup a reward so that you get x funds * Vessel().EmptyCrewSpace()

But CC says it doesn't know what Vessel it should have.

I think you can make that on the DATA node but I dont really know if that work

Share this post


Link to post
Share on other sites

I found a tiny mistype in the wiki (that is otherwise quite well laid out. Thank you for that) on page https://github.com/jrossignol/ContractConfigurator/wiki/Contract-Type

In the big code block, when discussing REQUIREMENT nodes, you have the word PARAMETER in there instead of REQUIREMENT.


// The PARAMETER node defines a contract requirement - a prerequisite

should be


// The REQUIREMENT node defines a contract requirement - a prerequisite

Also, and I don't know why, but reloading the contracts won't reload Agents, even if those agents are within the contract files themselves.

And yes this does mean I'm working on a contract pack.

Edited by 5thHorseman

Share this post


Link to post
Share on other sites

Yeah I can't seem to get it to work. I was trying this, but it appears to get the value when contract is accepted. So it is 0.

	DATA
{
type = int
emptycrew = Vessel(YearLongOrbitNEW).EmptyCrewSpace()
}

A different question though. I'm trying to use the Duration parameter but for some reason the duration starts counting down immediately regardless of the sub parameters.

I could use the VesselParameterGroup duration but I wanted the extra text and structure of duration.


PARAMETER
{
name = Duration
type = Duration

duration = 1y

preWaitText = We must orbit for one year.
waitingText = One year is a long time
completionText = Excellent work

PARAMETER
{
name = HasCrew
type = HasCrew
minCrew = 2
}
PARAMETER
{
name = Orbit
type = Orbit
minPeA = @targetBody.AtmosphereAltitude() * 2
}
}


Share this post


Link to post
Share on other sites
How do you call the current vessel in a VesselParameterGroup?

For instance I'm trying to setup a reward so that you get x funds * Vessel().EmptyCrewSpace()

But CC says it doesn't know what Vessel it should have.

Won't work that way, unfortunately. All expressions (with the exception of those in an Expression behaviour) are executed right before the contract is offered. So there's typically no notion of "current" vessel at that time.

I found a tiny mistype in the wiki (that is otherwise quite well laid out. Thank you for that) on page https://github.com/jrossignol/ContractConfigurator/wiki/Contract-Type

In the big code block, when discussing REQUIREMENT nodes, you have the word PARAMETER in there instead of REQUIREMENT.


// The PARAMETER node defines a contract requirement - a prerequisite

should be


// The REQUIREMENT node defines a contract requirement - a prerequisite

Thanks, fixed!

Also, and I don't know why, but reloading the contracts won't reload Agents, even if those agents are within the contract files themselves.

Reloading contracts does a GameDatabase reload, Module Manager reload, followed by the Contract Configurator reload. Unfortunately, that doesn't trigger the agents to get reloaded. I might be able to figure it out how to force it, but it's such a small use case that I haven't bothered to look into it. (yet?)

And yes this does mean I'm working on a contract pack.

Exciting!!!

- - - Updated - - -

A different question though. I'm trying to use the Duration parameter but for some reason the duration starts counting down immediately regardless of the sub parameters.

I could use the VesselParameterGroup duration but I wanted the extra text and structure of duration.


PARAMETER
{
name = Duration
type = Duration

duration = 1y

preWaitText = We must orbit for one year.
waitingText = One year is a long time
completionText = Excellent work

PARAMETER
{
name = HasCrew
type = HasCrew
minCrew = 2
}
PARAMETER
{
name = Orbit
type = Orbit
minPeA = @targetBody.AtmosphereAltitude() * 2
}
}


Jeez, I have way too many timer-type parameters. Assuming MissionTimer and Timer don't meet your needs, raise a GitHub issue to add the startCriteria to the Duration parameter.

Share this post


Link to post
Share on other sites

I guess I was just confused as the description says: The Duration parameter sets up a timer that starts when all sibling parameters are completed. Once the timer expires, the parameter is completed.

So I put parameters as siblings but it does't seem to care about them for whatever reason.

I'll try the vessel group then.

Share this post


Link to post
Share on other sites
I guess I was just confused as the description says: The Duration parameter sets up a timer that starts when all sibling parameters are completed. Once the timer expires, the parameter is completed.

So I put parameters as siblings but it does't seem to care about them for whatever reason.

I'll try the vessel group then.

Oh right - I'm the one that's confused (like I said, too many timer-ish parameters). The problem is that those parameters you put are not sibling parameters, but child parameters.

You want:

PARAMETER
{
name = HasCrew
type = HasCrew
minCrew = 2
}

PARAMETER
{
name = Orbit
type = Orbit
minPeA = @targetBody.AtmosphereAltitude() * 2
}

PARAMETER
{
name = Duration
type = Duration

duration = 1y

preWaitText = We must orbit for one year.
waitingText = One year is a long time
completionText = Excellent work
}

And you'll want to wrap all that in a VesselParameterGroup, most likely.

Share this post


Link to post
Share on other sites

Is there (or could there become) a way to reward an "experimental" part as the reward for completing a contract, but NOT giving it at the start of a contract?

What I'm looking to do is give the player a contract to go claw something (that is in orbit or landed somewhere) and bring it back to Kerbin. And when they do this, they gain access to the part even though they haven't researched the node.

This may or may not be an attempt to totally circumvent the entire tech tree process for a new game type.

Share this post


Link to post
Share on other sites
Is there (or could there become) a way to reward an "experimental" part as the reward for completing a contract, but NOT giving it at the start of a contract?

What I'm looking to do is give the player a contract to go claw something (that is in orbit or landed somewhere) and bring it back to Kerbin. And when they do this, they gain access to the part even though they haven't researched the node.

This may or may not be an attempt to totally circumvent the entire tech tree process for a new game type.

There is a behaviour for part unlocking. This will unlock it permanently if that helps. I can't link it because on the mobile

Share this post


Link to post
Share on other sites
There is a behaviour for part unlocking. This will unlock it permanently if that helps. I can't link it because on the mobile

From what I'm reading that behavior does what I stated in my post that I do NOT want. It unlocks the part at the time you accept the contract. I want a way to unlock the part upon contract completion. Unless I'm misreading or misinterpreting. Which is wholly possible.

Share this post


Link to post
Share on other sites
From what I'm reading that behaviour does what I stated in my post that I do NOT want. It unlocks the part at the time you accept the contract. I want a way to unlock the part upon contract completion. Unless I'm misreading or misinterpreting. Which is wholly possible.

You can specify that the part get unlocked on the contract competition also I'm referring to this behaviour

Share this post


Link to post
Share on other sites
You can specify that the part get unlocked on the contract competition also I'm referring to this behaviour

That doesn't do what I want. I want the node the part is in to be locked and stay locked, yet you get the part to use for all time.

With that Behavior, if you don't unlock the node you don't get the part. If you unlock the node, you give the player access to all parts in it. I want neither of these things.

Though, unlocking the whole node is an interesting option... It's just not what I wanted.

Share this post


Link to post
Share on other sites
That doesn't do what I want. I want the node the part is in to be locked and stay locked, yet you get the part to use for all time.

With that Behavior, if you don't unlock the node you don't get the part. If you unlock the node, you give the player access to all parts in it. I want neither of these things.

Though, unlocking the whole node is an interesting option... It's just not what I wanted.

If you want the part to be unlocked for all time, then I think UnlockPart may be a better option - I just need to give it a tweak so that it actually unlocks the part even if the player has the BypassEntryPurchaseAfterResearch setting on. Throw me a GitHub request and I'll change that. I thought that you can unlock the part even without unlocking the tech - but if it turns out in my testing that it doesn't, I can instead make a change to the ExperimentalPart behaviour to allow you to specify when the part gets unlocked (contract accept, contract complete, parameter complete).

Share this post


Link to post
Share on other sites

HaveLanded() doesn't seem to be working for me. I tried retrieving it a few ways, but CC says it isn't a valid Celestialbody function.


DATA
{
type = CelestialBody
validTarget = HomeWorld().Children().Where(cb => cb.HaveLanded() == false).Random()
}

Share this post


Link to post
Share on other sites
If you want the part to be unlocked for all time, then I think UnlockPart may be a better option - I just need to give it a tweak so that it actually unlocks the part even if the player has the BypassEntryPurchaseAfterResearch setting on. Throw me a GitHub request and I'll change that. I thought that you can unlock the part even without unlocking the tech - but if it turns out in my testing that it doesn't, I can instead make a change to the ExperimentalPart behaviour to allow you to specify when the part gets unlocked (contract accept, contract complete, parameter complete).

I've made the request (https://github.com/jrossignol/ContractConfigurator/issues/289). Let me know if that's sufficient. Either is fine to change. I don't mind if all the parts are highlighted as "experimental" in the VAB, so long as they are available to use.

Share this post


Link to post
Share on other sites
HaveLanded() doesn't seem to be working for me. I tried retrieving it a few ways, but CC says it isn't a valid Celestialbody function.


DATA
{
type = CelestialBody
validTarget = HomeWorld().Children().Where(cb => cb.HaveLanded() == false).Random()
}

Oops, I'll fix the documentation, should've been HaveLandedOn().

- - - Updated - - -

I've made the request (https://github.com/jrossignol/ContractConfigurator/issues/289). Let me know if that's sufficient. Either is fine to change. I don't mind if all the parts are highlighted as "experimental" in the VAB, so long as they are available to use.

Looks good, shouldn't be a problem to get that into 1.6.4, which will likely see a release in the next couple of days.

Share this post


Link to post
Share on other sites

New release. Some bug fixes (big one being the fix to autoAccept contract generation for RP-0) and some new goodies for modders. Download now!

Contract Configurator 1.6.4

  • Workaround for crash issue when parsing some ternary expressions in contracts.
  • ContractPreLoader improvements, better handling of autoAccept contracts (thanks NathanKell).
  • Check parameter state for some parameters on contract acceptance (fixes issues with CapCom and autoAccept contracts).
  • Contract Configurator now automatically reloaded when doing a module manager reload (thanks sarbian).
  • Enhancements to ExperimentalPart to allow finer control over when parts are locked/unlocked.
  • Fixes to some string expression parsing issues (thanks Nori).
  • Fixed exception in ContractVesselTracker (thanks glilienthal).
  • Minor bug fixes.

Share this post


Link to post
Share on other sites

is there a way to grab @targetBody.RotationalPeriod() apply math to it and then feed it in as a duration?

	DATA
{
type = CelestialBody
orbitperiodhours = @targetBody.RotationalPeriod()/3600
}
DATA
{
type = Duration
orbitperiodmin = @/orbitperiodhours*0.99
}

DATA
{
type = Duration
orbitperiodmax = @/orbitperiodhours*1.01
}

Tried that but no go, and every iteration I use complains that it can't go into a duration field. Can't figure out what type duration is either. It seems to suggest that it is it's own type, but I guess that just makes it harder for me to figure out.

		PARAMETER
{
name = Orbit
type = Orbit
maxInclination = 3
maxEccentricity = 0.05

minPeriod = @/orbitperiodmin
maxPeriod = @/orbitperiodmax
}

Share this post


Link to post
Share on other sites
is there a way to grab @targetBody.RotationalPeriod() apply math to it and then feed it in as a duration?

    DATA
{
type = CelestialBody
orbitperiodhours = @targetBody.RotationalPeriod()/3600
}
DATA
{
type = Duration
orbitperiodmin = @/orbitperiodhours*0.99
}

DATA
{
type = Duration
orbitperiodmax = @/orbitperiodhours*1.01
}

Tried that but no go, and every iteration I use complains that it can't go into a duration field. Can't figure out what type duration is either. It seems to suggest that it is it's own type, but I guess that just makes it harder for me to figure out.

        PARAMETER
{
name = Orbit
type = Orbit
maxInclination = 3
maxEccentricity = 0.05

minPeriod = @/orbitperiodmin
maxPeriod = @/orbitperiodmax
}

The idea is that you're supposed to be able to give it a time in seconds (using the double type), but I see a bug that's preventing it from working. Let me look into the fix and get back to you...

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.