Jump to content

Adding perk points script


Salamandre19

Recommended Posts

Keep in mind next time you should post your problem to this forum part: https://forums.nexusmods.com/index.php?/forum/3930-skyrim-creation-kit-and-modders/

About perk fragment: https://www.creationkit.com/index.php?title=Perk_Fragments
Note: "When a perk fragment script is first created, it isn't possible to add properties to it.
You must first close the Perk dialog window and then reopen it before adding properties to the script."

Salamandre19 wrote: "sometimes we assign perks when a required stage is achieved, for example in my new perk tree, perks can be activated when the player visited.."

 

Maybe next events could be helpful to reach your aim without SKSE by using IsharaMeradins quest script sample.

Keep in mind you have to register your quest to the StoryManager and your browser needs cookies enabled to surf to the CK wiki pages.

Event OnStoryIncreaseSkill(string asSkill)

https://www.creationkit.com/index.php?title=OnStoryIncreaseLevel_-_Quest

Event OnTrackedStatsEvent(string asStat, int aiStatValue)

https://www.creationkit.com/index.php?title=OnTrackedStatsEvent_-_Form

Edited by ReDragon2013
Link to comment
Share on other sites

yes I already extracted long time ago the scripts.rar in Skyrim main folder. However, as at the time I didn't have enough info, I didn't allow to overwrite the existing files, as I thought those were from downloaded mods. So let me ask this properly now, so no error occurs: where do I exactly extract the scripts.rar so the pex go in scripts then psc in source, am I right?

 

ReDragon2013 yes box "start game enabled" was checked, so registered by quest manager.

 

"When a perk fragment script is first created, it isn't possible to add properties to it.
You must first close the Perk dialog window and then reopen it before adding properties to the script.
"

 

My problem isn't the properties now, but compiling the script, so the step before

Edited by Salamandre19
Link to comment
Share on other sites

Extract the scripts.rar file in its current location i.e. Data folder. The correct sub-folders will be created if they are not. Then for proper modding with all DLC, copy the Dawnguard scripts into the source folder, copy the Hearthfires scripts into the source folder, copy the Dragonborn scripts into the source folder. Finally, manually re-install SKSE and ensure that its PSC files are in the Source folder as well. At each step, overwrite as needed.

 

The alternative is to set up a third party text editor (i.e Sublime Text, Notepad++, etc) in such a way that it can look in multiple folder locations for the source files.

Link to comment
Share on other sites

Thank you for taking the time to help me.

 

I did all the steps, and obviously SKSE works fine as it deals with mods in game.

Yet I have same result, it refuses to recognize that function, to be sure it is not my fault I paste here the script as you gave me

Scriptname VR12 extends Quest  

{A script to give perk points when specific perks have been selected}

Perk[] Property myPerkArray Auto
{assign values directly in the Creation Kit}

Bool[] Property myStatusArray Auto
{assign values directly in the Creation Kit - each must be initially false and index count must match myPerkArray}

Event OnInit()
  RegisterForMenu("LevelUp menu")
EndEvent

Event OnMenuClose(String MenuName)
  If MenuName == "LevelUp menu"
    Actor PlayerRef = Game.GetPlayer()
    Int index = 0
    While index < myPerkArray.Length
      If PlayerRef.HasPerk(myPerkArray[index]) && myStatusArray[index] == False
        myStatusArray[index] = true
        Game.AddPerkPoints(1)
      EndIf
      index += 1
    EndWhile
  EndIf
EndEvent

The compile message is invariably

RegisterForMenu is not a function or does not exist

 

I created a new quest.

Didn't check anything, as "start game enabled" and "run once" were already checked.

Clicked ok after creating the quest so the quest is registered

Then I go in scripts tab, add that script ant proceeded to compile.

 

Ok, now from a previous modding experience with heroes 3 Wake of Gods (if abbreviated the forum sets to black person?) (erm language) , we had there a trigger on mouse click then click location.

So if I were to translate, it would be : when click on perk in tree window, check if perk is already activated, if no then check if it has a "perk flag", if no then give perk point and set perk flag to 1, so it can't be reactivated further.

 

I suppose such straight steps can't be scripted here?

Edited by Salamandre19
Link to comment
Share on other sites

I'm at a loss as to why it is not compiling. I do not have the game or the CK installed in order to test it out.

 

I do not think you can perform such "straight steps" with papyrus as you have outlined. You can check if the player or other actor has a specific perk with HasPerk but there is no event such as OnPerkAdded or OnPerkActivated. As such there is no way to know when the player specifically selects a perk or has a perk added to them in some other fashion. I thought the perk itself could use the OnInit event to indicate when it was first activated. But apparently some perks are already active at the start of the game and was giving you results that you did not want.

 

I am truly at a loss on how to proceed.

 

Maybe you can have an item that the player interacts with which will check the player for whatever perks and give points as desired. I don't know.

Link to comment
Share on other sites

In fact, the tree I added to the game is made from perks which reward the player upon completion of in-game tasks. For example, after discovering 100 locations, he can activate a perk which gives a reward. After killing 100 undead, same, or completing main quest, or the 15 daedric quests.

 

So the tree is very large, it has 40 perks, thus I wanted to give bonus perks points so it incites the player to do such otherwise tedious actions.

 

Why I explain this, because maybe there is a possibility to add automatically perks when the condition is fulfilled, not when perk is activated (it boils down to exactly same thing)

 

In conditions entries, there is this

GetPCmisc

code which basically keeps track of every action I mentioned above.

 

Maybe there is a way to build a script in that direction?

 

For exemple:

After 100 locations, give perk point

After 50 cleared dungeons

After 300 animals

And so on

 

Then on quests,

Upon completion of Imperials/storm quest

Upon completion of main quest

of Winterholdf quest

and so on

 

I suppose the script would look same as long as conditions are of same type, am I right?

Edited by Salamandre19
Link to comment
Share on other sites

  • Recently Browsing   0 members

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