nightingale

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

Recommended Posts

I'm using the tourism plus contract pack. This contract has a mission "space camp" which gives new kerbals.

 

I wonder, can I modify this mission to give "random traits" to the new kerbals, instead of always 1 pilot, 1 scientist and 1 engineer?

 

I tried creating a module manager patch but am wondering if it will actually work:

 

@CONTRACT_TYPE[Tourism_SpaceCamp]:AFTER[ContractPacks]:NEEDS[UmbraSpaceIndustries]
{
    -BEHAVIOUR:HAS[#type[ChangeKerbalType]] {}
    BEHAVIOUR
    {
        type = ChangeKerbalType
        onState = CONTRACT_COMPLETED
        KERBAL_INFO
        {
            kerbal = @/candidates.ElementAt(0)
            trait = [Pilot, Engineer, Scientist].Random()
            kerbalType = Crew
        }
        KERBAL_INFO
        {
            kerbal = @/candidates.ElementAt(1)
            trait = [Pilot, Engineer, Scientist].Random()
            kerbalType = Crew
        }
        KERBAL_INFO
        {
            kerbal = @/candidates.ElementAt(2)
            trait = [Pilot, Engineer, Scientist].Random()
            kerbalType = Crew
        }
    }
}
	

Mainly am I wondering: is the way to define the list correct? Or should the traits be between quotations (being a string)? `["Pilot", "Engineer", "Scientist"].random()`. The original contract type also doesn't use strings.

Edited by paul23

Share this post


Link to post
Share on other sites

I'm still having issues with Contract Configurator with Breaking Grounds.  The start screen won't let me click any of the links.  I've deleted all mods and the game works fine, but when I add just Contract Configurator (the new one updated 10/17), the start screen links become broken and I can't do anything.  Does anyone else have this issue or know how to fix it?

Share this post


Link to post
Share on other sites
Posted (edited)

Hey @nightingale - found a bug I think.

When a vessel is spawned in using the SpawnVessel behaviour, it's trying to run it's Part Modules. This causes serious problems when the scene is the Space Centre scene! I noticed it because OhScrap! started to throw NullRef after Nullref just after accepting a contract (because OhScrap! expects that it won't be able to set itself up properly the first time, and tries again).

https://www.dropbox.com/s/kx7gh1e88mhggmj/KSP.log?dl=0

This log shows a real simple Test Part Module that just spams the log. I tried just launching a vessel at first, to see if it was KSP running Part Modules in the Space Centre scene if they were within physics range - it wasn't. Then I accepted the contract again, and the part modules started running. After digging into the log a little, I found that it wasn't just OhScrap! having problems - lots of Modules were failing, it was just OhScrap! being insistent about it.

The contact that triggers the behaviour is this one: https://github.com/Mark-Kerbin/Kerbal-Academy-Contract-Pack/blob/master/KerbalAcademyBootCamp.cfg

AFAIK this is new behaviour in 1.8.x - I've never seen it before.

 

Edited by severedsolo

Share this post


Link to post
Share on other sites

How might I go about modifying the parameters to stock contracts? Specifically I want to increase the minimum altitude at which rescue contracts will spawn Kerbals. I'm playing with RSS and the last rescue mission I accepted spawned a Kerbal in orbit within the atmosphere. Any help on how to tweak this setting? Additionally, would it be possible to tweak which parts the rescue missions can spawn a Kerbal in? Some of the modded parts I have can contain Kerbals but don't have an EVA hatch, so the Kerbal can't get out when that's the only part. Is there a way to make these contracts only pick from parts that have hatches? Thanks in advance for any help.

Share this post


Link to post
Share on other sites

Hi Di Hi Contract Configurators!

I'm once again on my quest to create a 'colonizing' mod, this time it may actually get some completeness.

The concept is that one you have landed a base with a 'colony arcology' - available high up the tech tree - you will then have contracts available to spawn kerbals.  I'm also thinking that you take a particular part on a survey ship then once landed a contract would remove that craft and replace with your base.

I can spawn them fine, in a part.  However I'd like some time limit before they spawn once you accept the contract - this time would be their 'training' of the unseen colonists.

I seem to be able to use the contract once though, for my 'colony part' (a copied hitchhiker) and the kerbals appear immediately. 

How do I nestle the spawn behaviour after the duration, or have the kerbals spawn at the end of the contract?

Thanks!

 

Peace.

Share this post


Link to post
Share on other sites
6 hours ago, theJesuit said:

I can spawn them fine, in a part.  However I'd like some time limit before they spawn once you accept the contract - this time would be their 'training' of the unseen colonists.

You'd have to ask nightingale for an enhancement request.

Certain behaviours (like DialogBox) allow you to set TriggerConditions (like on Parameter Completed) - but SpawnKerbal doesn't have that according to the wiki.

But if it did exist, you could then put a hidden timer Parameter, and have the behaviour trigger when the hidden parameter completes.

Alternatively, you could write a little plugin to do it for you, I don't think it would be terrible difficult.

Edited by severedsolo

Share this post


Link to post
Share on other sites
3 hours ago, severedsolo said:

You'd have to ask nightingale for an enhancement request.

Ah.  Will do.  Thanks.

My coding is non existantant unfortunately.   It would be great if someone did want to code this as a click on part, wait, spawn at its most basic... maybe a message to say that a kerbal is ready to spawn...

Maybe now that we will have a spawing colonist mechanic in ksp2 there may be some desire for a person to do it?

Back to CC then...Is it possible then to have a contract to spawn kerbals to occur once another contract has completed? Then the first (a training prior to hire if you like) can be completed?

Share this post


Link to post
Share on other sites

I guess another idea... have the contract simply as a hire mechanic rather than a pseudo generator (training) thing.

Then make a new contract take a while to reappear?  Could that be an option?

Peace.

Share this post


Link to post
Share on other sites

I am trying to fix Kerbal Academy for myself, CC is spamming the following errors:

[EXC 17:38:40.074] NullReferenceException: Object reference not set to an instance of an object
	ContractConfigurator.ExpressionParser.ExperienceTraitParser.EQ (Experience.ExperienceTrait a, Experience.ExperienceTrait b) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ApplyBooleanOperator (T lval, System.String op, T rval) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseMethod[TResult] (ContractConfigurator.ExpressionParser.BaseParser+Token token, T obj, System.Boolean isFunction) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].CompleteIdentifierParsing[U] (U value) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSpecialIdentifier (ContractConfigurator.ExpressionParser.BaseParser+Token token) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSimpleStatement[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].GetRval () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseOperation[TResult] (T lval, System.String op) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] (T lval) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatementInner[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSimpleStatement[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatementInner[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	Rethrow as Exception: Error parsing statement.
	Error occurred near '*':
	(@/trainee.RosterStatus() == Available && @/trainee.ExperienceTrait() == Scientist && @/trainee.ExperienceLevel() < @/newLevel)
	.........................................* <-- HERE
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ExecuteExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ConfigNodeUtil.ParseSingleValue[T] (System.String key, System.String stringValue, System.Boolean allowExpression) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractCo

Any help would be appreciated, since I have no coding experience at all...

Share this post


Link to post
Share on other sites

Just a question really: what happens to contract when I have two vessels with same name?

What happened to me is that I forgot to rename station I just launched to Minmus so it had same name as the one around Mun.
Then I got some T+ contracts to find out that they are all broken (No vessel currently matching parameters).

Downloaded the source to look around a bit, how all this works. Looks like VesselParameterGroup.vesselList contains names of the vessels, which is used as a key for ContractVesselTracker.
so, if I save and exit the game, load the next day, there is a chance that the link breaks, using/registering the key for the other vessel and those contracts break.
Is that the case?

Share this post


Link to post
Share on other sites
21 hours ago, Pratherdude said:

I am trying to fix Kerbal Academy for myself, CC is spamming the following errors:


[EXC 17:38:40.074] NullReferenceException: Object reference not set to an instance of an object
	ContractConfigurator.ExpressionParser.ExperienceTraitParser.EQ (Experience.ExperienceTrait a, Experience.ExperienceTrait b) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ApplyBooleanOperator (T lval, System.String op, T rval) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseMethod[TResult] (ContractConfigurator.ExpressionParser.BaseParser+Token token, T obj, System.Boolean isFunction) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].CompleteIdentifierParsing[U] (U value) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSpecialIdentifier (ContractConfigurator.ExpressionParser.BaseParser+Token token) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSimpleStatement[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].GetRval () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseOperation[TResult] (T lval, System.String op) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] (T lval) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatementInner[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSimpleStatement[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatementInner[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] () (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	Rethrow as Exception: Error parsing statement.
	Error occurred near '*':
	(@/trainee.RosterStatus() == Available && @/trainee.ExperienceTrait() == Scientist && @/trainee.ExperienceLevel() < @/newLevel)
	.........................................* <-- HERE
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ExecuteExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractConfigurator.ConfigNodeUtil.ParseSingleValue[T] (System.String key, System.String stringValue, System.Boolean allowExpression) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
	ContractCo

Any help would be appreciated, since I have no coding experience at all...

As I am currently looking at the code, I can only guess that there is some null in that expression:

@/trainee.ExperienceTrait() == Scientist

and the EQ operator is not properly protected against nulls:
  

      public override bool EQ(ExperienceTrait a, ExperienceTrait b)
      {
            if (base.EQ(a, b))
            {
                return true;
            }

            return a.TypeName == b.TypeName;
       }

the base.EQ is, but if any side is null, then it attempts to access the TypeName and throws the exception. No idea how the null gets there and I know nothing about CC, was just looking for something else, digging a bit in the code.

Share this post


Link to post
Share on other sites

Something is really really wrong with the vessel-tracking / vessel-keying:

unknown.png

Crew a Base or Station:
Vessel: Kerbin Station Core (not checked)
Vessel: Kerbin Station (checked - renamed it)
Complete ALL of the following:
  Crew: At least 1 Kerbal
I did it! Bob is there! I even transfered him fom the lander to the lab

Went to tracking station:

unknown.png

How is it still "Kerbin Station Core"?
Ok rename it yet again:
unknown.png
unknown.png
I have just renamed the vessel for second time, did nothing else!

Share this post


Link to post
Share on other sites
On 1/29/2020 at 12:55 AM, Pratherdude said:

I am trying to fix Kerbal Academy for myself, CC is spamming the following errors:

Kerbal Academy has other (more serious) issues too, I'd recommend not using it right now tbh (I have reported this, but nightingale isn't very active, so who knows if/when it will be fixed).

There's... plans in the works to make Kerbal Academy obsolete, but I'm not really ready to talk about that yet.

Share this post


Link to post
Share on other sites
6 minutes ago, severedsolo said:

I'd recommend not using it right now tbh (I have reported this, but nightingale isn't very active, so who knows if/when it will be fixed).

There's... plans in the works to make Kerbal Academy obsolete, but I'm not really ready to talk about that yet.

OK, guess I'll give it up then, and uninstall. Thanks.

Share this post


Link to post
Share on other sites

I still have the problem with 'nothing is clickable in main menu' when this mod is loaded.
I'm on KSP 1.8.1.2694. I've verified KSP game files in steam - no errors.

Contract Configurator (version 1.28.0) is the only mod loaded. Doesn't matter if loaded from CKAN or manually from git.

In the log file I have this error:

[EXC 21:41:17.020] AmbiguousMatchException: Ambiguous match found.
    System.RuntimeType.GetField (System.String name, System.Reflection.BindingFlags bindingAttr) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
    System.Type.GetField (System.String name) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
    ContractConfigurator.StockContractParametersTemplate.OnLoad (ConfigNode node) (at <43a2e7cbd59545c6b9206fcd382ecb64>:0)
    GameParameters+ParameterNode.Load (ConfigNode node) (at <9d71e4043e394d78a6cf9193ad011698>:0)
    GameParameters.LoadCustomNode (ConfigNode node) (at <9d71e4043e394d78a6cf9193ad011698>:0)
    GameParameters.Load (ConfigNode node) (at <9d71e4043e394d78a6cf9193ad011698>:0)
    GameParameters..ctor (ConfigNode node) (at <9d71e4043e394d78a6cf9193ad011698>:0)
    GameParameters.GetDefaultParameters (Game+Modes mode, GameParameters+Preset p) (at <9d71e4043e394d78a6cf9193ad011698>:0)
    MainMenu.Start () (at <9d71e4043e394d78a6cf9193ad011698>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)

Share this post


Link to post
Share on other sites

Hello Everyone,

I am trying to write some contracts and I want to create a filter list of all available experiments (with remaining science to collect) that can be run on the surface by the different biomes.  Can someone help guide me to the right set of expressions to create the list?  Thanks in advanced....

Share this post


Link to post
Share on other sites


This mod is definitely not working correctly with 1.9.0 sadly, noticing numerous issues that match what others are posting here.

Didn't realize how much I enjoyed this mod until had to remove. Hoping for a 1.9 compat version.

 

Share this post


Link to post
Share on other sites

Is there anything special I need to be able to do to use the parameter-level rewards? While the parameter is being properly satisfied, parameter-level `rewardFunds` isn't being given.

Share this post


Link to post
Share on other sites

something I did not understand: how is it done to create my own contracts? I can't find the option

 

Share this post


Link to post
Share on other sites

Hi all...  I'll be taking a look at the mod soon to get it working with KSP 1.9.1.  I was planning on doing that this weekend, but it's been a bit hectic and now they've announced that schools and daycares will be closed in our province and we're running around trying to figure out what to do about it.

I see a few issues from the past few months, but I'll start with some "regular" KSP 1.9.1 compatibility fixes before I go chasing anything down.

Share this post


Link to post
Share on other sites
On 3/16/2020 at 6:53 AM, nightingale said:

Hi all...  I'll be taking a look at the mod soon to get it working with KSP 1.9.1.  I was planning on doing that this weekend, but it's been a bit hectic and now they've announced that schools and daycares will be closed in our province and we're running around trying to figure out what to do about it.

I see a few issues from the past few months, but I'll start with some "regular" KSP 1.9.1 compatibility fixes before I go chasing anything down.

Stay safe! And thank you :) 

Share this post


Link to post
Share on other sites

Hello,

I've been playing for a while on KSP 1.4.5, and decided recently to switch to 1.8.1 (many mods are not updated for 1.9.1).

Could you tell me what are the contract packs still working for KSP 1.8+ ? I've the impression that some of my favorites like Kerbal Academy are dead :(

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.