0
Answered

AnyIdea what this is about?

Andi Rutz 4 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 1

I'm trying to make a prefab of an enemy that takes damage. For some reason, the copies of the prefab don lose points in a stat, just the first copy. after it reaches 0 I get this error when attacking the copy but this one doesn't loose points in a stat. 

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
GameCreator.Stats.Stats.GetStat (System.String stat, GameCreator.Stats.Stats target) (at Assets/Plugins/GameCreator/Stats/Mono/Components/Stats.cs:244)
GameCreator.Stats.Formula.OnMatch_StatName (GameCreator.Stats.Formula+FormulaData data, System.String clause) (at Assets/Plugins/GameCreator/Stats/Mono/Classes/Formula.cs:97)
GameCreator.Stats.Formula.ParseFormula (System.Text.StringBuilder sbFormula, GameCreator.Stats.Formula+FormulaData data) (at Assets/Plugins/GameCreator/Stats/Mono/Classes/Formula.cs:274)
GameCreator.Stats.Formula.Calculate (System.Single value, GameCreator.Stats.Stats origin, GameCreator.Stats.Stats target) (at Assets/Plugins/GameCreator/Stats/Mono/Classes/Formula.cs:258)
GameCreator.Stats.Stats.GetStat (System.String stat, GameCreator.Stats.Stats target) (at Assets/Plugins/GameCreator/Stats/Mono/Components/Stats.cs:251)
GameCreator.Stats.Stats.GetStat (System.String stat) (at Assets/Plugins/GameCreator/Stats/Mono/Components/Stats.cs:285)
GameCreator.Stats.StatsEditor.PaintStatHeader (GameCreator.Stats.StatAsset statAsset, System.Int32 index) (at Assets/Plugins/GameCreator/Stats/Editor/Components/StatsEditor.cs:336)
GameCreator.Stats.StatsEditor.OnInspectorGUI () (at Assets/Plugins/GameCreator/Stats/Editor/Components/StatsEditor.cs:162)
UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>cAnonStorey1.<>m0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:501)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Unity version:
Game Creator version:

Answer

Answer
Answered

Looks like you created a Stat, used it in a Formula, but then deleted that Stat. For example, you might have initially set a Stat named "strength" but then removed it, although in a Formula you're using the stat:strength symbol. 

Review your Formulas and make sure there's no typos in the Stats nor Attributes. Bear in mind these are case sensitive.

Answer
Answered

Looks like you created a Stat, used it in a Formula, but then deleted that Stat. For example, you might have initially set a Stat named "strength" but then removed it, although in a Formula you're using the stat:strength symbol. 

Review your Formulas and make sure there's no typos in the Stats nor Attributes. Bear in mind these are case sensitive.