Jump to content

GetPerkRank not working


Exalderan

Recommended Posts

The NVSE function GetPerkRank doesn't work when i use it for an effect condition. I set

Condition Function->GetPerkRank

Function Parameters->Perk:'LifeGiver'

Comparison->==

Value->3.0000

Run on->Subject

 

The condition is just not recognized ingame. Run on->PlayerRef didn't work either and setting Function Parameters->Perk:'LifeGiver' Actor:PlayerRef didn't work either.

Does this function even work in conditions or can it only be used in scripts?

Link to comment
Share on other sites

Hey there, I wrote a perk mod a while ago.

 

It changes the way the friendship perk works by removing it and adding 4 new perks instead.

All scripted, so nothing is saved into the savegame nor any base record is changed.

 

I either had a similar problem but solved it. Yet I think it was a JIP LN NVSE function.

https://www.nexusmods.com/newvegas/mods/63967

 

 

Ah, my bad.

You need it to work as condition?

 

Well you can set a quest / global variable to the perk rank and add it as condition.

scn YourPerkRankQuest
Short YourPerkRankVariable
Begin GameMode
    if Player.GetPerkRank <Your Perk>
        if YourPerkRankVariable != Player.GetPerkRank
            Let YourPerkRankVariable := Player.GetPerkRank
        endif
    else
        if YourPerkRankVariable
            Let YourPerkRankVariable := 0
        endif
    endif
end

Now use "YourPerkRankVariable" as condition.

 

 

 

An easier solution would be to change the variable as soon as you get the desired perk or raise the perks level (change variable in the perk, you should be able to set the stage of your YourPerkRankQuest in Perk Entries and in the result script of that quest you can change variable to current value and set the regular bonus effects of the perk level via script too).

As that won't require a GameMode running all the time to check the variable.

 

In addition:

But as I see you are using the vanilla perk "life giver", changing it may raise incompatibilities, as any other mod which overwrite that perk and is loaded after your mod will undo your changes (edited perk entries).

So the GameMode solution is more compatible in that case.

 

 

 

Another addition:

To make the GameMode a bit more "engine-friendly" you could add a MenuMode block too:

 

scn YourPerkRankQuest
Short YourPerkRankVariable
Short YourLevelUpVariable
 
Begin MenuMode 1027 ;=> As perks are normally added in the level up menu
    if YourLevelUpVariable == 0
        Let YourLevelUpVariable := 1
    endif
End
 
Begin GameMode
   if YourLevelUpVariable
       if Player.GetPerkRank <Your Perk>
           if YourPerkRankVariable != Player.GetPerkRank
               Let YourPerkRankVariable := Player.GetPerkRank
           endif
       else
           if YourPerkRankVariable
               Let YourPerkRankVariable := 0
           endif
       endif
      Let YourLevelUpVariable := 0
   endif
end

 

 

So now the script only checks if one tiny, dumb variable is true. If not, no other "heavy" function checks will be performed.

Link to comment
Share on other sites

Looks like the vanilla perk only has 1 rank. But strangely there is 3 different Actor effects for it.

 

So my guess is you either add 2 more ranks to the perk , in which it may return a rank then.

 

Or since the rank is irrelevant really , and you just want to know which actor effect is on the player.

You can use this for a condition.

 

IsSpellTarget PerkLifeGiver3 == 1

Run on: PlayerRef

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...