Jump to content

[WIP] [1.2.2] Career Evolution Contract Pack - BETA Release v0.3 Updated 3-27-2017


pap1723

Recommended Posts

6 hours ago, severedsolo said:

Awesome you finished it :) look forward to trying it out

Thanks to a lot of your ideas!

I also think I have a couple more ideas for you to implement in your pack and some cleaner code in certain situations. Completely up to you though!

Link to comment
Share on other sites

7 hours ago, pap1723 said:

Thanks to a lot of your ideas!

I also think I have a couple more ideas for you to implement in your pack and some cleaner code in certain situations. Completely up to you though!

Never mind. I just read what you said properly. Absolutely, if you have ideas to clean it up I'm happy to take them. Some of it is a complicated mess, I'll happily admit that

Edited by severedsolo
Link to comment
Share on other sites

1 hour ago, AceCrafted said:

Hi I'm working on a Interstellar planet pack is this code written so it will work fine or will I need to write configs for it or can I just not edit it to work with my pack

BTW my pack does move kerbin to another star 

I actually do not know how the Interstellar packs work for this type of contract. I'll try to explain the functionality of these missions...In order to find the 4th planet, it looks at the following information: HomeWorld().Parent().Children().ElementAt(3)

What it does in layman terms is finds the Home world, then finds the parent body (could be a star or planet), then finds the other children (orbiting bodies) and gets the one at position 3 (starts at 0, so 3 is the 4th planet).

To me, it sounds like it would work for you as long as Kerbin (or a different HomeWorld) is the 3rd planet from the new star.

 

I think I am going to wind up re-writing much of the code for this pack. I want it to work with all planet packs, but I haven't figured out the best way to do that yet. @severedsolo you have used NetxUnreachedBody() functionality in your Exploration Pack, but that works only for the original Uncrewed Flyby missions in my pack. How has it worked in your experience?

I don't think I can use that function with what I am trying to do. Can you think of some clever ways of getting the planet locations in reference to the Home World? I thought of possibly using something like this: 

DATA
{
	type = int
	homeSMA = HomeWorld().SemiMajorAxis()
	title = Get Home's SMA
}

DATA
{
	type = List<CelestialBody>
	targetBodies = AllBodies().Where(b => b.SemiMajorAxis() > @/homeSMA && b != HomeWorld())
    title = Get a list of the planets with an orbit further than Home
}
      
DATA
{
	type = int
    numberBodies = @/targetBodies.Count()
    title = Get the number of the planets with a higher orbit than Home
}
      
DATA
{
    type = CelestialBody
    firstOuterPlanet = @/targetBodies.ElementAt(0)
    secondOuterPlanet = @/targetBodies.ElementAt(1)
    thirdOuterPlanet = @/targetBodies.ElementAt(2)
    fourthOuterPlanet = @/targetBodies.ElementAt(3)
    fifthOuterPlanet = @/targetBodies.ElementAt(4)
    sixthOuterPlanet = @/targetBodies.ElementAt(5)
    title = Get the planets in order
}

My concern with that is that it will return an error if the planet doesn't exist. Do you know if there is a function that can tell me the ElementAt(#) of the HomeWorld()?

Link to comment
Share on other sites

8 hours ago, pap1723 said:

I think it might, but I am having trouble determining exactly how I would set it up.

Example of the DATA_EXPAND node here: https://github.com/5thHorseman/PartsUnlimited/blob/b53a4df7e86e368db3e31730120992790aeeedee/Communication.cfg

I suspect it won't do what you are looking for. Can you explain exactly what it is you want? I may be able to think of another way

Link to comment
Share on other sites

7 hours ago, severedsolo said:

Example of the DATA_EXPAND node here: https://github.com/5thHorseman/PartsUnlimited/blob/b53a4df7e86e368db3e31730120992790aeeedee/Communication.cfg

I suspect it won't do what you are looking for. Can you explain exactly what it is you want? I may be able to think of another way

Yeah, that is what I thought it did. Basically it just creates an Iterator of all of the items that meets the criteria.

HOW IT IS CURRENTLY IMPLEMENTED:

The contracts are based primarily around proximity to the Home Planet. If we are using the stock system as our example, I want the contracts for Flybys of Eve, Duna and Minmus to fire immediately after the flybys of the Mun. Then to progress out to Moho, Dres, Jool and finally Eeloo. Now, it is very easy to accomplish in stock, as you just use the stock names or positions of the planets as you know where they are at all times. However, my goal with the pack was to provide a solution for people playing with any version of RSS, Stock, Stock with Outer Planets, or even other completely remade solar systems like Galileo's Planet Pack.

In order to accomplish that, I use code to find the various planets dynamically based on their positions in the solar system. Here are some examples of what I currently have:

DATA
	{
		type = CelestialBody
		Moho = HomeWorld().Parent().Children().ElementAt(0)
		Eve = HomeWorld().Parent().Children().ElementAt(1)
		Kerbin = HomeWorld()
		Mun = HomeWorld().Children().First()
		Minmus = HomeWorld().Children().Last()
		Duna = HomeWorld().Parent().Children().ElementAt(3)
		Ike = HomeWorld().Parent().Children().ElementAt(3).Children().First()
		Jool = AllBodies().Where(cb => cb.IsPlanet() && !cb.HasSurface()).First()		
		title = Planets
		requiredValue = false
	}

This is referenced in the main CONTRACT_GROUP file so I can call them like this: 

targetBody = @CareerEvolution:Eve

 

Now that gets me to where I am getting the 2nd Planet from the Sun. That works exactly how I want it to when Kerbin or Earth is the 3rd planet from the sun. The problem comes in when the Home world is not the 3rd planet from the sun. For example, in Galileo's Planet Pack, the Home World (Gael I believe) is the 4th planet from the sun. So using the above referenced code, everytime I have a mission to Duna (the 4th planet), it is actually a mission to the Home Planet which doesn't make any sense.

 

WHAT I AM TRYING TO FIGURE OUT:

Is there a way to dynamically get the location (as in how many planets from the Sun) that the Home World is. Then I can have the function to find a planet look like this:

DATA
{
	type = List<CelestialBody>
	insideHomeWorld = AllBodies().Where(cb => cb.IsPlanet() && cb.SemiMajorAxis() < HomeWorld().SemiMajorAxis())
	title = Get the planets inside the HomeWorld
}
                                                                                                                
DATA
{
	type = int
	numberInsidePlanets = @/insideHomeWorld
	title = Get the number of planets inside the HomeWorld
}

What I want to do then is to take the number of planets and get each location and then be able to simply call them in the future contracts. I cannot wrap my head around how to do it. Maybe the brilliant @nightingale can enlighten us if you cannot figure it out either?

 

Link to comment
Share on other sites

3 minutes ago, jdub3350 said:

Looking forward to giving this one a shot.  Since SETI-Contracts doesn't work with RSS, this could be a great alternative, maybe even better.  I'll let you know how it goes. 

Thanks @jdub3350! Enjoy!

8 hours ago, SolidJuho said:

Hmm. Maybe i should give career second try with this mod.

Great job with these contracts.

 

Thanks @SolidJuho

Link to comment
Share on other sites

I feel like NextUnreachedBody() is going to be your friend.

I've written a little plugin that will spit out the order of progression KSP is expecting you to take to your debug log, this is what it spits out for the stock system:
 

Quote

[ProgressionLog] Body 1is Mun

[ProgressionLog] Body 2is Minmus

[ProgressionLog] Body 3is Sun

[ProgressionLog] Body 4is Duna

[ProgressionLog] Body 5is Ike

[ProgressionLog] Body 6is Eve

[ProgressionLog] Body 7is Gilly

[ProgressionLog] Body 8is Jool

[ProgressionLog] Body 9is Bop

[ProgressionLog] Body 10is Pol

[ProgressionLog] Body 11is Tylo

[ProgressionLog] Body 12is Laythe

[ProgressionLog] Body 13is Vall

[ProgressionLog] Body 14is Dres

[ProgressionLog] Body 15is Moho

[ProgressionLog] Body 16is Eeloo

That seems like a pretty good order to me. Planet packs SHOULD have their own progression (worst case, you can throw the plugin into say a Galileo Planet Pack save, and see what order it gives(

Link to comment
Share on other sites

2 minutes ago, severedsolo said:

I feel like NextUnreachedBody() is going to be your friend.

I've written a little plugin that will spit out the order of progression KSP is expecting you to take to your debug log, this is what it spits out for the stock system:
 

That seems like a pretty good order to me. Planet packs SHOULD have their own progression (worst case, you can throw the plugin into say a Galileo Planet Pack save, and see what order it gives(

I think I might be able to use this....Can you send me the plugin?

Link to comment
Share on other sites

1 minute ago, SolidJuho said:

All right, I just got installed and going to test your mod and report about it later. One question: Is there going to be asteroid contracts? I could not find them from your list.

There is currently a mission to land unmanned on an asteroid and to land manned on an asteroid. 

I think I will add a unmanned mission to return to home world as well. 

Link to comment
Share on other sites

So far i would like to increase Karman Line payout slightly, like 12k istead of 10k

And also Polar Satellite payout is just 6k, so i think it should be mor like 10-12k.

Also on First satellite and polar satellite contract reads this:  Launch satellite into polar/orbit of HomeWorld().Print()

Also flyby the mun/minimus in objective reads: flyby [ the mun ]/[ minimus ]: incomplete/complete (i am meaning those [ ])

Link to comment
Share on other sites

45 minutes ago, SolidJuho said:

So far i would like to increase Karman Line payout slightly, like 12k istead of 10k

And also Polar Satellite payout is just 6k, so i think it should be mor like 10-12k.

Also on First satellite and polar satellite contract reads this:  Launch satellite into polar/orbit of HomeWorld().Print()

Also flyby the mun/minimus in objective reads: flyby [ the mun ]/[ minimus ]: incomplete/complete (i am meaning those [ ])

Fixed!

Thanks for the feedback, keep it coming!

Link to comment
Share on other sites

Sound barrier payout should be reduced to 8-10k. There could be also Mach 2 and 3 or even 4 missions for testing even faster kerbin travelling.

Looks like payouts are slightly smaller than in stock contracts. I would increase them also.

Also more manned missions could be at starting for aircrafts or example land at exact biome in kerbin to investigate it. Of course there are already contract packs for it.

Btw, I have found more these HomeWorld().Print(), so are them purposely left there?

Link to comment
Share on other sites

16 minutes ago, SolidJuho said:

Sound barrier payout should be reduced to 8-10k. There could be also Mach 2 and 3 or even 4 missions for testing even faster kerbin travelling.

Looks like payouts are slightly smaller than in stock contracts. I would increase them also.

Also more manned missions could be at starting for aircrafts or example land at exact biome in kerbin to investigate it. Of course there are already contract packs for it.

Btw, I have found more these HomeWorld().Print(), so are them purposely left there?

That is a good point about the manned missions for aircraft. RP-0 from the RSS/RO guys have some good ideas on how that works.

No, the HomeWorld().Print() was something that I thought would work, but I implemented them wrong. There is a better way to do it and I will fix.

 

I will also adjust the payouts. The way they work, is they payout more money based on the size of the planet pack you are playing with. So it scales nicely with packs with a larger Homeworld (like RSS or Scaled Stock) but I need to re-work the stock scale it starts at. The payouts start to get larger as the complexity of the missions goes up, but I have also noticed that they are lower than they should be.

Thanks again for the feedback!

Link to comment
Share on other sites

@pap1723 Finally got to play with this a little bit last night and I really like the way you have it set up.   I think if there's any tweaking to be done, it would be on the science payouts (personal opinion).  I'm using the contract pack in RSS, with the Unmanned Before Manned tech tree, and I think a bit more science on some of the early milestones would make the beginning tech nodes less grindy.  Otherwise great job on this,  I will definitely keep playing with it.   

Link to comment
Share on other sites

5 minutes ago, SpaceBadger007 said:

Just to be sure to install this you put the IPContracts file into the contractpacks in the game data?  

Yes, as long as you have contract configurator and module manager installed. 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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...