Morphisor Posted September 19, 2021 Share Posted September 19, 2021 22 minutes ago, Caerfinon said: An easier way would be to remove all unmet requirements (or comment them out) and then the contract will be offered. 2 hours ago, Krzeszny said: What would a contract look like if it had 2 parameters: Parameter 1 would check for module x (unspecified part) and gave a specific reward (multiple parts have that module) Parameter 2 would check for one specific part (which has module x in it) but gave a different reward? I know how to check for errors (the Ctrl+Alt+F10 menu) but not how to "spawn" a contract if not all requirements have been met, so testing it isn't that easy. Alternatively, it is possible to deactivate a requirement while in-game, through the CC debug menu. Just click on the green check icon next to the requirement after browsing to it. Be mindful however, I have found the contract can behave strangely when using this method (blinking in and out of existence), I only use it to check if it is loaded correctly, never to actually playtest. It's one of those features that's not quite functioning right. Quote Link to comment Share on other sites More sharing options...
Krzeszny Posted September 27, 2021 Share Posted September 27, 2021 (edited) Hi again. I'm still working on a pull request that would make this mod compatible with SSPXR and USI. Among other new mod-specific parameters, I added this under the vanilla science lab: PARAMETER:NEEDS[StationPartsExpansionRedux] { name = PartValidation type = PartValidation title = Include an SDV-X 'Cronus' Extensible Centrifuge rewardFunds = 181000.0 hideChildren = true part = sspx-expandable-centrifuge-5-1 } After uninstalling Stockalike Station Parts Expansion Redux and making sure a folder named StationPartsExpansionRedux isn't in GameData, I'm getting this in my career save: Fulll error: Spoiler Exception occured while loading contract parameter 'PartValidation' in contract 'BasesandStations.StationCore': System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: 'sspx-expandable-centrifuge-5-1' is not a valid Part. at ContractConfigurator.ConfigNodeUtil.ParsePartValue (System.String partName) [0x00025] in <ef0243a06f2841fe9bf57034a334902e>:0 at ContractConfigurator.ConfigNodeUtil.ParseSingleValue[T] (System.String key, System.String stringValue, System.Boolean allowExpression) [0x000f9] in <ef0243a06f2841fe9bf57034a334902e>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <9577ac7a62ef43179789031239ba8798>:0 --- End of inner exception stack trace --- at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <9577ac7a62ef43179789031239ba8798>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0 at ContractConfigurator.ConfigNodeUtil.ParseValue[T] (ConfigNode configNode, System.String key, System.Boolean allowExpression) [0x001f0] in <ef0243a06f2841fe9bf57034a334902e>:0 at ContractConfigurator.ConfigNodeUtil.ParseValue[T] (ConfigNode configNode, System.String key, T defaultValue) [0x00012] in <ef0243a06f2841fe9bf57034a334902e>:0 at ContractConfigurator.Parameters.PartValidation.OnParameterLoad (ConfigNode node) [0x00079] in <ef0243a06f2841fe9bf57034a334902e>:0 at ContractConfigurator.Parameters.ContractConfiguratorParameter.OnLoad (ConfigNode node) [0x000be] in <ef0243a06f2841fe9bf57034a334902e>:0 Why and how? Edited September 27, 2021 by Krzeszny formatting Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted September 27, 2021 Share Posted September 27, 2021 40 minutes ago, Krzeszny said: Why and how? Have you turned on Contract Configurator debugging? If so post a copy of the log for the contract. If not look at the file ContractConfigurator.cfg.default and follow instructions to turn on debug logging and generate the error again. Quote Link to comment Share on other sites More sharing options...
Krzeszny Posted September 27, 2021 Share Posted September 27, 2021 14 minutes ago, Caerfinon said: Have you turned on Contract Configurator debugging? If so post a copy of the log for the contract. If not look at the file ContractConfigurator.cfg.default and follow instructions to turn on debug logging and generate the error again. Here's the log from these settings (triple DEBUG because I didn't know what to choose): Spoiler CC_DEBUGGING { // Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR logLevel = DEBUG ADD_LOGLEVEL_EXCEPTION { // Type name type = ContractConfigurator // Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR logLevel = DEBUG } ADD_LOGLEVEL_EXCEPTION { // Type name type = ContractType // Possible LogLevel: VERBOSE, DEBUG, INFO, WARNING, ERROR logLevel = DEBUG } } https://drive.google.com/file/d/1-QmLtpFuqF8NzSZphk17B7XttWIa4fJ4/view?usp=sharing Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted September 27, 2021 Share Posted September 27, 2021 5 minutes ago, Krzeszny said: Here's the log So the contract Configurator log shows the contract parsed correctly with only the science lab present; PARAMETER { name = ScienceModuleValidation type = Any optional = true completeInSequence = true targetBody = @/targetBody PARAMETER { name = ScienceLab type = PartValidation title = Include a TEST LAB SO CHECK IT OUT, NAOW rewardFunds = 75000.0 hideChildren = true partModule = ModuleScienceLab targetBody = @/targetBody } } That should be the contract that is offered in-game as it loaded successfully without the StationPartsExpansionRedux parameter. Do you see it as offered? Quote Link to comment Share on other sites More sharing options...
Krzeszny Posted September 27, 2021 Share Posted September 27, 2021 (edited) 9 minutes ago, Caerfinon said: So the contract Configurator log shows the contract parsed correctly with only the science lab present; PARAMETER { name = ScienceModuleValidation type = Any optional = true completeInSequence = true targetBody = @/targetBody PARAMETER { name = ScienceLab type = PartValidation title = Include a TEST LAB SO CHECK IT OUT, NAOW rewardFunds = 75000.0 hideChildren = true partModule = ModuleScienceLab targetBody = @/targetBody } } That should be the contract that is offered in-game as it loaded successfully without the StationPartsExpansionRedux parameter. Do you see it as offered? (lol, I forgot to change that test name.) No, I see all of them: And the CC debug menu shows only what should be there without SSPXR installed: Spoiler I'm pretty sure it's because I uninstalled the mod that adds those labs and I keep loading a save that has a contract for them. At the same time I wasn't expecting CC to throw an exception because of uninstalling a mod. Edited September 27, 2021 by Krzeszny save? Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted September 27, 2021 Share Posted September 27, 2021 6 minutes ago, Krzeszny said: I'm pretty sure it's because I uninstalled the mod that adds those labs and I keep loading a save that has a contract for them. At the same time I wasn't expecting CC to throw an exception because of uninstalling a mod. And the light comes on... Once a contract is offered it is recorded in the form it was offered in into the contract section of the persistent.sfs file of your game. It works on the same principal as a ship you have in orbit when you remove a parts mod. If the stored offered contract is looking for the part but the mod is removed then CC has a hissy fit that the part is gone. Meanwhile any new offered contracts should ignore the part as per the new version of the loaded contract. Quote Link to comment Share on other sites More sharing options...
Krzeszny Posted September 27, 2021 Share Posted September 27, 2021 (edited) On 9/27/2021 at 6:53 PM, Caerfinon said: And the light comes on... Once a contract is offered it is recorded in the form it was offered in into the contract section of the persistent.sfs file of your game. It works on the same principal as a ship you have in orbit when you remove a parts mod. If the stored offered contract is looking for the part but the mod is removed then CC has a hissy fit that the part is gone. Meanwhile any new offered contracts should ignore the part as per the new version of the loaded contract. You're not saying the exception is normal and it's ok that the message that says "Avoid saving your game and backup yous save immediatelly", right? If this exception doesn't break anything, it shouldn't be an exception. Edited September 28, 2021 by Krzeszny shouldn't, not should Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted September 27, 2021 Share Posted September 27, 2021 @Krzeszny I'm more saying that the removal of a part mod from an active game produces unintended consequences. Broken ships, broken Contract Configurator contracts. The code throws the exception because it is working off of old information. Contract configurator does not cleanup contracts already stored in the persistent.sfs when the game loads. Therefore when it encounters the missing part in the stale contract, it throws an exception because it has no other way to resolve the issue. So in this specific instance, the exception is very little to worry about, but i suspect that there is only a single bit of code that posts messages for any and all exceptions, so caution is the watchword when catching the serious and the trivial. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted October 8, 2021 Share Posted October 8, 2021 (edited) HI, One of the mods I support is a contract pack called Bases & Stations. In one of the contract, there is a requirement for a specific part: //OPTIONAL Checks for cupola PARAMETER { name = PartValidation type = PartValidation title = Include a cupola (optional) optional = true hideChildren = true part = cupola minCount = 1 } Problem is that this is for a specific stock part, and I'd like to change it to allow any part with "cupola" anywhere in the part name or title, not sure how to do this. Can someone help? I and others will thank you Edited October 8, 2021 by linuxgurugamer Quote Link to comment Share on other sites More sharing options...
Gotmachine Posted October 8, 2021 Share Posted October 8, 2021 25 minutes ago, linuxgurugamer said: Problem is that this is for a specific stock part, and I'd like to change it to allow any part with "cupola" in the title, not sure how to do this. There is no way to do this directly through CC. A workaround could be to use MM patches to detected cupolas, and to add a dummy PartModule so you can detect it through the partModule PartValidation parameter (check documentation here : https://github.com/jrossignol/ContractConfigurator/wiki/PartValidation-Parameter) I would suggest making a tiny dll with an empty PartModule derivative named something like "ModuleCupolaContractValidation" for the purpose. Side note : checking the part title or tags will fail due to localization. You can only (somewhat) rely on the part name. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted October 8, 2021 Share Posted October 8, 2021 24 minutes ago, Gotmachine said: There is no way to do this directly through CC. A workaround could be to use MM patches to detected cupolas, and to add a dummy PartModule so you can detect it through the partModule PartValidation parameter (check documentation here : https://github.com/jrossignol/ContractConfigurator/wiki/PartValidation-Parameter) I would suggest making a tiny dll with an empty PartModule derivative named something like "ModuleCupolaContractValidation" for the purpose. Side note : checking the part title or tags will fail due to localization. You can only (somewhat) rely on the part name. I was afraid of that. Wanted to avoid yet another dll, but at least it's not difficult, just tedious. Thanks Quote Link to comment Share on other sites More sharing options...
Gotmachine Posted October 8, 2021 Share Posted October 8, 2021 2 minutes ago, linuxgurugamer said: Wanted to avoid yet another dll, but at least it's not difficult, just tedious. If you really want to avoid it, you can use a dummy ModuleDragModifier, which has no code and is just being checked at the part prefab compilation. As long as you don't touch the default "1f" value of its " dragModifier" field, it's garanteed to have zero effect. But it has a "dragCubeName" string KSPField that you can check with the CC extended partmodule check. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted October 8, 2021 Share Posted October 8, 2021 1 hour ago, Gotmachine said: Side note : checking the part title or tags will fail due to localization. You can only (somewhat) rely on the part name. This I know, unfortunately 1 hour ago, Gotmachine said: If you really want to avoid it, you can use a dummy ModuleDragModifier, which has no code and is just being checked at the part prefab compilation. As long as you don't touch the default "1f" value of its " dragModifier" field, it's garanteed to have zero effect. But it has a "dragCubeName" string KSPField that you can check with the CC extended partmodule check. Well, I've made the dll already, it's not going to hurt, but I'll look at this, thanks. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted October 17, 2021 Share Posted October 17, 2021 A problem has been reported to me about parts being referenced in a contract which don't exist: Can this be fixed? Quote Link to comment Share on other sites More sharing options...
Morphisor Posted October 17, 2021 Share Posted October 17, 2021 3 hours ago, linuxgurugamer said: A problem has been reported to me about parts being referenced in a contract which don't exist: Can this be fixed? When specifying requirements or objectives for a specific part from a different mod, always add a ":NEEDS[modname] to the node in question. Though beware, this also means the node won't be loaded at all if the needs isn't being met. You might need multiple nodes for all parts/functions you're trying to use this way. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted October 17, 2021 Share Posted October 17, 2021 3 hours ago, Morphisor said: When specifying requirements or objectives for a specific part from a different mod, always add a ":NEEDS[modname] to the node in question. Though beware, this also means the node won't be loaded at all if the needs isn't being met. You might need multiple nodes for all parts/functions you're trying to use this way. I realize that, and will have to do that, but would be nice if CC could ignore those errors Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted October 17, 2021 Share Posted October 17, 2021 (edited) Is it possible to have a NEEDS on a single line, like this: part = ht2_moduleCupola:NEEDS[HabTech2] I tend to doubt it, but figured I'd ask. Assuming that doesn't work, how can I have several PartValidation parameters, and only require 1 of them? Edited October 17, 2021 by linuxgurugamer Quote Link to comment Share on other sites More sharing options...
Zelda Posted October 17, 2021 Share Posted October 17, 2021 (edited) 19 minutes ago, linuxgurugamer said: Is it possible to have a NEEDS on a single line, like this: part = ht2_moduleCupola:NEEDS[HabTech2] I tend to doubt it, but figured I'd ask. Assuming that doesn't work, how can I have several PartValidation parameters, and only require 1 of them? I'm not sure about having NEEDS on a single line, but perhaps you could use the Any parameter? That should allow you to apply NEEDS to each child parameter. https://github.com/jrossignol/ContractConfigurator/wiki/Any-Parameter Edited October 17, 2021 by Zelda Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted October 17, 2021 Share Posted October 17, 2021 14 minutes ago, Zelda said: I'm not sure abobut having NEEDS on a single line, but perhaps you could use the Any parameter? That should allow you to apply NEEDS to each child parameter. https://github.com/jrossignol/ContractConfigurator/wiki/Any-Parameter Unfortunatly, no. REQUIREMENT is a prereq, I need to do this on a PARAMETER, Which, nicely enough, also has the ANY Quote Link to comment Share on other sites More sharing options...
luna_cat Posted October 24, 2021 Share Posted October 24, 2021 As the mod requested, here's a thrown exception: Quote Exception occured while saving ScenarioModule 'ContractVesselTracker': System.NullReferenceException: Object reference not set to an instance of an object at ContractConfigurator.Extensions+<>c__DisplayClass5_1.<GetHashes>b__1 (ProtoPartSnapshot childPart) [0x00000] in <ef0243a06f2841fe9bf57034a334902e>:0 at System.Linq.Enumerable+WhereListIterator`1[TSource].MoveNext () [0x00037] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) [0x00045] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at ContractConfigurator.Extensions+<GetHashes>d__5.MoveNext () [0x00364] in <ef0243a06f2841fe9bf57034a334902e>:0 at System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00036] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at System.Linq.Enumerable.Contains[TSource] (System.Collections.Generic.IEnumerable`1[T] source, TSource value) [0x0000a] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at ContractConfigurator.ContractVesselTracker+<>c__DisplayClass15_0.<OnSave>b__1 (Vessel v) [0x0000f] in <ef0243a06f2841fe9bf57034a334902e>:0 at System.Collections.Generic.List`1[T].Find (System.Predicate`1[T] match) [0x0000d] in <9577ac7a62ef43179789031239ba8798>:0 at ContractConfigurator.ContractVesselTracker.OnSave (ConfigNode node) [0x00060] in <ef0243a06f2841fe9bf57034a334902e>:0 Quote Link to comment Share on other sites More sharing options...
WindupHero7 Posted October 24, 2021 Share Posted October 24, 2021 Is it possible for some contract packs to be blocking others? No matter how many contracts I refuse, it seems I'm always offered the same few types from the same few packs even though I know I've got requirements met for other packs Quote Link to comment Share on other sites More sharing options...
Morphisor Posted October 25, 2021 Share Posted October 25, 2021 13 hours ago, luna_cat said: As the mod requested, here's a thrown exception: Without context nobody can help you with this. CC doesn't throw any errors like this by itself. Which contracts are involved, what are you doing when this error pops, etc. 11 hours ago, WindupHero7 said: Is it possible for some contract packs to be blocking others? No matter how many contracts I refuse, it seems I'm always offered the same few types from the same few packs even though I know I've got requirements met for other packs Sometimes it takes a while for technically available contracts to actually generate, the generation code has some oddities in it. Try waiting for several ingame days. Alternatively, I've found that simply browsing through the admin/science/astronaut/mission control buildings for a few minutes triggers generation of certain types of contracts too. If neither works, you're not matching the requirements or there's other things preventing the contract from generating. Quote Link to comment Share on other sites More sharing options...
luna_cat Posted October 25, 2021 Share Posted October 25, 2021 13 hours ago, Morphisor said: Without context nobody can help you with this. CC doesn't throw any errors like this by itself. Which contracts are involved, what are you doing when this error pops, etc. The mod requests that I paste the "info below" into this thread. I did what was requested. The error happened just after completing the Oddiseo Project Yliad contract. Quote Link to comment Share on other sites More sharing options...
Brigadier Posted October 26, 2021 Share Posted October 26, 2021 5 hours ago, luna_cat said: The mod requests that I paste the "info below" into this thread. I did what was requested. The error happened just after completing the Oddiseo Project Yliad contract. The mod is telling you do the bare minimum and, as @Morphisor suggested, more insight will be necessary. Read the topic at the link below and provide the info it asks for, otherwise there isn't much hope of getting a meaningful response. If you're going to the trouble of posting here, help yourself and others by providing as much info as practical to assist in the detective work on your behalf. 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.