Turn Off Skill Degradation

Started by Petrenko, January 23, 2015, 10:26:12 AM

Previous topic - Next topic

Petrenko

Heyho,

i got a simple question:

How do i turn off skill degradation?

Thanks in advance for any help!

want_some

umm, never thought about this. i can take a look at the code to see what i can find and for a possible fix, maybe.


Learning to mod while also updating TTM Mod!
Full credit goes to Minami26

Petrenko

Thanks for the help!

So far i looked into the core.mod files but couldn't find anything.

Still i hope there is an "easy" solution for my problem.

want_some

this is something to do with the dll file for the game. i have looked a bit but havent found anythin that deals directy for the skill degradation. i will keep looking tho.


Learning to mod while also updating TTM Mod!
Full credit goes to Minami26

Petrenko


AAR_Dev

This MIGHT be it, only had a few minutes to look for it.


using System;
using System.Collections.Generic;
using Verse;
namespace RimWorld
{
public class Pawn_SkillTracker : Saveable
{
private Pawn pawn;
public List<SkillRecord> skills = new List<SkillRecord>();
public Pawn_SkillTracker(Pawn newPawn)
{
this.pawn = newPawn;
foreach (SkillDef current in DefDatabase<SkillDef>.AllDefs)
{
this.skills.Add(new SkillRecord(this.pawn, current));
}
}
public void ExposeData()
{
Scribe_Collections.LookList<SkillRecord>(ref this.skills, "skills", LookMode.Deep, this.pawn);
}
public SkillRecord GetSkill(SkillDef skillDef)
{
for (int i = 0; i < this.skills.Count; i++)
{
if (this.skills[i].def == skillDef)
{
return this.skills[i];
}
}
Log.Error("Did not find skill of def " + skillDef);
return null;
}
public void SkillsTick()
{
if ((Find.TickManager.TicksGame + this.pawn.thingIDNumber) % 200 == 0)
{
for (int i = 0; i < this.skills.Count; i++)
{
this.skills[i].Interval();
}
}
}
public void Learn(SkillDef sDef, float xp)
{
this.GetSkill(sDef).Learn(xp);
}
public float AverageOfRelevantSkillsFor(WorkTypeDef workDef)
{
if (workDef.relevantSkills.Count == 0)
{
return 3f;
}
float num = 0f;
foreach (SkillDef current in workDef.relevantSkills)
{
num += (float)this.GetSkill(current).level;
}
num /= (float)workDef.relevantSkills.Count;
return num;
}
}
}


this.skills.Interval();

// RimWorld.SkillRecord
public void Interval()
{
switch (this.level)
{
case 10:
this.Learn(-0.125f);
break;
case 11:
this.Learn(-0.25f);
break;
case 12:
this.Learn(-0.5f);
break;
case 13:
this.Learn(-1f);
break;
case 14:
this.Learn(-1.5f);
break;
case 15:
this.Learn(-2f);
break;
case 16:
this.Learn(-3f);
break;
case 17:
this.Learn(-4f);
break;
case 18:
this.Learn(-5f);
break;
case 19:
this.Learn(-7f);
break;
case 20:
this.Learn(-10f);
break;
}
}

skullywag

Yep thats it, hard coded you would have to get deep into overriding code to sort this out. Might not even be possible without all new pawn type tbh.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

AAR_Dev

A different way may be to create your own tick event and then check your skill levels and increment them for the same amount that decrements them. Just a thought, not even sure if it would work don't have the rest of the code with me at the moment.

Petrenko

Alright i guess i'll have to wait till it gets opened up a bit more. Maybe there will be items in a future update altering learning behaviour.

Thanks for so much effort so far =D


AAR_Dev

Quote from: Petrenko on January 27, 2015, 08:59:23 AM
Alright i guess i'll have to wait till it gets opened up a bit more. Maybe there will be items in a future update altering learning behaviour.

Thanks for so much effort so far =D

Well what are you trying to do? You originally asked to turn off skill degradation. As Rikki pointed out we already have neurotrainers, so I'm sure what you want to do is possible.

Petrenko

I just like to level up my folks to 20 and not have to worry about that skill anymore. But seeing a lvl 20 research degrade to lvl 16 just makes me mad. It is a great future for most people and i respect that. But i don't like it and want to get rid of it.

AAR_Dev

I will look into it but like I said I'm sure you can make a new tick event and just increase the skill for whatever it was decreased for that tick. Dirty but effective.

Ratys

Delivering, in case there's still interest. And thanks for showing where to look :)