Morphisor Posted February 23, 2021 Share Posted February 23, 2021 On 2/21/2021 at 9:14 PM, HawkEngineer said: Thanks for the tip, I did review the CE Pack but I also noticed that there is an old Issue in the github tracker for Contract Configurator which indicates a problem with the getresource retrieval. It could very well still be problematic. Last year I tried building a Skylab contract where a parameter had to be satisfied replicating the solar panel repairs to the station; the check was intended to make use of the EC generation (which is a resource for KSP) to have to exceed a certain amount in order to complete. However, *any* amount of generation completed the parameter regardless of what I did so I had to ditch the whole idea. Quote Link to comment Share on other sites More sharing options...
HawkEngineer Posted February 23, 2021 Share Posted February 23, 2021 12 minutes ago, Morphisor said: It could very well still be problematic. Last year I tried building a Skylab contract where a parameter had to be satisfied replicating the solar panel repairs to the station; the check was intended to make use of the EC generation (which is a resource for KSP) to have to exceed a certain amount in order to complete. However, *any* amount of generation completed the parameter regardless of what I did so I had to ditch the whole idea. Thanks for the response, I definitely think it is a bug right now. I tried multiple ways and expanded to list all the resources on the target vessel, no matter what I try, the amount of resources comes back as 0. At this point, I need to redesign the contracts to avoid calculating the amount of resource quantity and capacity onboard. Quote Link to comment Share on other sites More sharing options...
Kwebib Posted March 2, 2021 Share Posted March 2, 2021 Is there anywhere I can find a list of available expressions such as this? targetBody = AllBodies().Where(b => b.HasOcean()).Random() Specifically, the terms that end in (). Where can I find those? Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted March 2, 2021 Share Posted March 2, 2021 1 hour ago, Kwebib said: Is there anywhere I can find a list of available expressions such as this? The wiki has some examples under Expressions Look at the Types on the right hand side of the page. In each one you will see the methods and functions of each type. AllBodies() is a function the the CelestialBody type. Quote Link to comment Share on other sites More sharing options...
Kwebib Posted March 2, 2021 Share Posted March 2, 2021 (edited) Thanks, @Caerfinon. I had completely missed the types on the right side before. What I'm trying to do is make some contracts to award kerbals XP by going into LKO for long durations. I've always thought it was silly that a Kerbal could spend a year in orbit, but all he had to show for it was the ability to hold prograde/retrograde. Here is my code so far. I think it will get the kerbals up to Level 2. The problem is I need to tell "crew02" to select a Kerbal that is not "crew01". Anyone have any tips? Spoiler DATA { type = Kerbal uniquenessCheck = CONTRACT_ACTIVE crew01 = AllKerbals().Where(m => m.Type() == Crew && m.RosterStatus() == Available && m.ExperienceLevel()<2).SelectUnique() crew02 = AllKerbals().Where(m => m.Type() == Crew && m.RosterStatus() == Available && m.ExperienceLevel()<2).SelectUnique() title = Must have two crew members that have not completed this mission before. } DATA { type = int expAward01 = 8 - @/crew01.ExperienceLevel() expAward02 = 8 - @/crew02.ExperienceLevel() hidden = true } BEHAVIOUR { name = AwardExperience01 type = AwardExperience kerbal = @/crew01 experience = @/expAward01 } BEHAVIOUR { name = AwardExperience02 type = AwardExperience kerbal = @/crew02 experience = @/expAward02 } Edited March 2, 2021 by Kwebib Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted March 2, 2021 Share Posted March 2, 2021 (edited) 1 hour ago, Kwebib said: Anyone have any tips? why not put all the kerbals who match the criteria in to a Kerbal list and then select the first two in that list DATA { type = List<Kerbal> uniquenessCheck = CONTRACT_ACTIVE // Now you have all kerbals that meet the criteria in a list crewCandidates = AllKerbals().Where(m => m.Type() == Crew && m.RosterStatus() == Available && m.ExperienceLevel() <2 ) } DATA { type = Kerbal uniquenessCheck = CONTRACT_ACTIVE // Now assign the first two kerbals in the list to your crew variables crew01 = @/crewCandidates.ElementAt(0) crew02 = @/crewCandidates.ElementAt(1) title = Must have two crew members that have not completed this mission before. } Edited March 2, 2021 by Caerfinon Quote Link to comment Share on other sites More sharing options...
Kwebib Posted March 2, 2021 Share Posted March 2, 2021 (edited) @Caerfinon that should work. Thank you! This is probably a dumb question, but does contract configurator use C# syntax for some of its code? That would explain why I can't figure out how to do stuff, because I have very limited coding experience. Specifically, the DATA nodes are where I struggle. It's easy enough to code in requirements and parameters. Edited March 2, 2021 by Kwebib Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted March 2, 2021 Share Posted March 2, 2021 16 minutes ago, Kwebib said: I have very limited coding experience I'm in the same boat. The last time I really coded I was punching computer cards with FORTRAN instructions and feeding them into an IBM mainframe. I wouldn't know what type of syntax it is, just that it has a particular structure that can be learned. I find that reading through other people's contracts and trying to follow what they are doing helps a great deal. The contract packs Career Evolution and Field Science were especially good examples for me. Eventually you just pick up the flow of it over time. DATA nodes were tough until i picked up on Types after that it was easier to get them to do what I wanted. Lots of wiki reading. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted March 3, 2021 Share Posted March 3, 2021 Having a problem with a contract for KerbalGPS. DATA { type = float orbitRadiusMultiplier = Prestige() == Significant ? [3, 4].Random() : [2,3].Random() } DATA { type = double //orbitRadius = @planet.Radius() * 4 * orbitRadiusMultiplier orbitRadius = 200000 * 4 * orbitRadiusMultiplier } BEHAVIOUR { name = OrbitGenerator type = OrbitGenerator FIXED_ORBIT { ORBIT { //SMA = 1200000 SMA = @/orbitRadius ECC = 0 INC = 60 LPE = 0 LAN = 0 MNA = 0 EPH = 0 REF = 1 } } } The SMA should be derived from @/orbitRadius, but it's always 0. What's wrong? If I have the first line uncommented, the orbit is fine (without using the @/orbitRadius) Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted March 4, 2021 Share Posted March 4, 2021 (edited) 57 minutes ago, linuxgurugamer said: What's wrong? I had a similar issue with waypoint generator. I could not set the Altitude of a way-point with a value that was derived from a calculation. It may have to be a value that the mod classifies as deterministic=true. Very frustrating. Edited March 4, 2021 by Caerfinon Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted March 4, 2021 Share Posted March 4, 2021 1 hour ago, Caerfinon said: I had a similar issue with waypoint generator. I could not set the Altitude of a way-point with a value that was derived from a calculation. It may have to be a value that the mod classifies as deterministic=true. Very frustrating. That just doesn't make sense. Make it useless for determining orbits for various planet packs. Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted March 4, 2021 Share Posted March 4, 2021 1 minute ago, linuxgurugamer said: That just doesn't make sense I know. I tried coming at it in every way I could think of, and every time I used some kind of formula it set the value of the altitude to zero. Even when the value of the calculated variable was the number I wanted it to be. I eventually just settled on a fixed value. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted March 4, 2021 Share Posted March 4, 2021 Oh, I just got it working. It was the 2nd data item referencing the first. I combined them into one and it started working Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted March 4, 2021 Share Posted March 4, 2021 15 minutes ago, linuxgurugamer said: Oh, I just got it working Well done! I might have to dig up my attempts and see if I was doing the same thing. Quote Link to comment Share on other sites More sharing options...
Tolkien411 Posted March 12, 2021 Share Posted March 12, 2021 (edited) Hi Guys! I'm new here and in KSP and i want to make a question.. I really want this mod for have different contracts and help my Kerbals to have more experience too with new contracts, but when i install the mod, i have a weird bug that i will show you here: https://imgur.com/a/9bvcoDQ I've try to change the language but nothing have change... I've just another mod that is "DockRotate" Someon can help me? Thanks! Edited March 12, 2021 by Tolkien411 Quote Link to comment Share on other sites More sharing options...
Morphisor Posted March 12, 2021 Share Posted March 12, 2021 1 hour ago, Tolkien411 said: Hi Guys! I'm new here and in KSP and i want to make a question.. I really want this mod for have different contracts and help my Kerbals to have more experience too with new contracts, but when i install the mod, i have a weird bug that i will show you here: https://imgur.com/a/9bvcoDQ I've try to change the language but nothing have change... I've just another mod that is "DockRotate" Someon can help me? Thanks! Contract Configurator by itself does nothing. It's a framework for adding other contract packs. Given your screenshot you most likely installed it incorrectly. Make sure to drop the CC map under gamedata entirely. Quote Link to comment Share on other sites More sharing options...
Teykn Posted April 3, 2021 Share Posted April 3, 2021 Heyo, I have a few questions. Hope you guys can answer. 1. Is it possible to use a BEHAVIOUR to subtract funds? 2. Is it possible to use a REQUIREMENT for detecting if a vessel exists, so that if it isn't detected, the contract fails? Could it also work with BEHAVIOURs as well? Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted April 3, 2021 Share Posted April 3, 2021 1 hour ago, Teykn said: BEHAVIOUR to subtract funds? There is a behaviour to award experience but not change funds rewards. You could set up a parameter that if it failed would subtract failureFunds // The various parameter-level rewards and penalties. // // Type: float // Required: No // rewardScience = 100.0 rewardReputation = 20.0 rewardFunds = 100000.0 failureReputation = 10.0 failureFunds = 10000.0 1 hour ago, Teykn said: REQUIREMENT for detecting if a vessel exists There is a "ValidVessel Requirement" - "If at any point the vessel is no longer valid, this will return false and fail the contract." Quote Link to comment Share on other sites More sharing options...
Teykn Posted April 4, 2021 Share Posted April 4, 2021 23 hours ago, Caerfinon said: You could set up a parameter that if it failed would subtract failureFunds // The various parameter-level rewards and penalties. // // Type: float // Required: No // rewardScience = 100.0 rewardReputation = 20.0 rewardFunds = 100000.0 failureReputation = 10.0 failureFunds = 10000.0 Regarding this, my main goal is to have something that can detect if a vessel exists that can ALSO subtract funds if it doesn't exist. So regarding this, would it be possible to make a Parameter that checks if a vessel exists? Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted April 4, 2021 Share Posted April 4, 2021 7 minutes ago, Teykn said: my main goal is to have something that can detect if a vessel exists that can ALSO subtract funds if it doesn't exist You can set a "VesselNotDestroyed Parameter" that checks to see if a vessel defined by a "vessel parameter" has been destroyed. If it has been the contract will fail. As with all parameters you can set penalties using "failureFunds" Quote Link to comment Share on other sites More sharing options...
Teykn Posted April 4, 2021 Share Posted April 4, 2021 Sorry for so many questions: If a contract is accepted, and then after a requirement is not met, does the contract fail? Can I use an inverted ValidVessel Requirement inside a contract, and have the ValidVessel target a vessel that is going to be defined in the same contract? Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted April 4, 2021 Share Posted April 4, 2021 2 hours ago, Teykn said: If a contract is accepted, and then after a requirement is not met, does the contract fail? Generally requirements must be met for a contract to be offered at all. Typically it it the success or failure of parameters that govern if the contract fails or not, and parameters can be classified as optional so that their success of failure doesn't effect the contract success of failure but can offer additional rewards. 2 hours ago, Teykn said: Can I use an inverted ValidVessel Requirement inside a contract, and have the ValidVessel target a vessel that is going to be defined in the same contract? I'm not sure. I would experiment by coding one up and seeing what happens, Quote Link to comment Share on other sites More sharing options...
Teykn Posted April 5, 2021 Share Posted April 5, 2021 (edited) Sorry for even more questions lol What might cause the HasCrew parameter to break? I have such a parameter that detects if a vessel has 3 crew members on board, yet whilst the vessel is uncrewed, it satisfies this parameter somehow Are you able to use BEHAVIOUR nodes to adjust data created by another BEHAVIOUR node in another contract? E.g. Contract 1 creates "TestValue" by a BEHAVIOUR. Contract 2 wants to edit "TestValue" with a BEHAVIOUR. Is there any way to deduct funds if a vessel is terminated from the Tracking Station? A VesselNotDestroyed PARAMETER does not work when a vessel is terminated sadly. What is the priority between PARAMETERs, BEHAVIOURs, and REQUIREMENTs with checkOnActiveContract = true? Edited April 5, 2021 by Teykn Quote Link to comment Share on other sites More sharing options...
adriangm44 Posted April 5, 2021 Share Posted April 5, 2021 Where did my rescue contracts go? They were the only interesting stock contracts worth doing... free astronauts and they even pay me for them hahaha Any way to restore them or a mod that adds rescue missions to this awesome configurator? Quote Link to comment Share on other sites More sharing options...
Caerfinon Posted April 5, 2021 Share Posted April 5, 2021 15 hours ago, Teykn said: What might cause the HasCrew parameter to break? I'd have to see the contract code. Generally I find that Vessel parameter groups can break if they are satisfied by more than one vessel at a time (this is also the cause of several contracts failing at the same time.) 15 hours ago, Teykn said: Are you able to use BEHAVIOUR nodes to adjust data created by another BEHAVIOUR node in another contract? Yes, you can use "Expression-Behaviour" to set variables in the persistent datastore in your game save file. Once set the variables can be called from any other contract. See data-store-identifiers Also, you can use Expression-Requirement to use the stored variables as requirements for a contract to start. The general order is; Requirements define when a contract will be offered. Behaviours determine things that will occur and placement of spawned items for an offered contract Parameters need to be met and completed to progress the mission, trigger some behaviours etc. The best way to learn how contract configurator works is by deconstructing contracts written by others that do something similar to what you want to do. I learned a great deal from Contract Pack: Field Research by nightengale and Career Evolution by pap1723 . 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.