Pehvbot Posted November 6, 2021 Share Posted November 6, 2021 I have a question about how PartValidation FILTERs works. I am able to use them for some criteria but not others. Working example vs non-working examples: //This one works fine ... PARAMETER { name = PartValidation type = PartValidation FILTER { MODULE { name = ModuleScienceExperiment experimentID = mobileMaterialsLab } } } //This one matches mobileMaterialsLab doesn't match for totalScienceLevel even though it's defined for the part being checked ... PARAMETER { name = PartValidation type = PartValidation FILTER { MODULE { name = ModuleScienceExperiment experimentID = mobileMaterialsLab //gets defined for different parts with mobileMaterialsLab totalScienceLevel = 1.0 } } } I'm able to work around the problem, but I haven't been able to figure out why some criteria work and some don't. Logs don't seem to offer any insight. Does anyone know what's going on with this? Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted November 6, 2021 Share Posted November 6, 2021 49 minutes ago, Pehvbot said: Logs don't seem to offer any insight. You can check the state of contract parameters by checking in in the Contract portion of your game's persistent.sfs file. It sometimes offers more insight into what is going on than the contract configurator debug logs. The entirety of a contract's current state is contained there. Quote Link to comment Share on other sites More sharing options...
Pehvbot Posted November 6, 2021 Share Posted November 6, 2021 (edited) 3 hours ago, Caerfinon said: You can check the state of contract parameters by checking in in the Contract portion of your game's persistent.sfs file. It sometimes offers more insight into what is going on than the contract configurator debug logs. The entirety of a contract's current state is contained there. Good tip, but nothing there either. The parameter is listed and looks good and everything works as expected, except it doesn't pass that specific check. As far as I can tell CC is either not checking at all (and auto failing) or it isn't seeing the two values as being equal for some reason. Edited November 6, 2021 by Pehvbot Quote Link to comment Share on other sites More sharing options...
Morphisor Posted November 7, 2021 Share Posted November 7, 2021 14 hours ago, Pehvbot said: I have a question about how PartValidation FILTERs works. I am able to use them for some criteria but not others. Working example vs non-working examples: //This one works fine ... PARAMETER { name = PartValidation type = PartValidation FILTER { MODULE { name = ModuleScienceExperiment experimentID = mobileMaterialsLab } } } //This one matches mobileMaterialsLab doesn't match for totalScienceLevel even though it's defined for the part being checked ... PARAMETER { name = PartValidation type = PartValidation FILTER { MODULE { name = ModuleScienceExperiment experimentID = mobileMaterialsLab //gets defined for different parts with mobileMaterialsLab totalScienceLevel = 1.0 } } } I'm able to work around the problem, but I haven't been able to figure out why some criteria work and some don't. Logs don't seem to offer any insight. Does anyone know what's going on with this? I have a guess to this, after trying out some different type of parameters some time ago. My suspicion is that CC isn't accounting correctly for any 'amount' value associated with parts, if that makes any sense. What I tried to do myself is to apply the ResourceConsumption parameter to keep track of energy generation for example and require a certain amount for the objective to be completed. But CC simply never read the values out correctly, instantly completing the objective even when the value input was negative. Quote Link to comment Share on other sites More sharing options...
Tonas1997 Posted November 21, 2021 Share Posted November 21, 2021 (edited) There's something weird going on with random parameters... I have a "launch satellite" contract of which there can be a few simultaneous instances. The contract type has a random resource requirement parameter that seems to work fine when the contracts are generated, but after a while they all end up requiring the exact same resource amount EDIT: I was snooping through the persistent.sfs file and came across one of these glitched contracts; the parameter node delegate kept the random resource quantity the contract was generated with (710 units of ComSatPayload): PARAM { name = HasResource id = HasComSatPayload state = Incomplete disableOnStateChange = False values = 0,0,0,0,0 ContractIdentifier = AdvSatellites.RepeatComSats title = notes = completedMessage = hideChildren = True allowStateReset = True capacity = False RESOURCE { resource = ComSatPayload minQuantity = 1040 } PARAM { name = ParameterDelegate`1 state = Incomplete disableOnStateChange = False values = 0,0,0,0,0 title = Resource: ComSatPayload: At least 710 units notes = completedMessage = } } Why did the minQuantity field change to something else? One of the contract instances was firstly generated with a 1040 unit requirement, so did CC assign that value to the rest of them? For reference, here's the actual contract definition: Spoiler CONTRACT_TYPE { name = RepeatComSats title = Commercial Communications Satellite group = AdvSatellites agent = Satellites description = We have a customer requesting a new Communications Satellite. Design a satellite within their specs and launch into an orbit with the proper orbital parameters as outlined in the contract.&br;&br;This contract can be completed as many times as you would like. The orbits will be chosen randomly from Tundra, Geostationary, Molniya and Geosynchronous orbits.&br;&br;<b><color=red>NOTE: The satellite will be destroyed upon completion of the contract. This simulates transfer of the payload back to the customer.</color></b>&br;&br;<b>Number of Contracts Completed: $RepeatComSats_Count</b> genericDescription = Put a satellite into the requested orbit. synopsis = Launch a new Commercial Communications Satellite completedMessage = Congratulations! The customer has reported the satellite is in the proper orbit. sortKey = 900 cancellable = true declinable = true autoAccept = false minExpiry = 5 maxExpiry = 10 maxCompletions = 0 maxSimultaneous = 5 deadline = 1095 // 3 years targetBody = HomeWorld() prestige = Trivial // 1.0x advanceFunds = (12000 + (@AdvComSat/HasComSatPayload/minQuantity *2)) * (1 + @AdvComSat/ReachSpecificOrbit/index * 0.4) * 3.6 rewardScience = 0 rewardReputation = Round((@advanceFunds / 1000),1) rewardFunds = (@advanceFunds * 1.5) failureReputation = @rewardReputation * 1.5 failureFunds = @advanceFunds // ************ REQUIREMENTS ************ REQUIREMENT { name = CompleteContract type = CompleteContract contractType = FirstMolniyaSat title = Complete @contractType Contract } REQUIREMENT { name = CompleteContract type = CompleteContract contractType = FirstTundraSat title = Complete @contractType Contract } REQUIREMENT { name = CompleteContract type = CompleteContract contractType = first_GEOUncrewed title = Complete @contractType Contract } REQUIREMENT { name = CompleteContract type = CompleteContract contractType = EarlyComSat minCount = 3 title = Complete @contractType Contract at least 3 times } BEHAVIOUR { name = OrbitGenerator type = OrbitGenerator RANDOM_ORBIT { type = KOLNIYA // index = 0 } RANDOM_ORBIT { type = STATIONARY // index = 1 } RANDOM_ORBIT { type = TUNDRA // index = 2 } } BEHAVIOUR { name = IncrementTheCount type = Expression CONTRACT_COMPLETED_SUCCESS { RepeatComSats_Count = $RepeatComSats_Count + 1 } } // ************ PARAMETERS ************ PARAMETER { name = AdvComSat type = VesselParameterGroup define = AdvComSatellite dissassociateVesselsOnContractCompletion = true title = Commercial Communications Satellite PARAMETER { name = NewVessel type = NewVessel title = Launch a New Vessel hideChildren = true } PARAMETER { name = Crewmembers type = HasCrew minCrew = 0 maxCrew = 0 title = Uncrewed hideChildren = true } PARAMETER { name = HasComSatPayload type = HasResource resource = ComSatPayload minQuantity = Round(UnlockedTech().Count() * 25 * Random(0.5,1.2),10) // for 20 nodes, 200 ~ 480 //Round((Pow(Random(0.5,1.5) * (0.3 + UnlockedTech().Count() / 100),2)*2500)/2,100) // for 10 nodes, 78~703 kg //title = Have a ComSatPayload of at least @minQuantity units on the craft } PARAMETER { name = ReachSpecificOrbit type = ReachSpecificOrbit displayNotes = true index = int(Min(2, Random(0, 3))) deviationWindow = 4 PARAMETER { name = Duration type = Duration duration = 2m preWaitText = Check for Stable Orbit waitingText = Checking for Stable Orbit completionText = Stable Orbit: Confirmed } } } BEHAVIOUR { name = TransferVessel type = DestroyVessel onState = CONTRACT_SUCCESS vessel = AdvComSatellite } BEHAVIOUR { name = VesselDestroyed type = DialogBox DIALOG_BOX { title = Vessel Ownership Transferred condition = CONTRACT_SUCCESS position = CENTER width = 0.5 TEXT { text = The contract has been completed successfully and the satellite has been transferred back to the customer. } } } } Edited November 21, 2021 by Tonas1997 Quote Link to comment Share on other sites More sharing options...
DeadJohn Posted December 30, 2021 Share Posted December 30, 2021 (edited) Can anyone shed light on how to configure CC for additional Kopernicus planet packs? @nightingale hasn't logged in for 2 months so if anyone else can help it's appreciated. I'm new to CC and learning by reading the wiki and parts of the code. It appears that CC doesn't automatically detect whether a biome has land or water, and therefore incorrectly generates contracts that requires landed rather than splashed in biomes that are mostly or all water (JNSQ Kerbin has several such biomes). This CC behavior isn't a bug and I think I just need to provide CC with more info so it knows about land and water. CC's BiomeData.cfg and BiomeDataDefault.cfg might be a good place to focus. They list stock land and water ratios. I need to modify them or create a new one for JNSQ. Am I on the right track, or is there a better way to get planet packs like JNSQ to work better with CC? Is there any documentation for those files? I couldn't find it in the wiki. Do I have to manually create a file for a planet pack, or does CC have a way to scan the planet pack and autogenerate a new file? That file has landCount and waterCount variables for each biome, that are later used to detect whether a biome is land or water. What units are used? That file sets multiple LAND_LOCATION and WATER_LOCATION coordinates for each biome. What do they do, and are they optional? P.S. I don't think it's a CC or JNSQ installation issue, as the contract pack's author is getting the same landed/splashed issue. Edited December 30, 2021 by DeadJohn Quote Link to comment Share on other sites More sharing options...
Morphisor Posted December 30, 2021 Share Posted December 30, 2021 (edited) 2 hours ago, DeadJohn said: Can anyone shed light on how to configure CC for additional Kopernicus planet packs? @nightingale hasn't logged in for 2 months so if anyone else can help it's appreciated. I'm new to CC and learning by reading the wiki and parts of the code. It appears that CC doesn't automatically detect whether a biome has land or water, and therefore incorrectly generates contracts that requires landed rather than splashed in biomes that are mostly or all water (JNSQ Kerbin has several such biomes). This CC behavior isn't a bug and I think I just need to provide CC with more info so it knows about land and water. CC's BiomeData.cfg and BiomeDataDefault.cfg might be a good place to focus. They list stock land and water ratios. I need to modify them or create a new one for JNSQ. Am I on the right track, or is there a better way to get planet packs like JNSQ to work better with CC? Is there any documentation for those files? I couldn't find it in the wiki. Do I have to manually create a file for a planet pack, or does CC have a way to scan the planet pack and autogenerate a new file? That file has landCount and waterCount variables for each biome, that are later used to detect whether a biome is land or water. What units are used? That file sets multiple LAND_LOCATION and WATER_LOCATION coordinates for each biome. What do they do, and are they optional? P.S. I don't think it's a CC or JNSQ installation issue, as the contract pack's author is getting the same landed/splashed issue. A quick look at both BiomeData.cfg and BiomeDataDefault.cfg in several of my modded installs, shows that the default one is pre-determined for stock KSP, but that the non-default cfg is getting generated by CC itself. Crucially however, it always maintains the default values and only adds others to it that it can find. I suspect this is where JNSQ in particular will go wrong, since of course most of its bodies have the same names as the stock KSP ones. CC is not adding new values to its BiomeData for these bodies. I also checked this with Beyond Home and see the same happening there. Important here is that for ANY planet pack that replaces the home planet, its internal name is still Kerbin. This means that any home planet definitions would never get written in the data. Additional complication in all this is that the accuracy of this data also of course depends on the accuracy of biome placement by the planet author. We all know those situations where it says splashed down when you're clearly on solid land and vice-versa; this is defined on the planet level, CC only reads it. So if I'm reading all this right, the question becomes how can we prevent CC from using the default values outside of the stock system? Update: I just checked what happens when you delete the BiomeData.cfg and load up the game. It generates a new one after entering a career game mode (not after loading into menu!). Most importantly however is, the default values are copied over into this new file as well, so it never checks for them being appropriate to the system in use. Given CC is capable of auto generating these values for any body it doesn't know, this seems to me like a strange behaviour. Can we trick CC into overwriting these defaults or does it require modifying the CC code and thereby effectively a new version? Edited December 30, 2021 by Morphisor Quote Link to comment Share on other sites More sharing options...
OhioBob Posted December 30, 2021 Share Posted December 30, 2021 (edited) Form the RAD thread... 12 hours ago, Morphisor said: I pinged you to see if you can tell us anything how this is dealt with on the planet pack side. For all the planet packs that I have been involved in, it hasn't been dealt with at all. I've never had the need or desire to use contract packs, so I've never paid any attention to them. I've just assumed that the programming necessary to distinguish land from water was included on the contract side of things. If it becomes necessary to add a config to the planet packs to remedy this situation, that shouldn't be a problem. I don't want to be the one to figure it out, however. Edited December 30, 2021 by OhioBob Quote Link to comment Share on other sites More sharing options...
DeadJohn Posted December 31, 2021 Share Posted December 31, 2021 13 hours ago, Morphisor said: A quick look at both BiomeData.cfg and BiomeDataDefault.cfg in several of my modded installs ... [snipped for brevity] I think I found a fix. Delete both files. If BiomeDataDefault.cfg exists, CC creates an incorrect BiomeData.cfg for JNSQ's bodies that have water, and surface contracts default to "landed" never "splashed". If both files are gone, CC creates a better BiomeData.cfg with info for Kerbin, Eve, Laythe, and Huygen. This seems to work even for contract saves that are already underway. Existing contracts will remain wrong, but if I decline some and fast forward I can get contracts that appropriately require splashing down in water. @nightingale Why does BiomeDataDefault.cfg exist? Is it perhaps a holdover from early versions of CC that didn't autodetect biomes? Quote Link to comment Share on other sites More sharing options...
Morphisor Posted December 31, 2021 Share Posted December 31, 2021 (edited) 12 hours ago, OhioBob said: Form the RAD thread... For all the planet packs that I have been involved in, it hasn't been dealt with at all. I've never had the need or desire to use contract packs, so I've never paid any attention to them. I've just assumed that the programming necessary to distinguish land from water was included on the contract side of things. If it becomes necessary to add a config to the planet packs to remedy this situation, that shouldn't be a problem. I don't want to be the one to figure it out, however. Thanks, that helps narrow it down to CC itself. It seems you're right it's not needed on the planet side. 8 hours ago, DeadJohn said: I think I found a fix. Delete both files. If BiomeDataDefault.cfg exists, CC creates an incorrect BiomeData.cfg for JNSQ's bodies that have water, and surface contracts default to "landed" never "splashed". If both files are gone, CC creates a better BiomeData.cfg with info for Kerbin, Eve, Laythe, and Huygen. This seems to work even for contract saves that are already underway. Existing contracts will remain wrong, but if I decline some and fast forward I can get contracts that appropriately require splashing down in water. @nightingale Why does BiomeDataDefault.cfg exist? Is it perhaps a holdover from early versions of CC that didn't autodetect biomes? Now I should've thought of that sooner! If it's that simple that's great news! I'll check to verify and add that instruction to the install instructions for RAD. Edit: confirmed! Edited December 31, 2021 by Morphisor Quote Link to comment Share on other sites More sharing options...
Qwarkk Posted January 25, 2022 Share Posted January 25, 2022 Hi all, looking for some help. I created my own contract pack & contract group to do space station missions such as crew rotation, re-supply or evacuation. I know a mod for this already exists but i wanted to make my own. However, only one contract is ever offered from the multiple contract types available, despite all contracts having their pre-requisites met. Can you have multiple contracts all targeting the same vessel? Thanks for any help. If it would help for me to post the contracts, let me know and i will do so later - Im not home currently. Quote Link to comment Share on other sites More sharing options...
Morphisor Posted January 25, 2022 Share Posted January 25, 2022 1 hour ago, Qwarkk said: Hi all, looking for some help. I created my own contract pack & contract group to do space station missions such as crew rotation, re-supply or evacuation. I know a mod for this already exists but i wanted to make my own. However, only one contract is ever offered from the multiple contract types available, despite all contracts having their pre-requisites met. Can you have multiple contracts all targeting the same vessel? Thanks for any help. If it would help for me to post the contracts, let me know and i will do so later - Im not home currently. It would definitely help if you could link them, including the contract group definitions. It's possible to have multiple contracts reference the same target, but there are ways to block that from happening with data node checks for example. Quote Link to comment Share on other sites More sharing options...
Qwarkk Posted January 26, 2022 Share Posted January 26, 2022 9 hours ago, Morphisor said: It would definitely help if you could link them, including the contract group definitions. It's possible to have multiple contracts reference the same target, but there are ways to block that from happening with data node checks for example. Contract Group: Spoiler CONTRACT_GROUP { name = B612_Sta displayName = B612 Conglomerate (Station) minVersion = 1.21.0 maxCompletions = 0 maxSimultaneous = 6 agent = B612 Conglomerate } Contract Spoiler CONTRACT_TYPE { name = SendCrew title = Crew @targetVessel Mission genericTitle = Crew Space Station Mission group = B612_Sta description = There are spare crew quarters on @targetVessel, and the life support systems are not at capacity. Send @/kerbalsSending new kerbals to crew @/targetVessel within 200 days genericDescription = There are spare crew quarters on the space station, and the life support systems are not at capacity. Send new kerbals to crew the space station within 200 days synopsis = Send @/kerbalsSending new crew members to @/targetVessel completedMessage = Mission Complete minExpiry = 71.0 maxExpiry = 142.0 deadline = 200 cancellable = true declinable = true autoAccept = false maxSimultaneous = 1 targetBody = @/targetBody1 rewardScience = 0 rewardFunds = 120000000 + ((@/kerbalsSending - 2) * 20000000) // 75,000,000 per first 2 kerbals. 25,000,000 per additional kerbal advanceFunds = @rewardFunds / 10 rewardReputation = @rewardFunds / 24000000 failureReputation = @rewardReputation / 4 failureFunds = @advanceFunds //prestige = Significant DATA { type = Vessel uniquenessCheck = GROUP_ACTIVE requiredValue = true targetVessel = AllVessels().Where(v => v.VesselType() == Station && (v.CrewCapacity() - v.CrewCount())>1).Random() title = Must have a station with empty crew capacity } DATA { type = CelestialBody requiredValue = true targetBody1 = @/targetVessel.CelestialBody() hidden = true } DATA { type = double currentCrew = @/targetVessel.CrewCount() emptyCapacity = @/targetVessel.CrewCapacity() - @currentCrew kerbalsSending = @emptyCapacity >= 4 ? Round(Random(1.51,4.49)) : @emptyCapacity == 3 ? 3 : 2 } PARAMETER { name = VesselGroup type = VesselParameterGroup define = Crew_Send dissassociateVesselsOnContractCompletion = true dissassociateVesselsOnContractFailure = true //Craft Requirements PARAMETER { name = PreLaunch type = All title = Pre-Launch Configuration PARAMETER { name = NewVessel type = NewVessel } PARAMETER { name = DockingPort type = Any title = Have a docking port PARAMETER { name = PartValidation0 type = PartValidation partModule = ModuleDockingNode } PARAMETER { name = PartValidation1 type = PartValidation partModuleType = Dock } } PARAMETER { name = HasCrew0 type = HasCrew minCrew = @/kerbalsSending } PARAMETER:NEEDS[TACLifeSupport] { name = Food type = HasResource resource = Food minQuantity = @/kerbalsSending * 151200 * 0.000016927083333 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Water type = HasResource resource = Water minQuantity = @/kerbalsSending * 151200 * 0.000011188078704 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Oxygen type = HasResource resource = Oxygen minQuantity = @/kerbalsSending * 151200 * 0.001713537562385 disableOnStateChange = true } } //Objectives PARAMETER { name = Objectives type = All title = Send up a new Crew completeInSequence = true PARAMETER { name = Docking type = Docking vessel = @/targetVessel title = Dock with @/targetVessel disableOnStateChange = true } PARAMETER { name = HasCrew1 type = HasCrew minCrew = @/currentCrew + @/kerbalsSending disableOnStateChange = true } } } } Another Contract Spoiler CONTRACT_TYPE { name = CRS title = Commercial Resupply Mission //genericTitle = Life Support Supply Run group = B612_Sta description = Life support reserves on @/targetVessel are in need of replenishing. Within the next 200 days, resupply @/targetVessel with enough Oxygen, Water and Food for 300 days. A bonus payout is available for any resource resupplied for 600 days. genericDescription = Life support reserves on the Space Station are in need to replenishing. Resupply the Space Station with Oxygen, Water and Food within the next 200 days. synopsis = Deliver life support resources to @/targetVessel completedMessage = Mission Complete minExpiry = 71.0 maxExpiry = 142.0 deadline = 200.0 cancellable = true declinable = true autoAccept = false maxSimultaneous = 1 targetBody = @/targetBody1 rewardScience = 0 rewardFunds = 120000000 advanceFunds = @rewardFunds / 10 rewardReputation = @rewardFunds / 24000000 failureReputation = @rewardReputation / 4 failureFunds = @advanceFunds //prestige = Significant DATA { type = Vessel uniquenessCheck = GROUP_ACTIVE requiredValue = true targetVessel = AllVessels().Where(v => v.VesselType() == Station && v.CrewCount()>0).Random() title = Must have a station with crew } DATA { type = double Crew = @/targetVessel.CrewCount() } DATA { type = CelestialBody requiredValue = true targetBody1 = @/targetVessel.CelestialBody() hidden = true } PARAMETER { name = VesselGroup type = VesselParameterGroup define = Life_Support dissassociateVesselsOnContractCompletion = true dissassociateVesselsOnContractFailure = true //Craft Requirements PARAMETER { name = PreLaunch type = All title = Pre-Launch Configuration PARAMETER { name = NewVessel type = NewVessel } PARAMETER { name = DockingPort type = Any title = Have a docking port PARAMETER { name = PartValidation0 type = PartValidation partModule = ModuleDockingNode } PARAMETER { name = PartValidation1 type = PartValidation partModuleType = Dock } } PARAMETER:NEEDS[TACLifeSupport] { name = Food type = HasResource resource = Food minQuantity = @/Crew * 6480000 * 0.000016927083333 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Water type = HasResource resource = Water minQuantity = @/Crew * 6480000 * 0.000011188078704 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Oxygen type = HasResource resource = Oxygen minQuantity = @/Crew * 6480000 * 0.001713537562385 disableOnStateChange = true } } PARAMETER { name = DockwithStation type = Docking vessel = @/targetVessel title = Dock with @/targetVessel completeInSequence = true } } } Final Contract Spoiler CONTRACT_TYPE { name = RotateCrew title = Crew Rotation Mission group = B612_Sta description = There are @/kerbalsReturning Kerbals aboard @/targetVessel who are coming to the end of their mission. Replace them with @/kerbalsReturning new kerbals and bring them home safely within 100 days. genericDescription = Kerbals aboard the station are coming to the end of their mission. Replace them with new kerbals and bring them home safely within 100 days. synopsis = Rotate the crew of @/targetVessel completedMessage = Mission Complete minExpiry = 71.0 maxExpiry = 142.0 deadline = 100.0 cancellable = true declinable = true autoAccept = false maxSimultaneous = 1 targetBody = @/targetBody1 rewardScience = 0 rewardFunds = 120000000 + ((@/kerbalsReturning - 2) * 20000000) // 75,000,000 per first 2 kerbals. 25,000,000 per additional kerbal advanceFunds = @rewardFunds / 10 rewardReputation = @rewardFunds / 24000000 failureReputation = @rewardReputation / 4 failureFunds = @advanceFunds //prestige = Significant DATA { type = Vessel uniquenessCheck = GROUP_ACTIVE requiredValue = true targetVessel = AllVessels().Where(v => v.VesselType() == Station && v.CrewCount()>1).Random() //targetVCap = @targetVessel.CrewCount() + @/targetKerbals.Count() title = Must have a station with at least 2 crew members on board } DATA { type = CelestialBody requiredValue = true targetBody1 = @/targetVessel.CelestialBody() hidden = true } DATA { type = List<Kerbal> // Get me some Kerbals to send home! targetKerbals = @targetVessel.Crew().Random(2,4) hidden = true } DATA { type = double kerbalsReturning = @/targetKerbals.Count() targetVCap = @/targetVessel.CrewCount() + @kerbalsReturning } //DATA //{ // type = string // craft1 = CCP // //craft2 = CCPR //} PARAMETER { name = VesselGroup type = VesselParameterGroup define = Crew_Rotation dissassociateVesselsOnContractCompletion = true dissassociateVesselsOnContractFailure = true //Craft Requirements PARAMETER { name = PreLaunch type = All title = Pre-Launch Configuration PARAMETER { name = NewVessel type = NewVessel } PARAMETER { name = DockingPort type = Any title = Have a docking port PARAMETER { name = PartValidation0 type = PartValidation partModule = ModuleDockingNode } PARAMETER { name = PartValidation1 type = PartValidation partModuleType = Dock } } PARAMETER { name = HasCrew type = HasCrew minCrew = @/kerbalsReturning } PARAMETER:NEEDS[TACLifeSupport] { name = Food type = HasResource resource = Food minQuantity = @/kerbalsReturning * 151200 * 0.000016927083333 //Kerbals * 1 week * consumption per second disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Water type = HasResource resource = Water minQuantity = @/kerbalsReturning * 151200 * 0.000011188078704 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Oxygen type = HasResource resource = Oxygen minQuantity = @/kerbalsReturning * 151200 * 0.001713537562385 disableOnStateChange = true } } //Objectives PARAMETER { name = Objectives1 type = All title = Send up a new Crew completeInSequence = true PARAMETER { name = Docking type = Docking vessel = @/targetVessel title = Dock with @/targetVessel disableOnStateChange = true } PARAMETER { name = HasCrew type = HasCrew minCrew = @/targetVCap disableOnStateChange = true } } //Objectives PARAMETER { name = Objectives2 type = All title = Return home completeInSequence = true PARAMETER { name = ReturnHome type = ReturnHome title = Rotate the crew and return home } PARAMETER { name = RecoverKerbal type = RecoverKerbal kerbal = @/targetKerbals } } } } Quote Link to comment Share on other sites More sharing options...
Morphisor Posted January 26, 2022 Share Posted January 26, 2022 7 hours ago, Qwarkk said: Contract Group: Hide contents CONTRACT_GROUP { name = B612_Sta displayName = B612 Conglomerate (Station) minVersion = 1.21.0 maxCompletions = 0 maxSimultaneous = 6 agent = B612 Conglomerate } Contract Hide contents CONTRACT_TYPE { name = SendCrew title = Crew @targetVessel Mission genericTitle = Crew Space Station Mission group = B612_Sta description = There are spare crew quarters on @targetVessel, and the life support systems are not at capacity. Send @/kerbalsSending new kerbals to crew @/targetVessel within 200 days genericDescription = There are spare crew quarters on the space station, and the life support systems are not at capacity. Send new kerbals to crew the space station within 200 days synopsis = Send @/kerbalsSending new crew members to @/targetVessel completedMessage = Mission Complete minExpiry = 71.0 maxExpiry = 142.0 deadline = 200 cancellable = true declinable = true autoAccept = false maxSimultaneous = 1 targetBody = @/targetBody1 rewardScience = 0 rewardFunds = 120000000 + ((@/kerbalsSending - 2) * 20000000) // 75,000,000 per first 2 kerbals. 25,000,000 per additional kerbal advanceFunds = @rewardFunds / 10 rewardReputation = @rewardFunds / 24000000 failureReputation = @rewardReputation / 4 failureFunds = @advanceFunds //prestige = Significant DATA { type = Vessel uniquenessCheck = GROUP_ACTIVE requiredValue = true targetVessel = AllVessels().Where(v => v.VesselType() == Station && (v.CrewCapacity() - v.CrewCount())>1).Random() title = Must have a station with empty crew capacity } DATA { type = CelestialBody requiredValue = true targetBody1 = @/targetVessel.CelestialBody() hidden = true } DATA { type = double currentCrew = @/targetVessel.CrewCount() emptyCapacity = @/targetVessel.CrewCapacity() - @currentCrew kerbalsSending = @emptyCapacity >= 4 ? Round(Random(1.51,4.49)) : @emptyCapacity == 3 ? 3 : 2 } PARAMETER { name = VesselGroup type = VesselParameterGroup define = Crew_Send dissassociateVesselsOnContractCompletion = true dissassociateVesselsOnContractFailure = true //Craft Requirements PARAMETER { name = PreLaunch type = All title = Pre-Launch Configuration PARAMETER { name = NewVessel type = NewVessel } PARAMETER { name = DockingPort type = Any title = Have a docking port PARAMETER { name = PartValidation0 type = PartValidation partModule = ModuleDockingNode } PARAMETER { name = PartValidation1 type = PartValidation partModuleType = Dock } } PARAMETER { name = HasCrew0 type = HasCrew minCrew = @/kerbalsSending } PARAMETER:NEEDS[TACLifeSupport] { name = Food type = HasResource resource = Food minQuantity = @/kerbalsSending * 151200 * 0.000016927083333 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Water type = HasResource resource = Water minQuantity = @/kerbalsSending * 151200 * 0.000011188078704 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Oxygen type = HasResource resource = Oxygen minQuantity = @/kerbalsSending * 151200 * 0.001713537562385 disableOnStateChange = true } } //Objectives PARAMETER { name = Objectives type = All title = Send up a new Crew completeInSequence = true PARAMETER { name = Docking type = Docking vessel = @/targetVessel title = Dock with @/targetVessel disableOnStateChange = true } PARAMETER { name = HasCrew1 type = HasCrew minCrew = @/currentCrew + @/kerbalsSending disableOnStateChange = true } } } } Another Contract Reveal hidden contents CONTRACT_TYPE { name = CRS title = Commercial Resupply Mission //genericTitle = Life Support Supply Run group = B612_Sta description = Life support reserves on @/targetVessel are in need of replenishing. Within the next 200 days, resupply @/targetVessel with enough Oxygen, Water and Food for 300 days. A bonus payout is available for any resource resupplied for 600 days. genericDescription = Life support reserves on the Space Station are in need to replenishing. Resupply the Space Station with Oxygen, Water and Food within the next 200 days. synopsis = Deliver life support resources to @/targetVessel completedMessage = Mission Complete minExpiry = 71.0 maxExpiry = 142.0 deadline = 200.0 cancellable = true declinable = true autoAccept = false maxSimultaneous = 1 targetBody = @/targetBody1 rewardScience = 0 rewardFunds = 120000000 advanceFunds = @rewardFunds / 10 rewardReputation = @rewardFunds / 24000000 failureReputation = @rewardReputation / 4 failureFunds = @advanceFunds //prestige = Significant DATA { type = Vessel uniquenessCheck = GROUP_ACTIVE requiredValue = true targetVessel = AllVessels().Where(v => v.VesselType() == Station && v.CrewCount()>0).Random() title = Must have a station with crew } DATA { type = double Crew = @/targetVessel.CrewCount() } DATA { type = CelestialBody requiredValue = true targetBody1 = @/targetVessel.CelestialBody() hidden = true } PARAMETER { name = VesselGroup type = VesselParameterGroup define = Life_Support dissassociateVesselsOnContractCompletion = true dissassociateVesselsOnContractFailure = true //Craft Requirements PARAMETER { name = PreLaunch type = All title = Pre-Launch Configuration PARAMETER { name = NewVessel type = NewVessel } PARAMETER { name = DockingPort type = Any title = Have a docking port PARAMETER { name = PartValidation0 type = PartValidation partModule = ModuleDockingNode } PARAMETER { name = PartValidation1 type = PartValidation partModuleType = Dock } } PARAMETER:NEEDS[TACLifeSupport] { name = Food type = HasResource resource = Food minQuantity = @/Crew * 6480000 * 0.000016927083333 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Water type = HasResource resource = Water minQuantity = @/Crew * 6480000 * 0.000011188078704 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Oxygen type = HasResource resource = Oxygen minQuantity = @/Crew * 6480000 * 0.001713537562385 disableOnStateChange = true } } PARAMETER { name = DockwithStation type = Docking vessel = @/targetVessel title = Dock with @/targetVessel completeInSequence = true } } } Final Contract Reveal hidden contents CONTRACT_TYPE { name = RotateCrew title = Crew Rotation Mission group = B612_Sta description = There are @/kerbalsReturning Kerbals aboard @/targetVessel who are coming to the end of their mission. Replace them with @/kerbalsReturning new kerbals and bring them home safely within 100 days. genericDescription = Kerbals aboard the station are coming to the end of their mission. Replace them with new kerbals and bring them home safely within 100 days. synopsis = Rotate the crew of @/targetVessel completedMessage = Mission Complete minExpiry = 71.0 maxExpiry = 142.0 deadline = 100.0 cancellable = true declinable = true autoAccept = false maxSimultaneous = 1 targetBody = @/targetBody1 rewardScience = 0 rewardFunds = 120000000 + ((@/kerbalsReturning - 2) * 20000000) // 75,000,000 per first 2 kerbals. 25,000,000 per additional kerbal advanceFunds = @rewardFunds / 10 rewardReputation = @rewardFunds / 24000000 failureReputation = @rewardReputation / 4 failureFunds = @advanceFunds //prestige = Significant DATA { type = Vessel uniquenessCheck = GROUP_ACTIVE requiredValue = true targetVessel = AllVessels().Where(v => v.VesselType() == Station && v.CrewCount()>1).Random() //targetVCap = @targetVessel.CrewCount() + @/targetKerbals.Count() title = Must have a station with at least 2 crew members on board } DATA { type = CelestialBody requiredValue = true targetBody1 = @/targetVessel.CelestialBody() hidden = true } DATA { type = List<Kerbal> // Get me some Kerbals to send home! targetKerbals = @targetVessel.Crew().Random(2,4) hidden = true } DATA { type = double kerbalsReturning = @/targetKerbals.Count() targetVCap = @/targetVessel.CrewCount() + @kerbalsReturning } //DATA //{ // type = string // craft1 = CCP // //craft2 = CCPR //} PARAMETER { name = VesselGroup type = VesselParameterGroup define = Crew_Rotation dissassociateVesselsOnContractCompletion = true dissassociateVesselsOnContractFailure = true //Craft Requirements PARAMETER { name = PreLaunch type = All title = Pre-Launch Configuration PARAMETER { name = NewVessel type = NewVessel } PARAMETER { name = DockingPort type = Any title = Have a docking port PARAMETER { name = PartValidation0 type = PartValidation partModule = ModuleDockingNode } PARAMETER { name = PartValidation1 type = PartValidation partModuleType = Dock } } PARAMETER { name = HasCrew type = HasCrew minCrew = @/kerbalsReturning } PARAMETER:NEEDS[TACLifeSupport] { name = Food type = HasResource resource = Food minQuantity = @/kerbalsReturning * 151200 * 0.000016927083333 //Kerbals * 1 week * consumption per second disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Water type = HasResource resource = Water minQuantity = @/kerbalsReturning * 151200 * 0.000011188078704 disableOnStateChange = true } PARAMETER:NEEDS[TACLifeSupport] { name = Oxygen type = HasResource resource = Oxygen minQuantity = @/kerbalsReturning * 151200 * 0.001713537562385 disableOnStateChange = true } } //Objectives PARAMETER { name = Objectives1 type = All title = Send up a new Crew completeInSequence = true PARAMETER { name = Docking type = Docking vessel = @/targetVessel title = Dock with @/targetVessel disableOnStateChange = true } PARAMETER { name = HasCrew type = HasCrew minCrew = @/targetVCap disableOnStateChange = true } } //Objectives PARAMETER { name = Objectives2 type = All title = Return home completeInSequence = true PARAMETER { name = ReturnHome type = ReturnHome title = Rotate the crew and return home } PARAMETER { name = RecoverKerbal type = RecoverKerbal kerbal = @/targetKerbals } } } } Your DATA node selecting the target vessel has uniquenessCheck = GROUP_ACTIVE. That means it will not generate if any contract within the whole group is already targeting that vessel. If you want multiple different contracts to be available for a single vessel at the same, you should change that to CONTRACT_ACTIVE. Quote Link to comment Share on other sites More sharing options...
Qwarkk Posted January 26, 2022 Share Posted January 26, 2022 1 hour ago, Morphisor said: Your DATA node selecting the target vessel has uniquenessCheck = GROUP_ACTIVE. That means it will not generate if any contract within the whole group is already targeting that vessel. If you want multiple different contracts to be available for a single vessel at the same, you should change that to CONTRACT_ACTIVE. Thank you! This has been bugging me for ages, appreciate the help! Quote Link to comment Share on other sites More sharing options...
Krzeszny Posted January 26, 2022 Share Posted January 26, 2022 (edited) Clicking "Reload Contracts" in the debug menu reloads... all the models from all mods. But wait, there's more! It doesn't reload the contracts! I waited until it reloaded all the models and the contracts didn't reappear in the debug menu. Then I went to main menu and got this: Spoiler Edited January 26, 2022 by Krzeszny Quote Link to comment Share on other sites More sharing options...
Morphisor Posted January 27, 2022 Share Posted January 27, 2022 12 hours ago, Krzeszny said: Clicking "Reload Contracts" in the debug menu reloads... all the models from all mods. But wait, there's more! It doesn't reload the contracts! I waited until it reloaded all the models and the contracts didn't reappear in the debug menu. Then I went to main menu and got this: Reveal hidden contents It's been a known bug for years. Don't use it. At all. Ever. Quote Link to comment Share on other sites More sharing options...
Krzeszny Posted January 27, 2022 Share Posted January 27, 2022 (edited) On 1/27/2022 at 12:55 PM, Morphisor said: It's been a known bug for years. Don't use it. At all. Ever. 1. There's no warning not to press the button. 2. The button is there. You'd assume that a bug as easy to fix as by removing a button would have been already fixed but... CC has dozens of unsolved issues on GitHub. Edited January 31, 2022 by Krzeszny Quote Link to comment Share on other sites More sharing options...
Teykn Posted January 29, 2022 Share Posted January 29, 2022 Question regarding the HasCrew Parameter, and overall how CC tracks and updates parameters: I've been experimenting with the parameter in a contract, specifically in a VesselParameterGroup. Currently having trouble within 2 VPGs. See below: VPG #1, which defines the vessel "spaceStation": Spoiler PARAMETER { name = vesselGroupLaunch type = VesselParameterGroup title = Put your first Space Station in Orbit notes = The station must include at least 1 Docking Port and support for at least 3 Crew define = spaceStation defineList = spaceStationsEarth PARAMETER { name = NewVessel type = NewVessel title = Launch a New Station hideChildren = true } PARAMETER { name = Crewmembers type = HasCrew minCrew = 0 maxCrew = 0 title = Uncrewed hideChildren = true } PARAMETER { name = HasCapacity type = HasCrewCapacity minCapacity = 3 title = Space for at least 3 crew hideChildren = true } PARAMETER { name = DockingPort type = PartValidation partModule = ModuleDockingNode minCount = 1 title = Have at least 1 Docking Ports hideChildren = true } PARAMETER { name = Orbit type = Orbit minPeA = 250000 maxApA = 2000000 targetBody = HomeWorld() title = Reach Orbit with a Perigee greater than 250 km and an Apogee less than 2,000 km hideChildren = true } disableOnStateChange = true } VPG #2, which comes after VPG #1, and uses "spaceStation": Spoiler PARAMETER { name = stayOnStation type = VesselParameterGroup title = Keep at least 2 crew aboard the station for 30 days. vessel = spaceStation completeInSequence = true PARAMETER { name = CrewmembersDuration type = HasCrew minCrew = 2 title = Have at least 2 crewmembers on board hideChildren = true } PARAMETER { name = OrbitDuration type = Orbit minPeA = 250000 maxApA = 2000000 targetBody = HomeWorld() disableOnStateChange = true title = Remain in a Stable Orbit } PARAMETER { name = Duration type = Duration duration = 30d startCriteria = PARAMETER_COMPLETION parameter = OrbitDuration parameter = CrewmembersDuration preWaitText = Transfer to the station in the specified orbit. waitingText = Orbiting... completionText = Stay completed, you may return home now. } } When testing, I sent a station up with 0 crew first, and it satisfied the HasCrew parameter in VPG #1. No problems so far. What I did notice however, was that the uncrewed Station was satisfying the HasCrew parameter in VPG #2, which requires a minimum of 2 Crew members be on board. This has led me to question how CC saves the properties of vessels for VPG parameters. I'm not sure how a 0 crew vessel is satisfying a 2 crew parameter, which is really bad, because I don't want the Duration parameter in VPG #2 to start until it has crew. Any ideas? Quote Link to comment Share on other sites More sharing options...
Teykn Posted January 30, 2022 Share Posted January 30, 2022 On 1/28/2022 at 5:36 PM, Teykn said: Question regarding the HasCrew Parameter, and overall how CC tracks and updates parameters: I've been experimenting with the parameter in a contract, specifically in a VesselParameterGroup. Currently having trouble within 2 VPGs. See below: VPG #1, which defines the vessel "spaceStation": Reveal hidden contents PARAMETER { name = vesselGroupLaunch type = VesselParameterGroup title = Put your first Space Station in Orbit notes = The station must include at least 1 Docking Port and support for at least 3 Crew define = spaceStation defineList = spaceStationsEarth PARAMETER { name = NewVessel type = NewVessel title = Launch a New Station hideChildren = true } PARAMETER { name = Crewmembers type = HasCrew minCrew = 0 maxCrew = 0 title = Uncrewed hideChildren = true } PARAMETER { name = HasCapacity type = HasCrewCapacity minCapacity = 3 title = Space for at least 3 crew hideChildren = true } PARAMETER { name = DockingPort type = PartValidation partModule = ModuleDockingNode minCount = 1 title = Have at least 1 Docking Ports hideChildren = true } PARAMETER { name = Orbit type = Orbit minPeA = 250000 maxApA = 2000000 targetBody = HomeWorld() title = Reach Orbit with a Perigee greater than 250 km and an Apogee less than 2,000 km hideChildren = true } disableOnStateChange = true } VPG #2, which comes after VPG #1, and uses "spaceStation": Reveal hidden contents PARAMETER { name = stayOnStation type = VesselParameterGroup title = Keep at least 2 crew aboard the station for 30 days. vessel = spaceStation completeInSequence = true PARAMETER { name = CrewmembersDuration type = HasCrew minCrew = 2 title = Have at least 2 crewmembers on board hideChildren = true } PARAMETER { name = OrbitDuration type = Orbit minPeA = 250000 maxApA = 2000000 targetBody = HomeWorld() disableOnStateChange = true title = Remain in a Stable Orbit } PARAMETER { name = Duration type = Duration duration = 30d startCriteria = PARAMETER_COMPLETION parameter = OrbitDuration parameter = CrewmembersDuration preWaitText = Transfer to the station in the specified orbit. waitingText = Orbiting... completionText = Stay completed, you may return home now. } } When testing, I sent a station up with 0 crew first, and it satisfied the HasCrew parameter in VPG #1. No problems so far. What I did notice however, was that the uncrewed Station was satisfying the HasCrew parameter in VPG #2, which requires a minimum of 2 Crew members be on board. This has led me to question how CC saves the properties of vessels for VPG parameters. I'm not sure how a 0 crew vessel is satisfying a 2 crew parameter, which is really bad, because I don't want the Duration parameter in VPG #2 to start until it has crew. Any ideas? Ok, did some more testing, here's what I found and I am very confused about it. Launched a new station, blah blah, VPG #1 is satisfied. Under VPG #2, HasCrew is satisfied and so is Orbit, but the Duration did not start. I thought it was a visual bug I decided to go back to the space center, to the tracking station, and back to the station, to see if anything changed. HasCrew became unsatisfied, which I thought was good, but the Duration started, when it shouldn't be, since the 2 parameters needed weren't satisfied. I am now 200% more confused. Quote Link to comment Share on other sites More sharing options...
Teykn Posted February 7, 2022 Share Posted February 7, 2022 (edited) Ok, with further testing, it seems the issue is NOT in the HasCrew parameter, but with how CC updates i think. If VPG #1 defines a vessel and there is a VPG #2 that uses the vessel, then whenever VPG #1 completes, which changes the state of the vessel, all of VPG #2’s child parameters are satisfied no matter what. EDIT: Issue has been fixed. Turns out completeInSequence = true is needed for child parameters as well to ensure they don't break. I'm... not sure why they're needed or how that fixes it but I'm not going to question why. Edited March 11, 2022 by Teykn Quote Link to comment Share on other sites More sharing options...
R-T-B Posted February 20, 2022 Share Posted February 20, 2022 Hello all. Not sure if @nightingale is still around, but I made a patchset with some Kopernicus quality of life improvements. Mainly, filtering the optional fake watchdog celestial from contracts, and (in prerelease) trying to not assign inappropriate/unfullfillable ore contracts. You can grab it here: https://github.com/R-T-B/ContractConfigurator/releases Source: https://github.com/R-T-B/ContractConfigurator License: MIT Quote Link to comment Share on other sites More sharing options...
Teykn Posted March 11, 2022 Share Posted March 11, 2022 Heyo, is there anyway to create a list from 2+ other lists in CC? What I'm trying to do is something like: Quote DATA { type = List<Vessel> requiredValue = true validVesselList = $stationList + $highOrbitList title = Must have a valid vessel } where stationList and highOrbitList are both lists of vessels. I doubt this is the correct syntax though, since + is used mostly for numbers afaik. What should I use here? Quote Link to comment Share on other sites More sharing options...
Aelfhe1m Posted March 11, 2022 Share Posted March 11, 2022 2 hours ago, Teykn said: Heyo, is there anyway to create a list from 2+ other lists in CC? What I'm trying to do is something like: where stationList and highOrbitList are both lists of vessels. I doubt this is the correct syntax though, since + is used mostly for numbers afaik. What should I use here? According to the wiki it should probably be validVesselList = $stationList.Concat($highOrbitList) Quote Link to comment Share on other sites More sharing options...
r3_141592654 Posted March 24, 2022 Share Posted March 24, 2022 (edited) Had a crash while recovering Pioneer-1 from the History of Spaceflight Contract Pack. It Told me to post this on here: Exception occured while saving ScenarioModule 'PersistentDataStore': System.NullReferenceException: Object reference not set to an instance of an object at ContractConfigurator.PersistentDataStore.OutputValue (System.Object value, System.Type& type) [0x00000] in <ef0243a06f2841fe9bf57034a334902e>:0 at ContractConfigurator.PersistentDataStore.StoreToConfigNode (ConfigNode node, System.String key, System.Object value) [0x00002] in <ef0243a06f2841fe9bf57034a334902e>:0 at ContractConfigurator.PersistentDataStore.OnSave (ConfigNode node) [0x0003f] in <ef0243a06f2841fe9bf57034a334902e>:0 I am using the latest KSP 1.12.3.something. Just downloaded latest of mods about a month ago when I started playing again. Happened a second time with same message. Edited March 24, 2022 by r3_141592654 Adding Info Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.