Salamandre19 Posted November 30, 2019 Share Posted November 30, 2019 (edited) I want to script several perks to give 1 perk points each. So I made a quest, then add new script to it: Scriptname Valery_perk100 extends Quest Event OnInit() ; Give the player 1 more perk points. Game.AddPerkPoints(1) EndEvent In properties I added quest's name, so thats simple. In game I added to that perk to start this quest (stage 0 right?) Yet when I activate the perk, no perk point is given? I am beginner with scripts, so where I screwed please? Edited November 30, 2019 by Salamandre19 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 30, 2019 Share Posted November 30, 2019 If you want a perk to give the perk point, then the script needs to be on the perk rather than on a quest. Perks have script fragments which are individual functions rather than full scripts. The Creation Kit will handle creating the script file itself. Just add the following to the start / begin fragment of the relevant perks and then compile it: Game.AddPerkPoints(1)It should be noted that you'll end up with a separate script for each perk. And to avoid potential conflict I suggest using a mod prefix. The Creation Kit allows you to set one up that will automatically be inserted in the fragment's full script name when created. This article contains instructions on how to set up such a mod prefix: http://skyrimmw.weebly.com/skyrim-modding/naming-conventions-skyrim-modding-article Please note that this prefix is reserved for the various fragment scripts that the Creation Kit can create. If when creating the script you're given the option of naming it, then you'll need to include the prefix for yourself if desired. Link to comment Share on other sites More sharing options...
Salamandre19 Posted December 1, 2019 Author Share Posted December 1, 2019 (edited) Thanks for responding!(What I see when I open the perk is a box "papyrus scripts". This is what you mean, or select in conditions/entry point "activate"? Because if I select the first "papyrus script", add script, new script, name it, then add the command by editing its source Game.AddPerkPoints(1) When I select compile it fails http://imageshack.com/a/img922/6481/YP5TEp.jpg Edited December 1, 2019 by Salamandre19 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 1, 2019 Share Posted December 1, 2019 Sorry, when I looked it up on the CK wiki I found the page talking about Perk Fragments and was certain that when I did look into using a perk once that it had fragment boxes rather than the standard full script box. But that is apparently not the case for what you are doing. So forget about that. Instead try something like: Scriptname SomeScript Extends Perk Event OnInit() Game.AddPerkPoints(1) EndEventWhich is what you had initially but extending perk instead of quest. Link to comment Share on other sites More sharing options...
Salamandre19 Posted December 1, 2019 Author Share Posted December 1, 2019 Thanks but can't get it to work, now it compiles fine but it adds perks upon load game, not when I activate the perk.In properties I tried 2 things, int and perk. Both give same result...do i have to mess with the checkboxes Hidden, Initial value and such?The perk I tested upon is armsman. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 1, 2019 Share Posted December 1, 2019 There is no event on the perk script that I can think of to utilize. Also was not aware that perks were seemingly active at game start. Might have to think outside of the box... Go back to a start game enabled quest scriptRegister for the "LevelUp menu"When the menu closes, check if the player now has one of the perksAdd the perk point. The script will be a bit more complicated than that depending upon how many perks you are dealing with as well as preventing the gain of more perk points than desired. The following has not been tested for compilation or function. The use of arrays allows growth in the mod by giving the ability to simply add entries to the array without needing to edit and compile the script again. Scriptname SomeQuestScript 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 Link to comment Share on other sites More sharing options...
Salamandre19 Posted December 1, 2019 Author Share Posted December 1, 2019 (edited) Thanks but I didn't succeed ;( Did I have to do additional actions beyond adding your script to a quest? C:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\VR9.psc(11,2): RegisterForMenu is not a function or does not exist No output generated for VR9, compilation failed. I think it is not a good idea to assign it to level up, as 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 100/200/300/400 locations respectively, so no relation with level up. Even in vanilla game, a perk can be activated by a skill level up, without your overall level. Also, I have to fix my previous post, when I told perks are given on load game with your previous script, I was implying perk POINTS, sorry for not being clear enough. So your script succeeded to give the points, but only on load game, not on perk activation. Edited December 1, 2019 by Salamandre19 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 1, 2019 Share Posted December 1, 2019 It did not compile because I forgot to mention that it requires SKSE. Is not the perk trees accessible through the level up menu? Just because it is called the 'level up menu' does not mean it is only accessed when leveling up. It is worth testing to see if it works before dismissing it out of hand. After all, it is better to tie it to an action rather than having a constant poll checking to see if the player has gained a perk or not. Link to comment Share on other sites More sharing options...
Salamandre19 Posted December 1, 2019 Author Share Posted December 1, 2019 But I have SKSE, I run mods with hundreds of scripts, so i don't know why it doesn't want to recognize function. Does the editor need some special shortcut to run SKSE, like the game? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 1, 2019 Share Posted December 1, 2019 It is possible to run SKSE without the source scripts as the game does not need them. However, the Creation Kit does need them. To that end, ensure that you have installed the SKSE source scripts (PSC files) and that they are in the correct location. Otherwise, I have no idea why the compiler would have an issue with that particular function call. And no, there is no special shortcuts needed. SKSE papyrus additions should be recognized without anything additional being done beyond making sure the PSC files in the correct location. You will need to overwrite base game / dlc PSC files. Link to comment Share on other sites More sharing options...
Recommended Posts