edit: solved! I loaded the skill in my Instantiator constructor rather than OnStartupApp which is what NRaas does, and it works! Though it does leave me with the question of why aren't skills usually loaded there (ie the skill tutorial, Arsil's skill which still works for some reason) and possible the store skills which I think is what the skill tut is based on?
I posted this on NRaas too, but the more eyes the better! Especially as I don't think it's strictly an NRaas Career issue.
@olomaya asked about adding a custom skill to a (custom) rabbithole career, as one of the metrics needed to get a promotion.
It's definitely possible as it works for Arsil's programming skill ([url]https://modthesims.info/d/560493/programming-skill.html[/url)], but not other skills eg my knitting skill. I thought using an AddEnumValue function (that Arsil uses) would do the trick but it still doesn't work.
The problem is that when a sim joins the career, there's a script error, and the sim has a blank work performance tab as no metrics show up. It also messes up the skill panel for the sim with no skills showing up, which is fixed when the sim no longer has a messed up career level. There's no error loading the career, and the rest of the career info seems to be fine, it's only when the sim joins the career the error is there and the metric panel is messed up.
The script error says
System.NullReferenceException: A null value was found where an object instance was required.
#0: 0x00007 callvirt in Sims3.Gameplay.Careers.Sims3.Gameplay.Careers.MetricSkillX:MetricTitle (Sims3.Gameplay.Careers.Career) (3BC0A620 [4ABA7490] )
And the code for MetricTitle is:
string name = SkillManager.GetStaticSkill(SkillGuid).Name;
return Localization.LocalizeString("Gameplay/Careers/Metrics:TitleSkillX", name);
When I repeat that code in OnWorldLoadFinished, it does return "Knitting", and when I do the same for the MetricDescription, I also get the right string which is like "Improve in the knitting skill to get promoted" or something :p
So I'm not sure why it gets upset with that bit of code, if that really is where the error is coming from. Again, it works perfectly for Arsil's skill, but I can't see any code related to the skill that would seem to be what I'm missing. There is some commodity stuff, but to me that looks more like to do with tying the skill to the custom interactions, and Arsil says in the description it's how the skill gain is shown during them.
Another point is that if the EA metric value is used (MetricSkillX) this is what happens. But if the NRaas one is used (NRaas.Gameplay.OmniSpace.Metrics.MetricSkillX, NRaasCareer) then there is no script error, and just the angry face of the metric shows up, no title or description. I looked at the code for the NRaas skill metric, and it basically checks the validity of the skill and will return null otherwise, which is probably why it shows up blank rather than throwing an error, but in either case it still fails, even though when I do that bit of code, I get the right thing returning :p
I think the issue is that the skill isn't being loaded before the career, as when I edit the GameplaySystems dll, it's actually the MetricSkillX's SkillGuid that's null. So the code doesn't seem to like this:
Though it's fine when I do it in my code after loading the skill.
So I'm not sure if Arsil's programming skill is a coincidence or something else is making sure the skill can be parsed by the career?
I'm loading my skill OnStartupApp, which is the same as Arsil so I'm not sure what else to do :p
Putting NRaas Careers in overrides also doesn't seem to work.