Jump to content

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


nightingale

Recommended Posts

I've never nested one vessel parameter group inside another. But I have used the Type Any parameter to nest multiple Vessel Parameter groups as separate solutions to completing the contract requirements     

PARAMETER
{
    name = Any
    type = Any
	
	PARAMETER
	{
        name = VesselParameterGroup1
        type = VesselParameterGroup
		...
	}
	PARAMETER
	{
        name = VesselParameterGroup2
        type = VesselParameterGroup
		...
	}
	PARAMETER
	{
        name = VesselParameterGroup3
        type = VesselParameterGroup
		...
	}
}

 

Link to comment
Share on other sites

11 hours ago, Caerfinon said:

I've never nested one vessel parameter group inside another. But I have used the Type Any parameter to nest multiple Vessel Parameter groups as separate solutions to completing the contract requirements     

PARAMETER
{
    name = Any
    type = Any
	
	PARAMETER
	{
        name = VesselParameterGroup1
        type = VesselParameterGroup
		...
	}
	PARAMETER
	{
        name = VesselParameterGroup2
        type = VesselParameterGroup
		...
	}
	PARAMETER
	{
        name = VesselParameterGroup3
        type = VesselParameterGroup
		...
	}
}

 

Reviewing the doc, it looks like what I want is the type = ALL since I'm wanting all the child parameters/groups to have completed.

Thanks for getting me moving again.
 

 

Edited by Ooglak Kerman
Link to comment
Share on other sites

  • 3 weeks later...

I have been playing around with contract configurator to make some new contract lately and have encountered a pop-up exception in game which suggested me to post the error here.

the exception is 

Exception occured while loading contract 'KerbalAcademy.KerbalAcademy_PilotingTraining':
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Invalid cast from 'System.String' to 'System.Collections.Generic.List`1[[ContractConfigurator.Kerbal, ContractConfigurator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'.
  at System.Convert.DefaultToType (System.IConvertible value, System.Type targetType, System.IFormatProvider provider) [0x00269] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.String.System.IConvertible.ToType (System.Type type, System.IFormatProvider provider) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.Convert.ChangeType (System.Object value, System.Type conversionType, System.IFormatProvider provider) [0x0021b] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.Convert.ChangeType (System.Object value, System.Type conversionType) [0x0000c] in <9577ac7a62ef43179789031239ba8798>:0 
  at ContractConfigurator.ConfigNodeUtil.ParseSingleValue[T] (System.String key, System.String stringValue, System.Boolean allowExpression) [0x006a0] in <20a3a039060941bfb465629683bb64bf>: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.ConfiguredContract.OnLoad (ConfigNode node) [0x00233] in <20a3a039060941bfb465629683bb64bf>:0 

and the exact contract is:

CONTRACT_TYPE
{
    name = KerbalAcademy_PilotingTraining
    title = Kerbal Academy: Pilot Training Program
    group = KerbalAcademy
    description = It seems that a group of pilots is ready to improve their piloting skills. Take them to @targetVessel, along with 2 mentors to train them, then bring them back home.
    genericDescription = Put a gourp of pilots throught the training Program.
    synopsis = Complete the training course.
    completedMessage = Congratulations, we now have more experienced pilots on our team
    agent = Kerbal Academy
    notes = The parameters must be completed in order.
    minExpiry = 1
    maxExpiry = 7
    maxSimultaneous = 1
    cancellable = true
    declinable = true
    prestige = Significant
    targetBody = HomeWorld()
    rewardScience = 0.0
    rewardReputation = 10
    rewardFunds = 0
    failureReputation = 0
    failureFunds = 0
    advanceFunds = -50000 - @crew_size * 20000

    DATA
    {
        type = List<Kerbal>
        uniquenessCheck = CONTRACT_ACTIVE
        all_candidates = AllKerbals().Where(m => m.ExperienceTrait() == Pilot && m.ExperienceLevel()<= 2 && m.Type() == Crew && m.RosterStatus() == Available)
        trainee_list = @all_candidates.Random(@crew_size)
        title = Must have a group of Kerbals who qualify for the basic program.
    }

    DATA
    {
        type = int
        selectionIndex = Random(0, @validOTFs.Count() - 1)
        crew_size = @is_random_crewsize ? 2 : Random(3, 6)
    }

    DATA
    {
        type = double
        expAward = 8
    }

    DATA
    {
        type = bool     
        is_random_crewsize = 6 < @all_candidates.Count()
    }

    DATA
    {
        type = List<VesselIdentifier>
        requiredValue = false
        validOTFs = $KerbalAcademy_OrbitalTraingFacility.Where(vi => Vessel(vi).IsOrbiting() && Vessel(vi).EmptyCrewSpace() >= 8)
    }

    DATA
    {
        type = Vessel
        uniquenessCheck = CONTRACT_ACTIVE
        title = Must have an Orbital Training Facility with sufficient empty space
        targetVessel = @validOTFs.ElementAt(@selectionIndex)
    }

    BEHAVIOUR
    {
        name = AwardExperience
        type = AwardExperience
        kerbal = @/trainee_list
        experience = @/expAward
    }

    
    PARAMETER
    {	
        name = HasTrainee
        type = HasCrew
        kerbal = @/trainee_list
    }

    PARAMETER
    {
        name = HasMentor
        type = HasCrew
        trait = Pilot
        title = Must have an experienced Pilot on board
        minExperience = 4
    }

    PARAMETER
    {
        name = HasCommander
        type = HasCrew
        trait = Commander
        title = Must have a commander to oversee the training
        minExperience = 2
    }

    PARAMETER
    {
        name = DockwithStation
        type = Docking
        vessel = @/targetVessel
        title = Dock with @/targetVessel
        completeInSequence = true
    }

    PARAMETER
    {
        name = Duration
        type = Duration
        duration = 15d
        preWaitText = Waiting for the Crew.
        waitingText = Crew at the station
        completionText = Mission accomplished! Bring the crew back home.
        completeInSequence = true
    }

    PARAMETER
    {
        name = RecoverKerbal
        type = RecoverKerbal
        completeInSequence = true
        kerbal = @/trainee_list
    }

    REQUIREMENT
    {
        name = check_crew_count
        type = Expression
        expression = @/all_candidates.Count() > 1
        title = Must enough crew
    }
 
}

Anyone know what could be the problem?

Link to comment
Share on other sites

  • 2 weeks later...

I've used aircraft contracts and this one seemed interesting: stay above a requested altitude for a given time.

Yet the timer starts when the flight starts, and the mark gets checked by just waiting, not even flying.

To fix this, i've tried changing the contract code to this:

	//Contract Goals
	PARAMETER
	{
		name = VesselParameterGroup
		type = All
		title = fly up to 1,000m 
		
		vessel = @/craft
		
		PARAMETER
		{
			name = ReachState
			type = ReachState
			
			targetBody = Kerbin
			situation = FLYING
			minAltitude = 1000

			hideChildren = true
			hidden = true
			
			PARAMETER
			{
				name = VesselParameterGroup
				type = VesselParameterGroup
				title = Hold for 3min

				PARAMETER
				{
					name = Duration
					type = Duration
					
					duration = 180s
					preWaitText = and hold for: 
					waitingText = and hold for: 
					completionText = You did it!
				}		
			}
		}
		completeInSequence = true
		disableOnStateChange = true
		hideChildren = false
	}

What I did is I included the "hold for 3min" requirement inside the ReachState part. Yet the timer still starts even before the altitude is reached.

How would you solve that ? What syntax should I use ?

Link to comment
Share on other sites

1 hour ago, leroidangleterre said:

How would you solve that ? What syntax should I use ?

I think the problem is the position of the disableOnStateChange field - it applies to the vessel (so switching vessels would disable it) rather than the vessel state (so changes in altitude would affect it).

Try this (untested):

Spoiler
PARAMETER
{
	name = VesselGroup
	type = VesselParameterGroup
	title = Fly above 1000m for 3 minutes.
	
	PARAMETER
	{
		name = Has Crew
		type = HasCrew
		minCrew = 1
		title = Have at least 1 crewmember on board
	}

	PARAMETER
	{
		name = holdAltitude
		type = ReachState
		minAltitude = 1000
		situation = FLYING
		
		disableOnStateChange = true
		
		PARAMETER
		{
			name = Duration
			type = Duration
			duration = 3m
			preWaitText = Reach 1000m.
			waitingText = Hold above 1000m for 3 minutes.
			completedText = You did it!
		}
	}
}

 

 

Link to comment
Share on other sites

  • 1 month later...
On 7/4/2016 at 2:25 PM, nightingale said:

I think I know what it is - it's because of the way @inigma set up the contracts with the vessel tracking.  I'm willing to bet that it's tracking some old vessel (maybe one that doesn't exist any more).

There is a long standing issue with the Sounding Rockets contract pack. Is there a better way to do vessel tracking? I would love to update the contract pack and get this resolved once and for all, but I need some pointers on how to go about that.

Conceptually, the idea is to require the rocket to use the Sounding Rockets' Avionics Package and to start with (but not be required to finish with) one of the two Sounding Rockets' boosters.

The current WIP code is here --> https://github.com/MinchinWeb/ksp-ContractPack-SoundingRockets/blob/retry/Core/KSP-SR-2000m.cfg

Many thanks!

Link to comment
Share on other sites

Posted (edited)

is contracts suppose to place a waypoint if you also have waypoint manager installed?
I see no waypoint for this.

QSAu5gy.jpeg

Now unlike you smart lot I never knew what hadopelagic meant so googled it and it means deepest part of ocean?.
but in the contract window it says about orbiting kerbin so I am very confused how you can be orbiting Kerbin and also be in the deepest part of the ocean at the same time.

 

Please advise :(
thanks in advance

P.S

I think my install may be bugged or a few contracts I am using are bugged because I also had a contact to scan and transmit the data from a baobab tree which I did with the OP-E arm but never completes the transmit part always stays at 0% even though it clearly sent VIA the message at top left.

Edited by stk2008
Link to comment
Share on other sites

  • 2 weeks later...

Anyone know if it is possible to access the state of a contract - I.E. contract complete - from ModuleManager?

What I'm looking to do is to change the true | false of a PQSCities property if a specific contract has been completed.  I understand that I need to be able to access that PQSCities property.  I'm approaching this from both ends at this point.

 

Link to comment
Share on other sites

  • 1 month later...

Can a CompleteContract  REQUIREMENT  be based on completion of THIS OR THAT contract? 

Context:  A contract that is centric to OPM vs one that is centric to !OPM

 

Edited by Ooglak Kerman
Link to comment
Share on other sites

@siimav A feature recommendation if you please
Behaviour to rename a .txt file to a .cfg  (RenameTextFile)

Example use case:  enable a MM patch to add a resource or module to a part upon successful completion of a contract or parameter.

It is understood that a game restart would be necessary.

Link to comment
Share on other sites

3 hours ago, Ooglak Kerman said:

@siimav A feature recommendation if you please
Behaviour to rename a .txt file to a .cfg  (RenameTextFile)

Example use case:  enable a MM patch to add a resource or module to a part upon successful completion of a contract or parameter.

It is understood that a game restart would be necessary.

I'm sorry but that sounds like a terrible idea. I refuse to do anything that would affect MM patches after the game has loaded. There's always a better way.

Link to comment
Share on other sites

1 hour ago, siimav said:

I'm sorry but that sounds like a terrible idea. I refuse to do anything that would affect MM patches after the game has loaded. There's always a better way.

The other possibility I can think of would be a MM filter that would detect successful completion of a given contract and enable the MM patch to load.  Is that a node visible to MM?

Link to comment
Share on other sites

48 minutes ago, siimav said:

Just no. This still applies: 

 

I apologize for being unclear about what I was requesting in the previous exchange. Absent the behaviour in CC, I was not asking for any feature.  I'll head on back to the drawing board though.
Thanks for this great mod, though

Link to comment
Share on other sites

  • 3 weeks later...
On 8/11/2024 at 11:12 AM, siimav said:

What's Changed

Full Changelog: v2.10.0.0...v2.11.0.0

Hello Siimav! Wouldn't it be better to move CC to a newer post?

I think I'm not the only one that though that CC is still in the 1.3X version becasue of the first post in this thread. I mena, I found out about that CC was still being updated by peeking on the RO's Github :P

Link to comment
Share on other sites

7 hours ago, Gupyzer0 said:

Wouldn't it be better to move CC to a newer post?

Not really. Sure, the title of the topic could be fixed then but all the knowledge would get split between 2 different threads. Besides that, CC is maintained by an organization now, not me personally. The model of only a single person being able to modify the thread doesn't fit well at all.

Link to comment
Share on other sites

18 hours ago, siimav said:

Not really. Sure, the title of the topic could be fixed then but all the knowledge would get split between 2 different threads. Besides that, CC is maintained by an organization now, not me personally. The model of only a single person being able to modify the thread doesn't fit well at all.

Yeah fixing the title could be good enough I guess 

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...