Jump to content

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


nightingale

Recommended Posts

Ok. I updated to CC 1.7.8 and tried again. I loaded a save that still had the correct timing information on the contract. Then I switched back to KSC, entered the VAB and loaded a saved craft. I didn't actually launch the craft, though. Once it was loaded, I just exited out of the VAB and checked the persistent.sfs file. Immediately after loading my save, after returning to KSC and even after entering the VAB, there was a "VESSEL_END_TIME" with a vessel identifier that corresponded to my Apollo CSM and an endTime. All inside the duration PARAM. But once I loaded a saved vehicle into the VAB and returned to KSC, the VESSEL_END_TIME was gone.

Link to comment
Share on other sites

Ok. I updated to CC 1.7.8 and tried again. I loaded a save that still had the correct timing information on the contract. Then I switched back to KSC, entered the VAB and loaded a saved craft. I didn't actually launch the craft, though. Once it was loaded, I just exited out of the VAB and checked the persistent.sfs file. Immediately after loading my save, after returning to KSC and even after entering the VAB, there was a "VESSEL_END_TIME" with a vessel identifier that corresponded to my Apollo CSM and an endTime. All inside the duration PARAM. But once I loaded a saved vehicle into the VAB and returned to KSC, the VESSEL_END_TIME was gone.

Raised [#338]. Note though that I won't be doing any more 1.0.4 releases, so this will only get fixed in the 1.0.5 stream.

Link to comment
Share on other sites

nightingale, how can I use the HasPassengers Parameter to check that a passenger is no longer on board? The goal is to disembark them at KSC Island, not keep them for the contract to succeed. Is there a HasNotPassengers parameter?

I've also run into something that might be a bug. I have a SpawnPassengers behavior spawning 2 passengers of Applicant type, and SpawnKerbal beahavior spawning 2 not owned kerbals on KSC Island. This contract then spawns 4 Kerbals. All four Kerbals show up when I:

PARAMETER

{

name = HasPassengers

type = HasPassengers

title = Unload passengers

count = 4

index = 0

}

And as expected, the following:

PARAMETER

{

name = HasPassengers

type = HasPassengers

title = Unload passengers

count = 2

index = 0

}

Only counts the spawned passengers since they are created first in the behavior order. Index 0 and 1. This displays in the Contract drop down the name of the two Kerbal passengers.

I am running into a problem though with this:

PARAMETER

{

name = HasPassengers

type = HasPassengers

title = Load passengers

count = 2

index = 2

}

Where the contract pull-down shows 2 Kerbals alright, but still those in index 0 and 1, and not in index 2 and 3 - which should be the Kerbals on the island waiting to be picked up, spawned by SpawnKerbal. Can you assist?

Edited by inigma
Link to comment
Share on other sites

Raised [#338]. Note though that I won't be doing any more 1.0.4 releases, so this will only get fixed in the 1.0.5 stream.

I figured and that's fine. I can make due with the bug until all the RO/RSS/RP-0 mods have been updated.

Link to comment
Share on other sites

nightingale, how can I use the HasPassengers Parameter to check that a passenger is no longer on board? The goal is to disembark them at KSC Island, not keep them for the contract to succeed. Is there a HasNotPassengers parameter?

It would need an enhancement. Right now with SpawnKerbal you can do it, and it would look like this:


CONTRACT_TYPE
{
name = MyContractType

title = @/MySpawnKerbal.Kerbals().ElementAt(2) is the name of the Kerbal.

BEHAVIOUR
{
name = MySpawnKerbal
type = SpawnKerbal

KERBAL
{
...
}
}
}

I'll just need to hook that same logic up to SpawnPassengers.

I've also run into something that might be a bug. I have a SpawnPassengers behavior spawning 2 passengers of Applicant type, and SpawnKerbal beahavior spawning 2 not owned kerbals on KSC Island. This contract then spawns 4 Kerbals. All four Kerbals show up when I:

PARAMETER

{

name = HasPassengers

type = HasPassengers

title = Unload passengers

count = 4

index = 0

}

And as expected, the following:

PARAMETER

{

name = HasPassengers

type = HasPassengers

title = Unload passengers

count = 2

index = 0

}

Only counts the spawned passengers since they are created first in the behavior order. Index 0 and 1. This displays in the Contract drop down the name of the two Kerbal passengers.

I am running into a problem though with this:

PARAMETER

{

name = HasPassengers

type = HasPassengers

title = Load passengers

count = 2

index = 2

}

Where the contract pull-down shows 2 Kerbals alright, but still those in index 0 and 1, and not in index 2 and 3 - which should be the Kerbals on the island waiting to be picked up, spawned by SpawnKerbal. Can you assist?

Sounds like a bug, but everything looked good at a glance in the code. Can you post up the full contract so I can reproduce/debug it?

Link to comment
Share on other sites

Thanks nightingale. Here's a simple contract, reproducing the error. Let me know if you get the same thing.


//Island related Contracts
//CONTENT:
//Fly over the island, Land on the island

CONTRACT_TYPE
{
name = CharterIslandTest
title = Test 101 to KSC Island
group = Island
agent = SSI Aerospace

description = Scientists and engineers often head out to KSC Island to work on various projects, and tourists to KSC know the island as one of the best places to camp out and watch launches. Shuttlecraft Systems Inc. has been chartered by KSC to provide regular air service to KSC Island. We need you to fly out two passengers to KSC Island, and exchange them with two passengers waiting there for a return trip to KSC.

notes = Fly two passengers to KSC Island, drop them off and exchange them for two waiting passengers on the island, and return to KSC.

synopsis = Regular flights to KSC Island are in high demand. The pay is low, but at least it's steady.
completedMessage = Flight Completed!

minExpiry = 7.0
maxExpiry = 7.0
deadline = 0
cancellable = true
declinable = true
autoAccept = false

prestige = Trivial

targetBody = Kerbin

maxCompletions = 0
maxSimultaneous = 1

rewardScience = 5.0
rewardReputation = 5.0
rewardFunds = 10000.0
failureReputation = 20.0
failureFunds = 20000.0
advanceFunds = 5000.0
weight = 1000.0

PARAMETER
{
name = HasPassengers
type = HasPassengers
title = All passengers
index = 2
count = 2
}

BEHAVIOUR
{
name = SpawnPassengers
type = SpawnPassengers
count = 2
passengerName =
passengerName =
kerbalType = Unowned
}

BEHAVIOUR
{
name = SpawnKerbal
type = SpawnKerbal

KERBAL
{
owned = false
addToRoster = false

pqsCity = IslandAirfield
pqsOffset = -130.997359523775, -175.815974214336, 18.0997077854
alt = 134.17723099107
}

KERBAL
{
owned = false
addToRoster = false

pqsCity = IslandAirfield
pqsOffset = -132.753837420853, -175.768306999687, 18.09969760210
alt = 134.17723099107
}
}
}

Link to comment
Share on other sites

Also I think I found another bug. The minSpeed ReachState setting is not being recognized at all. Produces a completed parameter, even when moving.


//Island related Contracts
//CONTENT:
//Fly over the island, Land on the island

CONTRACT_TYPE
{
name = CharterIslandTestB
title = Test 101 B to KSC Island
group = Island
agent = SSI Aerospace

description = Scientists and engineers often head out to KSC Island to work on various projects, and tourists to KSC know the island as one of the best places to camp out and watch launches. Shuttlecraft Systems Inc. has been chartered by KSC to provide regular air service to KSC Island. We need you to fly out two passengers to KSC Island, and exchange them with two passengers waiting there for a return trip to KSC.

notes = Fly two passengers to KSC Island, drop them off and exchange them for two waiting passengers on the island, and return to KSC.

synopsis = Regular flights to KSC Island are in high demand. The pay is low, but at least it's steady.
completedMessage = Flight Completed!

minExpiry = 7.0
maxExpiry = 7.0
deadline = 0
cancellable = true
declinable = true
autoAccept = false

prestige = Trivial

targetBody = Kerbin

maxCompletions = 0
maxSimultaneous = 1

rewardScience = 50000.0
rewardReputation = 5.0
rewardFunds = 10000.0
failureReputation = 20.0
failureFunds = 20000.0
advanceFunds = 5000000.0
weight = 1000.0


PARAMETER
{
name = ReachState
type = ReachState
title = Land back at KSC runway Speed 0
hideChildren = true
minSpeed = 0.0
disableOnStateChange = false
}

PARAMETER
{
name = RecoverVessel
type = RecoverVessel
}
}

Link to comment
Share on other sites

Sorry it's a maxSpeed bug:

maxSpeed 0.0 is not recognized but maxSpeex 0.1 is.


//Island related Contracts
//CONTENT:
//Fly over the island, Land on the island

CONTRACT_TYPE
{
name = CharterIslandTestB
title = Test 101 B to KSC Island
group = Island
agent = SSI Aerospace

description = Scientists and engineers often head out to KSC Island to work on various projects, and tourists to KSC know the island as one of the best places to camp out and watch launches. Shuttlecraft Systems Inc. has been chartered by KSC to provide regular air service to KSC Island. We need you to fly out two passengers to KSC Island, and exchange them with two passengers waiting there for a return trip to KSC.

notes = Fly two passengers to KSC Island, drop them off and exchange them for two waiting passengers on the island, and return to KSC.

synopsis = Regular flights to KSC Island are in high demand. The pay is low, but at least it's steady.
completedMessage = Flight Completed!

minExpiry = 7.0
maxExpiry = 7.0
deadline = 0
cancellable = true
declinable = true
autoAccept = false

prestige = Trivial

targetBody = Kerbin

maxCompletions = 0
maxSimultaneous = 1

rewardScience = 50000.0
rewardReputation = 5.0
rewardFunds = 10000.0
failureReputation = 20.0
failureFunds = 20000.0
advanceFunds = 5000000.0
weight = 1000.0

//This attribute value is recognized
PARAMETER
{
name = ReachState
type = ReachState
title = Land back at KSC runway Speed 0.1
hideChildren = true
maxSpeed = 0.1
disableOnStateChange = false
}

//This attribute value is not recognized
PARAMETER
{
name = ReachState
type = ReachState
title = Land back at KSC runway Speed 0
hideChildren = true
maxSpeed = 0.0
disableOnStateChange = false
}

PARAMETER
{
name = RecoverVessel
type = RecoverVessel
}
}

Also can you explain the weight thing to me? I'm not sure how much weight to put in a contract. What is the game default?

Edited by inigma
Link to comment
Share on other sites

Also can you explain the weight thing to me? I'm not sure how much weight to put in a contract. What is the game default?

The documentation explains it:


// The weight is used in the contract generation process. Each contract
// type that is available to be offered is added to a weighted list.
// Contract types with a higher value are more likely to be chosen.
//
// Default = 1.0

One thing that I'll have to add to that documentation is that the weight is per-contract pack. So you're setting a weight relative to your own contracts. So if you have one contract that you want to come up, half as frequently as the others, then give it a weight of 0.5. If you want it to be twice as frequent, then give it a weight of 2.0.

Link to comment
Share on other sites

The documentation explains it:


// The weight is used in the contract generation process. Each contract
// type that is available to be offered is added to a weighted list.
// Contract types with a higher value are more likely to be chosen.
//
// Default = 1.0

One thing that I'll have to add to that documentation is that the weight is per-contract pack. So you're setting a weight relative to your own contracts. So if you have one contract that you want to come up, half as frequently as the others, then give it a weight of 0.5. If you want it to be twice as frequent, then give it a weight of 2.0.

Thanks for the clarification. So then as I understand what you're saying, weight does not compete with stock contracts, correct? I can't make my contracts show up more than stock, right? I'm just trying to figure out a way to always have Flights 101, 102, and 103 constantly available on the contract selection list since the aim of the pack is for their regular repeatable availability for short term small profit.

Link to comment
Share on other sites

Thanks for the clarification. So then as I understand what you're saying, weight does not compete with stock contracts, correct? I can't make my contracts show up more than stock, right? I'm just trying to figure out a way to always have Flights 101, 102, and 103 constantly available on the contract selection list since the aim of the pack is for their regular repeatable availability for short term small profit.

It's not possible to have them constantly available, and that's by design - you could be competing with stock contracts and other contracts packs. The best you can do is:

  • Increase the weight (relative to your other contracts).
  • Have the player increase the number of max contracts

Link to comment
Share on other sites

New release, [URL="https://github.com/jrossignol/ContractConfigurator/releases/tag/1.8.1"]download now[/URL]!

[B]Contract Configurator 1.8.1[/B]
[LIST]
[*]Added new Not parameter.
[*]Can now specify heading in SpawnKerbal.
[*]Fixed issue with index attribute not being recognized in HasPassengers (thanks inigmatus).
[*]Fixed issue with speed in KSP never being zero for ReachState (thanks inigmatus).
[*]Fixed exception in RecoverVessel when recovering via the VAB when another vessel is on the launchpad.
[*]Fixed issue with timers getting reset in VAB/SPH (thanks chrisl).
[*]Removed long-ago deprecated CC_SCANsat.dll (this does not remove SCANsat support).
[/LIST]
Link to comment
Share on other sites

[quote name='nightingale']New release, [URL="https://github.com/jrossignol/ContractConfigurator/releases/tag/1.8.1"]download now[/URL]!

[B]Contract Configurator 1.8.1[/B]
[LIST]
[*]Added new Not parameter.
[*]Can now specify heading in SpawnKerbal.
[*]Fixed issue with index attribute not being recognized in HasPassengers (thanks inigmatus).
[*]Fixed issue with speed in KSP never being zero for ReachState (thanks inigmatus).
[*]Fixed exception in RecoverVessel when recovering via the VAB when another vessel is on the launchpad.
[*]Fixed issue with timers getting reset in VAB/SPH (thanks chrisl).
[*]Removed long-ago deprecated CC_SCANsat.dll (this does not remove SCANsat support).
[/LIST][/QUOTE]

You rock!
Link to comment
Share on other sites

[quote name='nightingale']Raised [[URL="https://github.com/jrossignol/ContractConfigurator/issues/336"]#336[/URL]]. What I'll do is get you some string functions, so you can do this:
[code]
DATA
{
type = Vessel
targetVessel = AllVessels().Where(v => v.VesselName().Contains("Lost")).Random()
}
[/code]

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.[/QUOTE]

So I got round to testing this... turns out that VesselName is not actually a valid method. Which rather makes "Contains()" a bit redundant.

So feature request please; can you add VesselName as a method?
Link to comment
Share on other sites

[quote name='severedsolo']So I got round to testing this... turns out that VesselName is not actually a valid method. Which rather makes "Contains()" a bit redundant.

So feature request please; can you add VesselName as a method?[/QUOTE]

I just assumed your example used valid methods. :D

I've added Vessel.VesselName() in the dev version.
Link to comment
Share on other sites

What is the syntax for adding a carriage return in a string? Example: I want the title of the contract to have two lines:

KSC Flight 1
Crew Rotation: 2

nvm. figured it out \n

first time i added it it borked KSP and the CC bug window. figured i had to do something different. on reload of KSP it worked.
Link to comment
Share on other sites

FYI: if you have the Take Command mod installed, SpawnVessel Crew spawning works to spawn Kerbals into command chairs. Just sharin' the info. :) I tested it and it works BEAUTIFULLY. :) But they don't count in any CC index of Kerbals such as HasPassengers or HasCrew or HasAstronaut. Edited by inigma
Link to comment
Share on other sites

Running into an issue where RecoverKerbal is not applying to the player's pilot. And issue where RecoverVessel is applying to the pilot, and not the actual vessel they built.

To alleviate both, is there a way to reference the player's named vessel in RecoverVessel?

Edit: i figured it out I think. Using vessel group param, and vessel key. I need to read the manual more. :) Edited by inigma
Link to comment
Share on other sites

[quote name='nightingale']I just assumed your example used valid methods. :D

I've added Vessel.VesselName() in the dev version.[/QUOTE]

Well you know me, always dangerous to assume. Thanks!

While we are adding things - how difficult would it be to get the vessels periapsis as a double? Something like:
[code]
targetVessel1 = AllVessels().Where(v => v.Periapsis >100000)[/code]

Edit: Also, do you have any idea why these two will find (the same) valid vessel:
[code]
DATA
{
type = Vessel
requiredValue = true
uniqueValue = true
targetVessel1 = AllVessels().Where(v => v.ResourceCapacity(LiquidFuel)/10 > v.ResourceQuantity(LiquidFuel))
}
DATA
{
type = Vessel
requiredValue = true
uniqueValue = true
targetVessel1 = AllVessels().Where(v => v.VesselName().Contains("HELP")).Random()
}
[/code]

But this doesn't:
[code]
DATA
{
type = Vessel
requiredValue = true
uniqueValue = true
targetVessel1 = AllVessels().Where(v => v.ResourceCapacity(LiquidFuel)/10 > v.ResourceQuantity(LiquidFuel) && v.VesselName().Contains("HELP")).Random()
}[/code] Edited by severedsolo
Link to comment
Share on other sites

[quote name='severedsolo']Well you know me, always dangerous to assume. Thanks!

While we are adding things - how difficult would it be to get the vessels periapsis as a double? Something like:
[code]
targetVessel1 = AllVessels().Where(v => v.Periapsis >100000)[/code]
[/quote]

Shouldn't be difficult. Raise an enhancement request and I'll get it in for 1.8.2.

[quote name='severedsolo']Edit: Also, do you have any idea why these two will find (the same) valid vessel:
[code]
DATA
{
type = Vessel
requiredValue = true
uniqueValue = true
targetVessel1 = AllVessels().Where(v => v.ResourceCapacity(LiquidFuel)/10 > v.ResourceQuantity(LiquidFuel))
}
DATA
{
type = Vessel
requiredValue = true
uniqueValue = true
targetVessel1 = AllVessels().Where(v => v.VesselName().Contains("HELP")).Random()
}
[/code]

But this doesn't:
[code]
DATA
{
type = Vessel
requiredValue = true
uniqueValue = true
targetVessel1 = AllVessels().Where(v => v.ResourceCapacity(LiquidFuel)/10 > v.ResourceQuantity(LiquidFuel) && v.VesselName().Contains("HELP")).Random()
}[/code][/QUOTE]

Hmm.... If I had to take a guess, I'd say it's because you're using targetVessel1 twice (I really should put in a check/warning for that). It's probably only picking up the second one.

If that's wrong, then one way to help debug it is to store the value in a List<Vessel> before doing the Random() call. Then you'll be able to see all the vessels that match at once in the debug window.

[COLOR="silver"][SIZE=1]- - - Updated - - -[/SIZE][/COLOR]

[quote name='inigma']nightingale: RecoverVessel doesn't appear to be recognized in Space Center view, correct? RecoverVessel requires the player to actively load the vessel and recover it, correct?[/QUOTE]

That's correct, a bit of an oversight though. Raise an issue in GitHub and I'll see if I can get it fixed for 1.8.2.
Link to comment
Share on other sites

hello guys, I have a short question for you:
How can I make a contract, which wants you to do a certain experiment (i.e. temperature-scan) at a specific location (waypoint)??
I tried this, but it does not work, as it is bugged... when I collect the science before I reach the waypoint nothing checks, but as soon as I am close enough to the waypoint it is finished...... but i want that you have to do the science there not somewhere and then just move there.. can you help me, please?
Sry, if it is obvious ^^

[CODE]PARAMETER
{
name = Sequence_1
type = Sequence

title = 1

PARAMETER
{
name = VisitWaypoint_1
type = VisitWaypoint

index = 0
distance = 10
hideOnCompletion = true
disableOnStateChange = false
}
PARAMETER
{
name = CollectScience_1
type = CollectScience

targetBody = Kerbin
situation = SrfLanded
experiment = temperatureScan
//recoveryMethod = RecoverOrTransmit

completeInSequence = true
disableOnStateChange = false
}
}[/CODE]
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...