GetPerkModifier

From GECK
Jump to: navigation, search


A function added by the JIP NVSE Plugin.

Description

Given a baseValue, returns it modified by the calling actors' active perk effects of a given entryFunction, as per GetNthPerkEntryFunction. The calling actor is taken as the reference on which the conditions for the 'Perk Owner' tab are run onto.
Optionally up to two additional forms are to be supplied, for entry functions which use additional condition tabs. The final result is thus the base value modified by all the actors' active perk effects of that entry function which can apply to the forms provided.

Syntax

[help]
(perkModifier:float) reference.GetPerkModifier entryFunction:int baseValue:float form1:ref form2:ref

Example

let fPerkModifier := PlayerRef.GetPerkModifier 10 5

10 is the entry function for 'Adjust Gained Skill Points', fPerkModifier would thus normally be 5. If the player has the Educated perk for example, which adds 2 extra skill points per level up, fPerkModifier would then be 7.

let rWeapon := PlayerRef.GetEquippedObject 5
let fBaseSpread := 1
let fPerkModifier := PlayerRef.GetPerkModifier 34 fBaseSpread rWeapon

34 is the entry function for 'Calculate Gun Spread'. Assuming all perks with such an effect on the player act as multipliers for that value, fPerkModifier would then return the player's spread multiplier due to perks with his current weapon. It could be better to calculate a more proper value for fBaseSpread beforehand, in case some of the player's perks are directly adding or substracting to that value.

let fPerkModifier := PlayerRef.GetPerkModifier 28 0

28 is the entry function for 'Mysterious Stranger', which can only be enabled if perks are setting it to 1, so the modifier is calculated from a base of 0.

Notes

  • form1 and form2 are necessary on a case by case basis, whether the entry function uses more than one condition tab can be quickly consulted in the GECK. Even if they are unimportant for the result, any dummy reference should be supplied.
  • As illustrated in the examples, what to use as baseValue and how to interpret the result can depend on the entry function: some are somewhat straightforward, others require gathering some base value beforehand, or to assume a base value for the actor of 0 or 1 in absence of perks.
  • Typically only the player character can hold perks, so this function is of no use when called on NPCs. However, it does work on active companions, returning adjusted values as per the player's companion perk list.
  • Additional arguments according to Perk Entry Codes that accept them are as follows:
0: Weapon, Target
1: Weapon, Target
2: Weapon, target
3: Weapon
4: Item
5: Weapon
6: Attacker, Attacker's weapon
7: Weapon
8: Weapon, Target
14: Target
15: Attacker
16: Attacker, Attackee
17: Item
21: Target
27: Target
34: Weapon
35: Weapon, Target
36: Weapon, Target
37: Weapon
38: Weapon
39: Weapon
40: Weapon
43: Weapon
49: Weapon
50: Weapon
52: Weapon
53: Weapon
54: Weapon
56: Attacker, Attacker's weapon
57: Weapon
58: Weapon, Target
59: Weapon
60: Weapon
72: Weapon