Creating an NRaas project Interesting finding about Future Skill

Talk nerdy to us here.
Post Reply
User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Interesting finding about Future Skill

Post by JunJayMdM » February 22nd, 2014, 12:12 pm

I thought I'd share this here, cos it could be useful info if working with the Future Skill (or Advanced Technology).

So, I was happily working at my Study Skills Online mod, when I found out that the aforementioned skill could not be clicked in the pie menu picker (i.e. the dialog wouldn't disappear).

After a few tests, I discovered that in order to be clicked, the skill element can't be null, or the SkillStage will throw an error when calling a specific method.

Why is that? Of course EA, who else, when overriding ComputeSkillGainMod() in the FutureSkill class, added a call to a method that assumes the element is not null, therefore making the SkillStage tilt and halting the ProcessCallback when clicking the skill in the picker.

I added a workaround in my mod, which is manually adding the element before the SkillStage is initialized.

This is probably something that can't be fixed without going Core, so if any of the NRaas mods has something about skilling where the SkillStage or ComputeSkillGainMod() are used, it might need to be reviewed. The same of course applies if there are plans to implement something similar.

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » February 22nd, 2014, 12:46 pm

P.S. To be precise, the error is that they call a method that requires the SkillOwner, but since the element is null, there's no SkillOwner and that one is the null value causing trouble.

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » February 23rd, 2014, 6:51 am

Ok, let me just add something to laugh at :

BotBuildingSkill :

<!-- ws:start:WikiTextCodeRule:0:
<pre class="text">public override float ComputeSkillGainMod()<br/>{<br/> float num = base.ComputeSkillGainMod();<br/> if (base.SkillOwner != null)<br/> {<br/> num += base.GetVGnomeSkillModifier(base.SkillOwner.CreatedSim);<br/> }<br/> return num;<br/>}</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

-->
</style><pre class="text">public override float ComputeSkillGainMod()
{
float num = base.ComputeSkillGainMod();
if (base.SkillOwner != null)
{
num += base.GetVGnomeSkillModifier(base.SkillOwner.CreatedSim);
}
return num;
}</pre>


FutureSkill :

<!-- ws:start:WikiTextCodeRule:1:
<pre class="text">public override float ComputeSkillGainMod()<br/>{<br/> float num = base.ComputeSkillGainMod();<br/> return num + base.GetVGnomeSkillModifier(base.SkillOwner.CreatedSim);<br/>}</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

-->
</style><pre class="text">public override float ComputeSkillGainMod()
{
float num = base.ComputeSkillGainMod();
return num + base.GetVGnomeSkillModifier(base.SkillOwner.CreatedSim);
}</pre>


Gotta love EA coherency and how they manage to make mods fault because one of their programmers doesn't like checking if a value is null before using it

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7568
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » February 24th, 2014, 10:57 pm

Have you checked out the awesome spelling as well?

<!-- ws:start:WikiTextCodeRule:0:
<pre class="text">public void CleanupdAvailableLotLists()<br/>{<br/>}</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

-->
</style><pre class="text">public void CleanupdAvailableLotLists()
{
}</pre>


<!-- ws:start:WikiTextCodeRule:1:
<pre class="text">public enum AdvantureEvents<br/>{<br/>}<br/><br/>[TunableComment(&quot;TextAdvanture: Percent chance if Sim find Genie Lamp. If the items do not add up to 100, the remaining chance will be fore a rubber duck.&quot;), Tunable]<br/> private static float kAdvantureGenieLampChance = 1f;<br/><br/> [Tunable, TunableComment(&quot;TextAdvanture: Percent chance for random book. If the items do not add up to 100, the remaining chance will be fore a rubber duck.&quot;)]<br/> private static float kAdvantureItemChanceBook = 20f;<br/><br/> [Tunable, TunableComment(&quot;TextAdvanture: Percent chance for a random rock, gem or metal. If the items do not add up to 100, the remaining chance will be fore a rubber duck.&quot;)]<br/> private static float kAdvantureItemChanceRGM = 25f;<br/><br/> [TunableComment(&quot;TextAdvanture: Percent chance for a random seed. If the items do not add up to 100, the remaining chance will be fore a rubber duck.&quot;), Tunable]<br/> private static float kAdvantureItemChanceSeed = 25f;<br/><br/> [Tunable, TunableComment(&quot;TextAdvanture: Maximum amount of time between events.&quot;)]<br/> private static float kAdvantureMaxBetweenEvents = 60f;<br/><br/> [TunableComment(&quot;TextAdvanture: Minimum amount of time between events.&quot;), Tunable]<br/> private static float kAdvantureMinBetweenEvents = 30f;</pre>
-->
<style type="text/css"><!--
/**
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
* (http://qbnz.com/highlighter/ and http://geshi.org/)
*/
.text {font-family:monospace;}
.text .imp {font-weight: bold; color: red;}
.text span.xtra { display:block; }

-->
</style><pre class="text">public enum AdvantureEvents
{
}
&nbsp;
[TunableComment("TextAdvanture: Percent chance if Sim find Genie Lamp. If the items do not add up to 100, the remaining chance will be fore a rubber duck."), Tunable]
private static float kAdvantureGenieLampChance = 1f;
&nbsp;
[Tunable, TunableComment("TextAdvanture: Percent chance for random book. If the items do not add up to 100, the remaining chance will be fore a rubber duck.")]
private static float kAdvantureItemChanceBook = 20f;
&nbsp;
[Tunable, TunableComment("TextAdvanture: Percent chance for a random rock, gem or metal. If the items do not add up to 100, the remaining chance will be fore a rubber duck.")]
private static float kAdvantureItemChanceRGM = 25f;
&nbsp;
[TunableComment("TextAdvanture: Percent chance for a random seed. If the items do not add up to 100, the remaining chance will be fore a rubber duck."), Tunable]
private static float kAdvantureItemChanceSeed = 25f;
&nbsp;
[Tunable, TunableComment("TextAdvanture: Maximum amount of time between events.")]
private static float kAdvantureMaxBetweenEvents = 60f;
&nbsp;
[TunableComment("TextAdvanture: Minimum amount of time between events."), Tunable]
private static float kAdvantureMinBetweenEvents = 30f;</pre>


I could go on and on. Hey EA:

Image

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » February 25th, 2014, 1:01 am

lol, at least those are harmless, unless you want to count broken ribs from laughing XD

Post Reply