Logo Platform
logo amplifiers simplified

Error while modding new improvement, need help [Solved]

Reply
Copied to clipboard!
7 years ago
Jul 8, 2017, 2:37:48 PM

The problem is addressed, I used the wrong property name (shoud be "SystemResearch" instead of "SystemScience") and thus messed it up totally.


So here is the story:


I was trying to create a system improvement that converts systemscience into industry. Available after all the 4 endless techs are unlocked (i.e. when science becomes useless).


I created related stuffs and linked GUI icons and localization title/description/effects. I tested and found the improvement in the list after I unlock the endless techs and the icon/localization is fine. 

However, after it finished in the construction queue, it remains on the top of the queue, turned red, and showed a "!" mark tooltipping that "this construction is no longer valid"


Below is the part I did. I think I might be getting the InterpreterPrerequisite wrong.


<StarSystemImprovementDefinition Name="StarSystemImprovementScienceToIndustry" SubCategory="SubCategoryScience" ScoreProvider="StarSystemImprovementBuilt">
  <SupervisorGain Name="Industry"  />
  <Cost ResourceName="SystemProduction">8960</Cost>
  <PathPrerequisite                           Flags="Prerequisite,Discard">ColonizedStarSystemStateColony</PathPrerequisite>
  <PathPrerequisite       Inverted="true"     Flags="Prerequisite,Discard">ClassColonizedStarSystem/StarSystemImprovementScienceToIndustry,!FastForwardedImprovement</PathPrerequisite>
  <InterpreterPrerequisite Flags="Prerequisite,Discard">Property(Context,@../ClassEmpire, VictoryTechnologyResearchedCount) ge 4</InterpreterPrerequisite>
  <SimulationDescriptorReference Name="StarSystemImprovementScienceToIndustry" />
  <SimulationDescriptorReference Name="StarSystemImprovementUpkeepStage5Normal"/>
  <PopulationEvent Name="PopulationPoliticalEventBuildingConstructionScience1"/>
</StarSystemImprovementDefinition>


<SimulationDescriptor Name="StarSystemImprovementScienceToIndustry" Type="StarSystemImprovement">
<Modifier TargetProperty="SystemProductionFromScience"       Operation="Addition"        Value="$(SystemScience)"         TooltipHidden="true"            SearchValueFromPath="true"          Path="./ClassColonizedStarSystem" />
<Modifier TargetProperty="SystemScienceUseable"        Operation="Subtraction" Value="1"           TooltipHidden="true"            Path="./ClassColonizedStarSystem" />
</SimulationDescriptor>


in ClassColonizedStarSystem:

<Property Name="SystemScienceUseable" BaseValue="1"  MaxValue="1"/>
<Modifier TargetProperty="NetSystemResearch"          Operation="Multiplication"  Value="$(SystemScienceUseable)"/>
<Modifier TargetProperty="NetSystemProduction"      Operation="Addition"    Value="$(SystemProductionFromScience)"                TooltipHidden="false"    Path="!StarSystemImprovementInfinite" />


Thank you for reading through my stupid code and trying help :P



Below is something ( that might be) related in output log.

IndexOutOfRangeException: Array index is out of range.
at Amplitude.Unity.Simulation.SimulationObject.<checkDependancies>m__5 (Amplitude.StaticString dependancy, Amplitude.Unity.Simulation.SimulationObject context, Amplitude.Unity.Simulation.SimulationModifierProvider provider) [0x00000] in <filename unknown>:0
at Amplitude.Unity.Simulation.SimulationModifierDescriptors.SingleSimulationModifierDescriptor.ForEachPropertyOperand (Amplitude.Unity.Simulation.ForEachPropertyOperandFunction callback, Amplitude.Unity.Simulation.SimulationObject context, Amplitude.Unity.Simulation.SimulationModifierProvider provider) [0x00000] in <filename unknown>:0
at Amplitude.Unity.Simulation.SimulationObject.Unsafe_ApplyModifierProvider (Amplitude.Unity.Simulation.SimulationModifierProvider provider, Int32 pathIndex, Boolean removing) [0x00000] in <filename unknown>:0
at Amplitude.Unity.Simulation.SimulationPathContext.PathNavigator_Found (Amplitude.Unity.Simulation.SimulationObject current, Int32 pathIndex) [0x00000] in <filename unknown>:0
at Amplitude.Path.PathNavigator`1[T].Found (.T current, Int32 pathIndex, Boolean breakOnFirstHit, System.Int32& count, .T& result) [0x00000] in <filename unknown>:0
at Amplitude.Path.PathNavigator`1[T].Traverse (Amplitude.Path.Path`1 path, .T current, Int32 pathIndex, Boolean breakOnFirstHit, .T& result, System.Int32& count) [0x00000] in <filename unknown>:0
at Amplitude.Path.PathNavigator`1[T].Traverse (.T current, Amplitude.Path.Path`1 path, Int32 index) [0x00000] in <filename unknown>:0
at Amplitude.Unity.Simulation.SimulationPathContext.Traverse (Amplitude.Unity.Simulation.SimulationObject current) [0x00000] in <filename unknown>:0
at Amplitude.Unity.Simulation.SimulationObject.Unsafe_AddChild (Amplitude.Unity.Simulation.SimulationObject child) [0x00000] in <filename unknown>:0
at Amplitude.Unity.Simulation.SimulationObject.AddChild (Amplitude.Unity.Simulation.SimulationObject child) [0x00000] in <filename unknown>:0
at Amplitude.Unity.Simulation.SimulationObjectWrapper.AddChild (Amplitude.Unity.Simulation.SimulationObjectWrapper simulationObjectWrapper) [0x00000] in <filename unknown>:0
at ColonizedStarSystem.InternalAddStarSystemImprovement (.StarSystemImprovement starSystemImprovement) [0x00000] in <filename unknown>:0
at ColonizedStarSystem.AddStarSystemImprovement (.StarSystemImprovement starSystemImprovement) [0x00000] in <filename unknown>:0
at DepartmentOfTheInterior.AddStarSystemImprovement (.ColonizedStarSystem colonizedStarSystem, .StarSystemImprovement starSystemImprovement, Boolean creation) [0x00000] in <filename unknown>:0
at DepartmentOfTheInterior.DepartmentOfIndustry_StarSystemImprovementConstructionchange (System.Object sender, .ConstructionChangeEventArgs e) [0x00000] in <filename unknown>:0
at DepartmentOfIndustry.OnConstructionChanged (IGameEntity context, .Construction construction, ConstructionChangeEventAction action) [0x00000] in <filename unknown>:0
at DepartmentOfIndustry+<GameClientState_Turn_End_ComputeBuildConstruction>c__IteratorF.MoveNext () [0x00000] in <filename unknown>:0
at Amplitude.Coroutine.Run () [0x00000] in <filename unknown>:0
at GameClientState_Turn_End.Run () [0x00000] in <filename unknown>:0
at Amplitude.Unity.Framework.FiniteStateMachine.Update () [0x00000] in <filename unknown>:0
at GameInterface.Update () [0x00000] in <filename unknown>:0
at Session.Update () [0x00000] in <filename unknown>:0
at Amplitude.Unity.Session.SessionManager.LateUpdate () [0x00000] in <filename unknown>:0

(Filename:  Line: -1)

Updated 7 years ago.
0Send private message
7 years ago
Jul 8, 2017, 3:32:40 PM

I did add SystemProductionFromScience as a new Property with a base value of "0" in the class, but I forgot to put it in this thread. 


Also to mention, I cannot move the improvement out of the queue after the error occurred.

0Send private message
7 years ago
Jul 8, 2017, 3:44:28 PM

Looks good, I guess this is based off of the StarSystemImprovementFoodToIndustry


One thing I noticed is you used:

<PopulationEvent Name="PopulationPoliticalEventBuildingConstructionScience1"/>

Which is not an existing populationEvent did you add it ? if not you will need to change it to an existing populationEvent or add it.


Also 

<ModifierTargetProperty="SystemProductionFromScience"     Operation="Addition"        Value="$(SystemScience)"         TooltipHidden="true"            SearchValueFromPath="true"          Path="./ClassColonizedStarSystem"/>

I do not know if "SystemProductionFromScience" is a valid TargetProperty try changing it to "SystemProduction" ? 

(I believe the use of SystemProductionFromGrowth is in the production tooltip showing where the industry comes from)



(Just saw the additional post) 


Everything else seems good at first glance, try the suggestions and fingers crossed it will work.

Updated 7 years ago.
0Send private message
7 years ago
Jul 8, 2017, 4:36:33 PM

I finally figured out the problem myself.


It is "SystemResearch" instead of "SystemScience" in StarSystem.


Now I know that np++ is probably not a good idea when there is not a compiler to give feedbacks. Not the worst I've done, though.



Thank you very much for trying to help! And yeah, I also forgot to add the event in. #feelsobad

0Send private message
0Send private message
?

Click here to login

Reply
Comment