• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

PSA: Increase specific attribute/perk through quests & add XP with triggered_effect

Was digging around Assembly-CSharp.dll and found a couple unused things.

Increase attribute/perk with quest reward:

Add the following as a quest reward:

<reward type="Skill" id="perkRuleOneCardio" value="1"/>

id = name of attribute/perk from progression.xml

value = number of levels to increase

Add player XP with triggered_effect:

<triggered_effect trigger="onSelfPrimaryActionStart" action="GiveSkillExp" target="self" skill="Level" experience="100" level_percentage="1"/>

This one may require some experimenting. I haven't figured out how exactly the level_percentage attribute works in relation to skill, and I don't think what you use in skill= matters as long as the attribute is there given that XP is global and doesn't level individual skills. Because of that I don't know that this can be used to raise an attribute/perk as this only deals with XP while those increase with skill points. But it can definitely be used to add Player Level experience any time you can trigger a triggered_effect to add XP to things you otherwise don't get XP from.

- - - Updated - - -

Here's the full code for GiveSkillExp if someone more knowledgeable can figure out exactly how level_percentage works.

Code:
public class MinEventActionGiveSkillExp : MinEventActionTargetedBase
{
// Token: 0x0600389C RID: 14492 RVA: 0x001BA820 File Offset: 0x001B8C20
public override void Execute(MinEventParams _params)
{
	if (this.targets == null)
	{
		return;
	}
	for (int i = 0; i < this.targets.Count; i++)
	{
		if (this.exp != -1)
		{
			this.targets[i].Progression.AddLevelExp(this.exp);
		}
		else if (this.level_percent != -1f)
		{
			this.targets[i].Progression.AddLevelExp(this.exp);
		}
	}
}

// Token: 0x0600389D RID: 14493 RVA: 0x001BA8AE File Offset: 0x001B8CAE
public override bool CanExecute(MinEventTypes _eventType, MinEventParams _params)
{
	return base.CanExecute(_eventType, _params) && this.skill != null && (this.exp != -1 || this.level_percent != -1f);
}

// Token: 0x0600389E RID: 14494 RVA: 0x001BA8EC File Offset: 0x001B8CEC
public override bool ParseXmlAttribute(XmlAttribute _attribute)
{
	bool flag = base.ParseXmlAttribute(_attribute);
	if (!flag)
	{
		string name = _attribute.Name;
		if (name != null)
		{
			if (!(name == "skill"))
			{
				if (!(name == "experience"))
				{
					if (name == "level_percentage")
					{
						this.level_percent = StringParsers.ParseFloat(_attribute.Value, 0, -1, NumberStyles.Any);
					}
				}
				else
				{
					this.exp = StringParsers.ParseSInt32(_attribute.Value, 0, -1, NumberStyles.Integer);
				}
			}
			else
			{
				this.skill = _attribute.Value;
			}
		}
	}
	return flag;
}

// Token: 0x04002D04 RID: 11524
private string skill;

// Token: 0x04002D05 RID: 11525
private int exp = -1;

// Token: 0x04002D06 RID: 11526
private float level_percent = -1f;
}
 
Looking at the code there, it would appear it's a "one or the other" thing. Either you get the XP defined in the experience property, or you get the level_percent.

Logically, I would assume that level percent is meant to give you a percentage of your necessary total xp for the next level. So, like, if you set it to 0.01, it should take roughly 100 actions to level up.

I'll play around with this a little later and see if any of that holds true.

 
FYI, you can put a negative value on the skill quest reward to REMOVE skill levels from the player too.

Me and Subquake were messing around with that. :D

 
Back
Top