Jump to content

New part upgrade module


akron

Recommended Posts

I did not know a better place to put this up for discussion except here, where some of you may be using this on upcoming mods. Is anyone else having problems with the PartStatsUpgradeModule introduced in 1.2?

Specifically, the upgrade nodes are stacking with one another rather than replacing old stats. Supposedly, "IsAdditiveUpgrade__ = false" disables that effect, but it is not working for me at all. Anyone else having this issue? The syntax was posted by @JPLRepo here.

Here is what he said:

Quote

Note the "IsAdditiveUpgrade__" field. This field tells the PartModule Load to add the UPGRADE nodes additive. If it is false the nodes will overwrite each other this is only applicable to the PartStatsUpgradeModule.

But this is not working. The upgrade loads but stack on one another instead. Anyone else having this issue?

This is the code from one of my parts:

MODULE
    {
		name = PartStatsUpgradeModule
        showUpgradesInModuleInfo = true
		UPGRADES
        {
            UPGRADE 
            {
                name__ = ca-upgrade-weight1
                techRequired__ = specializedConstruction
				IsAdditiveUpgrade__ = false
				description = 7% Weight Reduction
                PartStats
                {
					mass = 0.14
					cost = 700
				}
            }
			UPGRADE 
            {
                name__ = ca-upgrade-weight2
                techRequired__ = metaMaterials
				IsAdditiveUpgrade__ = false
				description = Additional 15% Weight Reduction
                PartStats
                {
					mass = 0.12
					cost = 850
				}
            }
        }
	}

 

Edited by akron
Link to comment
Share on other sites

Ok, what's happening here is you are confusing "IsAdditiveUpgrade__"  with what is applied to a field.
"IsAdditiveUpgrade__" does not mean overwrite the previous value of a field.
If set to true, It means Add this UPGRADE node to Previous UPGRADE nodes.
If set to false, It means Delete previous UPGRADE nodes and apply this UPGRADE node.
This is relevant if say you want to change different fields in different upgrades (Tech nodes).
So I could say change the maxTemp at a level 1 tech node. At a level 2 tech node I might want to also change maximum_drag, but STILL apply the level 1 MaxTemp change in which case I set IsAdditiveUpgrade__ = true.
If on the other hand I didn't want the level 1 maxTemp change when the level 2 upgrade is unlocked/purchased then I would set IsAdditiveUpgrade__ = false in the level 2 UPGRADE node.
Hope that clarifies how this field works?

As for the cost and mass fields. They are additive to the BASE (original) part cost and mass field.
So let's say my base part cost is 1000 and mass is 1.

If I want my cost to be 2000 and mass 0.9 at the first tech node UPGRADE I would specify mass = -0.1 and cost = 1000 in a PartStatsUpgradeModule Upgrade node for that tech level.
If say I want it to be 2500 and mass 0.8 at a second tech node UPGRADE I would specify it differently depending on whether I want this second upgrade to be additive to the first or not.
But in both cases whatever I specify IS added to the BASE fields for the part.

@PART[enginex]
{		
	MODULE
    {
        name = PartStatsUpgradeModule
        showUpgradesInModuleInfo = true
		UPGRADES
        {
            UPGRADE 
            {
                name__ = Enginex-GenRocketry-Thrust
                techRequired__ = generalRocketry	
				IsAdditiveUpgrade__ = false				
                PartStats
                {
					maxTemp = 2500
					cost = 1000
					mass = -0.1
				}
            }	
			UPGRADE 
            {
                name__ = Enginex-engineering101-Thrust
                techRequired__ = engineering101	
				IsAdditiveUpgrade__ = false
                PartStats
                {					
					cost = 1500
					mass = -0.2
				}
            }				
        }
    }	
}

PARTUPGRADE
{
	name = Enginex-GenRocketry-Thrust
	partIcon = liquidEngine2
	techRequired = generalRocketry
	entryCost = 10000	
	cost = 2000 // for display only; all parts implementing this will need a PartStatsUpgradeModule with cost = this.
	title = Enginex Thrust Upgrade
	basicInfo = The Enginex upgrade certifies that the engine will consistently deliver Turbopump enhancements and other detail improvements lead to lower temperatures. advances in alloys have lowered it's weight.
    manufacturer = Kerbodyne
	description = The Enginex engine now has a max temp of 2500 and weight of 0.9t.
}
PARTUPGRADE
{
	name = Enginex-engineering101-Thrust
	partIcon = liquidEngine2
	techRequired = engineering101
	entryCost = 10000	
	cost = 1800 // for display only; all parts implementing this will need a PartStatsUpgradeModule with cost = this.
	title = Enginex Thrust Upgrade
	basicInfo = Further advances in weight reduction have reduced weight to 0.7t but it has lost it's temperature improvements.
    manufacturer = Kerbodyne
	description = The Enginex engine weighs 0.7t.
}

So if in my second UPGRADE I specified IsAdditiveUpgrade__ = false then I would specify mass = -0.2 and cost = 1500 in that node.
If in my second UPGRADE I have specified IsAdditiveUpgrade__ = true (for reasons specified above) then it would depend on whether the first UPGRADE node also has mass and cost values specified. If it does not include mass and cost then I specify mass = -0.2 and cost = 1500 (and these are applied to the base fields).
If my first upgrade does have mass = -0.1 and cost = 1000 then I need to specify the massAdd and costAdd fields instead. So it would be massAdd = -0.1 and costAdd = 500.

@PART[enginex]
{		
	MODULE
    {
        name = PartStatsUpgradeModule
        showUpgradesInModuleInfo = true
		UPGRADES
        {
            UPGRADE 
            {
                name__ = Enginex-GenRocketry-Thrust
                techRequired__ = generalRocketry	
				IsAdditiveUpgrade__ = true				
                PartStats
                {					
					cost = 1000
					mass = -0.1
				}
            }	
			UPGRADE 
            {
                name__ = Enginex-engineering101-Thrust
                techRequired__ = engineering101	
				IsAdditiveUpgrade__ = true
                PartStats
                {					
					costAdd = 500
					massAdd = -0.1
				}
            }				
        }
    }	
}

PARTUPGRADE
{
	name = Enginex-GenRocketry-Thrust
	partIcon = liquidEngine2
	techRequired = generalRocketry
	entryCost = 10000	
	cost = 2000 // for display only; all parts implementing this will need a PartStatsUpgradeModule with cost = this.
	title = Enginex Thrust Upgrade
	basicInfo = Advances in alloys have lowered it's weight.
    manufacturer = Kerbodyne
	description = The Enginex engine now has a weight of 0.9t.
}
PARTUPGRADE
{
	name = Enginex-engineering101-Thrust
	partIcon = liquidEngine2
	techRequired = engineering101
	entryCost = 10000	
	cost = 1800 // for display only; all parts implementing this will need a PartStatsUpgradeModule with cost = this.
	title = Enginex Thrust Upgrade
	basicInfo = Further advances in weight reduction have reduced weight to 0.7t but it has lost it's temperature improvements.
    manufacturer = Kerbodyne
	description = The Enginex engine weighs 0.8t.
}


Now that is to get the correct amount deducted for your part.
This is not what is displayed in RnD and in the editor. For that you need to specify a PARTUPGRADE node.
What you specify in the PARTUPGRADE cost field is what is shown to the user. So for each PartStatusUpgradeModule you need to specify a matching PARTUPGRADE.
 

Hope that helps to explain it. If not shoot me a reply here.



 

Edited by JPLRepo
Link to comment
Share on other sites

17 hours ago, JPLRepo said:

*snip* awesome info

Thank you very much for clarifying and testing. I am glad it was a syntax issue on my end. One last clarification: How does the game determine what upgrade to increment on? I have split upgrades for parts, where one upgrade may reduce mass, while improves a module where cost may need to increase. How does the game determine which upgrade is the first or second if they both are in the same tech level? Especially since the player might not always unlock them in the same order. As a matter, some career paths may allow the player to unlock the second upgrade before the first. 

Thanks!

Link to comment
Share on other sites

What upgrade to increment on? - Not sure what you mean. Do you mean how it decides what costs to increment? If the upgrades are not exclusive then whatever upgrades you have unlocked are applied one by one to the part base cost field. If you have multiple upgrade nodes that unlock in different parts of the tech tree on the same part then you can just use the IsAdditiveUpgrade__ = true and costAdd field. It will still work the same even if the first node unlocked has a costAdd field.
I'm not sure if that answers your question?
 

Some other things that got left out of my original post are:
UPGRADE nodes on PartModules can also include:
IsExclusiveUpgrade__ = true - this works opposite to IsAdditiveUpgrade__ = true and will wipe out any other unlocked upgrades for that PartModule/Part.
description__ =  <text> - description text that will appear in the Show Part Upgrades window and tech tree. 
ExclusiveWith__ = <text> - can be used to group exclusive upgrades on a PartModule. So I could have say 3 UPGRADE nodes on an engine module to progressively upgrade it's thrust that can be made exclusive of each other using this field. Independant of say another group of UPGRADE nodes on the same engine module to progressively upgrade the atmosphereCurve of the engine.
For examples take a look at the part configs and upgrade configs in the Revamped Parts pack.

 

Link to comment
Share on other sites

Is it possible to add complete Modules as an Upgrade?  I am trying this right now but can't get it to work as shown below.

i.e.:

UPGRADE
{
    name = xx_upgrade1
    TechRequired = ....
    IsAdditiveUpgrade__ = true
    MODULE
         {...}
    MODULE
         {...}
}
UPGRADE
{
    name = xx_upgrade2
    TechRequired = ....
    IsAdditiveUpgrade__ = true
    MODULE
       {...}
}

Link to comment
Share on other sites

On 10/31/2016 at 7:33 PM, JPLRepo said:

No you can't. The UPGRADE node is applied to a MODULE node. You can't then nest a MODULE node inside another MODULE node.

Hi so if I wanted to add gimbal to SRB rockets, I would need to make a MM patch that added ModuleGimbal with gimbalRange = 0 and then edit that with a Part Upgrade like the code below except this isn't working and I can't see why, how does Partupgrade know which bit of which module it is updating?

@PART[*]:HAS[@RESOURCE[SolidFuel]]
{
	showUpgradesInModuleInfo = true
	MODULE
	{
		name = ModuleGimbal
		gimbalTransformName = thrustTransform
		gimbalRange = 0

		UPGRADES
		{
			UPGRADE
			{
				name__ = Givemgimbal
				description__ = SRBs now have thrust vectoring.
				IsAdditiveUpgrade__ = True
				PartStats
				{
				gimbalRangeAdd = 2
				}
			}
		}
	}
 }

//and then in a seperate Upgrades.cfg

PARTUPGRADE
{
	name = Givemgimble
	partIcon = liquidEngineT15
	techRequired = advRocketry
	entryCost = 5000
	cost = 0 // for display only; all parts implementing this will need a PartStatsUpgradeModule with cost = this.
	
	title = Gimbal for SRBs
	//basicInfo = Whatever\nblah
	manufacturer = JonzCo
	description = Gimballed SRBs in preperation for your Shuttle launch system.
}

 

 

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