adman85 Posted December 13, 2011 Share Posted December 13, 2011 So, I'm new to this, but I think this will solve the problem I've been having with a perk I created. Instead of just adding the perk to the player (which causes the player to be unable to rest or wait due to an annoying flaw) I want to attach a script to the player (and possibly all npcs and non robotic creatures) which adds the perk when the player falls below 70% of his max health, then removes the perk when the player is above 70%.. I assume it would go something like this.. scn addremoveperk BEGIN GetHealthPercentage < 0.70 player.addperk (perkrefnumber) OR GetHealthPercentage => 0.70 player.removeperk (perkrefnumber) END But i really don't know as I've never really written a script from scratch before, (i have successfully transplanted some simple scripts from fallout before) Link to comment Share on other sites More sharing options...
wektis Posted December 13, 2011 Share Posted December 13, 2011 A couple of quick pointers that I think will make things easier on you. Create a quest and have it set to Start Game Enabled. Create your script, making sure it is a Quest script (not Object which is the default) scn addremoveperk Begin GameMode ;the rest of your script END Go back to your quest and add the script and your done. Remember is the script doesn't save there is something wrong with your syntax. Link to comment Share on other sites More sharing options...
adman85 Posted December 13, 2011 Author Share Posted December 13, 2011 (edited) Well I couldn't get the script to save so i must have written it badly.. The above functions are all I want it to do. I also tried manually adding and removing the perk through the console, but it doesn't reckognise the id i put in.. :wallbash: Frustration! Edit; ok so I got the console to work, but still not the script.. I guess manual console commands will have to do for now. Edited December 13, 2011 by adman85 Link to comment Share on other sites More sharing options...
troyquay Posted December 18, 2011 Share Posted December 18, 2011 (edited) you can try thisidk if it will work but hopefully it will work like a charm scn addremoveperk Begin GameMode If player.GetHealthPercentage < 0.70 && player.HasPerk (perkrefnumber) == 0 player.AddPerk (perkrefnumber) ElseIf player.GetHealthPercentage => 0.70 && player.HasPerk (perkrefnumber) == 1 player.RemovePerk (perkrefnumber) EndIf End Edited December 18, 2011 by troyquay Link to comment Share on other sites More sharing options...
adman85 Posted December 18, 2011 Author Share Posted December 18, 2011 Thanks so much for your help troyquay! :thumbsup: Kudos sent. I haven't had time to try it properly, but I just got the geck upgrade so I should be able to save the script properly now right? Or do I need another program? Link to comment Share on other sites More sharing options...
troyquay Posted December 18, 2011 Share Posted December 18, 2011 (edited) sorryit doesn't worki made a small mistakei didn't try it on GECK because i was overconfident that it will work here is the correct one scn addremoveperk Begin GameMode If player.GetHealthPercentage < 0.70 && player.HasPerk AnimalFriend == 0 player.AddPerk AnimalFriend ElseIf player.GetHealthPercentage >= 0.70 && player.HasPerk AnimalFriend == 1 player.RemovePerk AnimalFriend EndIf End you can change the AnimalFriend to any other perk name. for example, ActionBoy, Chemist, etcthe problem with the previous script is the ---> =>the correct one should be ---> >= I think you don't have to install another program like NVSE to use it. Edited December 18, 2011 by troyquay Link to comment Share on other sites More sharing options...
adman85 Posted December 18, 2011 Author Share Posted December 18, 2011 (edited) Hey thanks again. The script works pretty much perfectly, except the perk seems to cut in and out every few seconds even when the conditions should be met. Though this may be due to the problem you just mentioned above, I will fix that line and see if it works better. EDIT; fixed the line in FNVEdit, but I still get the perk turning off and back on weirdly every few seconds after the script conditions are met Also the ElseIf line needs a space between the two words (Else If) Would EndIf need a space too then? Edited December 18, 2011 by adman85 Link to comment Share on other sites More sharing options...
troyquay Posted December 18, 2011 Share Posted December 18, 2011 (edited) what do you mean by "cut in and out" ?I tested it just now and it worked just finehow do you use the script? using a Quest? or something elese EDIT: no. the ElseIF line should be one word, not separated.I tested it and it worked well. Edited December 18, 2011 by troyquay Link to comment Share on other sites More sharing options...
adman85 Posted December 18, 2011 Author Share Posted December 18, 2011 (edited) Yes I have it on a quest which is start game enabled. If it works fine for you then it must be something to do with the perk. The perk itself has health percentage conditions as well, would this mess with the process? EDIT; weird when I tried to save it had a "syntax error" until I separated the two words.. Edited December 18, 2011 by adman85 Link to comment Share on other sites More sharing options...
troyquay Posted December 18, 2011 Share Posted December 18, 2011 (edited) maybe it has something to do with the perk itselfif the script can be saved, then it will work. Edited December 18, 2011 by troyquay Link to comment Share on other sites More sharing options...
Recommended Posts