gengrimm Posted February 8, 2012 Share Posted February 8, 2012 (edited) I'd recommend looking to see if there is a OnSkillUp method to bounce your Get skill and addperk script off of. Running off loading or time is most certainly a waste of resources and just not a good practice. I haven't dived into the Papyrus yet, but when I get home I'll look for a good method for you to bounce your script off of. Edited February 8, 2012 by gengrimm Link to comment Share on other sites More sharing options...
grey79 Posted February 8, 2012 Share Posted February 8, 2012 (edited) I'd recommend looking to see if there is a OnSkillUp method to bounce your Get skill and addperk script off of. Running off loading or time is most certainly a waste of resources and just not a good practice. I haven't dived into the Papyrus yet, but when I get home I'll look for a good method for you to bounce your script off of. This one miiiight be better:http://www.creationkit.com/OnTrackedStatsEvent_-_Form Haven't toyed much with it yet, and the docs are slim in nature. (There is no onLevelUp or onSkillUp events) Edited February 8, 2012 by grey79 Link to comment Share on other sites More sharing options...
Extragorey Posted February 9, 2012 Author Share Posted February 9, 2012 (edited) Thanks for your help everyone - the script now compiles, which is a good start.But...It crashes the game. Scriptname JulesPerkRankAssign extends ObjectReference {Automatically assigns the appropriate Rank perks upon leveling up in a magic school or the Lockpicking skill; updates every 5 seconds} Perk property DestructionNovice00 auto Perk property DestructionApprentice25 auto Perk property DestructionAdept50 auto Perk property DestructionExpert75 auto Perk property DestructionMasterl00 auto Perk property ConjurationNovice00 auto Perk property ConjurationApprentice25 auto Perk property ConjurationAdept50 auto Perk property ConjurationExpert75 auto Perk property ConjurationMaster100 auto Perk property IllusionNovice00 auto Perk property IllusionApprentice25 auto Perk property IllusionAdept50 auto Perk property IllusionExpert75 auto Perk property IllusionMaster100 auto Perk property RestorationNovice00 auto Perk property RestorationApprentice25 auto Perk property RestorationAdept50 auto Perk property RestorationExpert75 auto Perk property RestorationMaster100 auto Perk property AlterationNovice00 auto Perk property AlterationApprentice25 auto Perk property AlterationAdept50 auto Perk property AlterationExpert75 auto Perk property AlterationMaster100 auto Perk property NoviceLocks00 auto Perk property ApprenticeLocks25 auto Perk property AdeptLocks50 auto Perk property ExpertLocks75 auto Perk property MasterLocks100 auto Event OnActivate(ObjectReference akActionRef) Debug.MessageBox("Registering!") RegisterForUpdateGameTime(0.00139) endEvent Event OnUpdateGameTime() ; this event occurs every 5.004 seconds of game time if Game.GetPlayer().GetAV("Destruction") >= 25 && Game.GetPlayer().HasPerk(DestructionApprentice25) == 0 && Game.GetPlayer().HasPerk(DestructionNovice00) == 1 Game.GetPlayer().AddPerk(DestructionApprentice25) Debug.MessageBox("Congratulations! You have been awarded the Apprentice Destruction perk for reaching 25 Destruction.") endIf if Game.GetPlayer().GetAV("Destruction") >= 50 && Game.GetPlayer().HasPerk(DestructionAdept50) == 0 && Game.GetPlayer().HasPerk(DestructionApprentice25) == 1 Game.GetPlayer().AddPerk(DestructionAdept50) Debug.MessageBox("Congratulations! You have been awarded the Adept Destruction perk for reaching 50 Destruction.") endIf if Game.GetPlayer().GetAV("Destruction") >= 75 && Game.GetPlayer().HasPerk(DestructionExpert75) == 0 && Game.GetPlayer().HasPerk(DestructionAdept50) == 1 Game.GetPlayer().AddPerk(DestructionExpert75) Debug.MessageBox("Congratulations! You have been awarded the Expert Destruction perk for reaching 75 Destruction.") endIf if Game.GetPlayer().GetAV("Destruction") >= 100 && Game.GetPlayer().HasPerk(DestructionMasterl00) == 0 && Game.GetPlayer().HasPerk(DestructionExpert75) == 1 Game.GetPlayer().AddPerk(DestructionMasterl00) Debug.MessageBox("Congratulations! You have been awarded the Master Destruction perk for reaching 100 Destruction.") endIf if Game.GetPlayer().GetAV("Conjuration") >= 25 && Game.GetPlayer().HasPerk(ConjurationApprentice25) == 0 && Game.GetPlayer().HasPerk(ConjurationNovice00) == 1 Game.GetPlayer().AddPerk(ConjurationApprentice25) Debug.MessageBox("Congratulations! You have been awarded the Apprentice Conjuration perk for reaching 25 Conjuration.") endIf if Game.GetPlayer().GetAV("Conjuration") >= 50 && Game.GetPlayer().HasPerk(ConjurationAdept50) == 0 && Game.GetPlayer().HasPerk(ConjurationApprentice25) == 1 Game.GetPlayer().AddPerk(ConjurationAdept50) Debug.MessageBox("Congratulations! You have been awarded the Adept Conjuration perk for reaching 50 Conjuration.") endIf if Game.GetPlayer().GetAV("Conjuration") >= 75 && Game.GetPlayer().HasPerk(ConjurationExpert75) == 0 && Game.GetPlayer().HasPerk(ConjurationAdept50) == 1 Game.GetPlayer().AddPerk(ConjurationExpert75) Debug.MessageBox("Congratulations! You have been awarded the Expert Conjuration perk for reaching 75 Conjuration.") endIf if Game.GetPlayer().GetAV("Conjuration") >= 100 && Game.GetPlayer().HasPerk(ConjurationMaster100) == 0 && Game.GetPlayer().HasPerk(ConjurationExpert75) == 1 Game.GetPlayer().AddPerk(ConjurationMaster100) Debug.MessageBox("Congratulations! You have been awarded the Master Conjuration perk for reaching 100 Conjuration.") endIf if Game.GetPlayer().GetAV("Illusion") >= 25 && Game.GetPlayer().HasPerk(IllusionApprentice25) == 0 && Game.GetPlayer().HasPerk(IllusionNovice00) == 1 Game.GetPlayer().AddPerk(IllusionApprentice25) Debug.MessageBox("Congratulations! You have been awarded the Apprentice Illusion perk for reaching 25 Illusion.") endIf if Game.GetPlayer().GetAV("Illusion") >= 50 && Game.GetPlayer().HasPerk(IllusionAdept50) == 0 && Game.GetPlayer().HasPerk(IllusionApprentice25) == 1 Game.GetPlayer().AddPerk(IllusionAdept50) Debug.MessageBox("Congratulations! You have been awarded the Adept Illusion perk for reaching 50 Illusion.") endIf if Game.GetPlayer().GetAV("Illusion") >= 75 && Game.GetPlayer().HasPerk(IllusionExpert75) == 0 && Game.GetPlayer().HasPerk(IllusionAdept50) == 1 Game.GetPlayer().AddPerk(IllusionExpert75) Debug.MessageBox("Congratulations! You have been awarded the Expert Illusion perk for reaching 75 Illusion.") endIf if Game.GetPlayer().GetAV("Illusion") >= 100 && Game.GetPlayer().HasPerk(IllusionMaster100) == 0 && Game.GetPlayer().HasPerk(IllusionExpert75) == 1 Game.GetPlayer().AddPerk(IllusionMaster100) Debug.MessageBox("Congratulations! You have been awarded the Master Illusion perk for reaching 100 Illusion.") endIf if Game.GetPlayer().GetAV("Restoration") >= 25 && Game.GetPlayer().HasPerk(RestorationApprentice25) == 0 && Game.GetPlayer().HasPerk(RestorationNovice00) == 1 Game.GetPlayer().AddPerk(RestorationApprentice25) Debug.MessageBox("Congratulations! You have been awarded the Apprentice Restoration perk for reaching 25 Restoration.") endIf if Game.GetPlayer().GetAV("Restoration") >= 50 && Game.GetPlayer().HasPerk(RestorationAdept50) == 0 && Game.GetPlayer().HasPerk(RestorationApprentice25) == 1 Game.GetPlayer().AddPerk(RestorationAdept50) Debug.MessageBox("Congratulations! You have been awarded the Adept Restoration perk for reaching 50 Restoration.") endIf if Game.GetPlayer().GetAV("Restoration") >= 75 && Game.GetPlayer().HasPerk(RestorationExpert75) == 0 && Game.GetPlayer().HasPerk(RestorationAdept50) == 1 Game.GetPlayer().AddPerk(RestorationExpert75) Debug.MessageBox("Congratulations! You have been awarded the Expert Restoration perk for reaching 75 Restoration.") endIf if Game.GetPlayer().GetAV("Restoration") >= 100 && Game.GetPlayer().HasPerk(RestorationMaster100) == 0 && Game.GetPlayer().HasPerk(RestorationExpert75) == 1 Game.GetPlayer().AddPerk(RestorationMaster100) Debug.MessageBox("Congratulations! You have been awarded the Master Restoration perk for reaching 100 Restoration.") endIf if Game.GetPlayer().GetAV("Alteration") >= 25 && Game.GetPlayer().HasPerk(AlterationApprentice25) == 0 && Game.GetPlayer().HasPerk(AlterationNovice00) == 1 Game.GetPlayer().AddPerk(AlterationApprentice25) Debug.MessageBox("Congratulations! You have been awarded the Apprentice Alteration perk for reaching 25 Alteration.") endIf if Game.GetPlayer().GetAV("Alteration") >= 50 && Game.GetPlayer().HasPerk(AlterationAdept50) == 0 && Game.GetPlayer().HasPerk(AlterationApprentice25) == 1 Game.GetPlayer().AddPerk(AlterationAdept50) Debug.MessageBox("Congratulations! You have been awarded the Adept Alteration perk for reaching 50 Alteration.") endIf if Game.GetPlayer().GetAV("Alteration") >= 75 && Game.GetPlayer().HasPerk(AlterationExpert75) == 0 && Game.GetPlayer().HasPerk(AlterationAdept50) == 1 Game.GetPlayer().AddPerk(AlterationExpert75) Debug.MessageBox("Congratulations! You have been awarded the Expert Alteration perk for reaching 75 Alteration.") endIf if Game.GetPlayer().GetAV("Alteration") >= 100 && Game.GetPlayer().HasPerk(AlterationMaster100) == 0 && Game.GetPlayer().HasPerk(AlterationExpert75) == 1 Game.GetPlayer().AddPerk(AlterationMaster100) Debug.MessageBox("Congratulations! You have been awarded the Master Alteration perk for reaching 100 Alteration.") endIf if Game.GetPlayer().GetAV("Lockpicking") >= 25 && Game.GetPlayer().HasPerk(ApprenticeLocks25) == 0 && Game.GetPlayer().HasPerk(NoviceLocks00) == 1 Game.GetPlayer().AddPerk(ApprenticeLocks25) Debug.MessageBox("Congratulations! You have been awarded the Apprentice Lockpicking perk for reaching 25 Lockpicking.") endIf if Game.GetPlayer().GetAV("Lockpicking") >= 50 && Game.GetPlayer().HasPerk(AdeptLocks50) == 0 && Game.GetPlayer().HasPerk(ApprenticeLocks25) == 1 Game.GetPlayer().AddPerk(AdeptLocks50) Debug.MessageBox("Congratulations! You have been awarded the Adept Lockpicking perk for reaching 50 Lockpicking.") endIf if Game.GetPlayer().GetAV("Lockpicking") >= 75 && Game.GetPlayer().HasPerk(ExpertLocks75) == 0 && Game.GetPlayer().HasPerk(AdeptLocks50) == 1 Game.GetPlayer().AddPerk(ExpertLocks75) Debug.MessageBox("Congratulations! You have been awarded the Expert Lockpicking perk for reaching 75 Lockpicking.") endIf if Game.GetPlayer().GetAV("Lockpicking") >= 100 && Game.GetPlayer().HasPerk(MasterLocks100) == 0 && Game.GetPlayer().HasPerk(ExpertLocks75) == 1 Game.GetPlayer().AddPerk(MasterLocks100) Debug.MessageBox("Congratulations! You have been awarded the Master Lockpicking perk for reaching 100 Lockpicking.") endIf if Game.GetPlayer().HasPerk(DestructionMasterl00) == 1 && Game.GetPlayer().HasPerk(ConjurationMaster100) == 1 && Game.GetPlayer().HasPerk(IllusionMaster100) == 1 && Game.GetPlayer().HasPerk(RestorationMaster100) == 1 && Game.GetPlayer().HasPerk(AlterationMaster100) == 1 && Game.GetPlayer().HasPerk(MasterLocks100) UnregisterForUpdateGameTime() endIf endEvent ; UnregisterForUpdateGameTime() ; make sure to unregister ; 000F2CA8 DestructionNovice00 Novice Destruction ; 000C44BF DestructionApprentice25 Apprentice Destruction ; 000C44C0 DestructionAdept50 Adept Destruction ; 000C44C1 DestructionExpert75 Expert Destruction ; 000C44C2 DestructionMaster100 Master Destruction ; 000F2CA7 ConjurationNovice00 Novice Conjuration ; 000C44BB ConjurationApprentice25 Apprentice Conjuration ; 000C44BC ConjurationAdept50 Adept Conjuration ; 000C44BD ConjurationExpert75 Expert Conjuration ; 000C44BE ConjurationMaster100 Master Conjuration ; 000F2CA9 IllusionNovice00 Novice Illusion ; 000C44C3 IllusionApprentice25 Apprentice Illusion ; 000C44C4 IllusionAdept50 Adept Illusion ; 000C44C5 IllusionExpert75 Expert Illusion ; 000C44C6 IllusionMaster100 Master Illusion ; 000F2CAA RestorationNovice00 Novice Restoration ; 000C44C7 RestorationApprentice25 Apprentice Restoration ; 000C44C8 RestorationAdept50 Adept Restoration ; 000C44C9 RestorationExpert75 Expert Restoration ; 000C44CA RestorationMaster100 Master Restoration ; 000F2CA6 AlterationNovice00 Novice Alteration ; 000C44B7 AlterationApprentice25 Apprentice Alteration ; 000C44B8 AlterationAdept50 Adept Alteration ; 000C44B9 AlterationExpert75 Expert Alteration ; 000C44BA AlterationMaster100 Master Alteration ; 000F392A NoviceLocks00 Novice Locks ; 000BE125 ApprenticeLocks25 Apprentice Locks ; 000C3680 AdeptLocks50 Adept Locks ; 000C3681 ExpertLocks75 Expert Locks ; 000C3682 MasterLocks100 Master Locks I set it to run when I activate the "WETempActivator" used in the wiki's scripting tutorial. I teleport to the test cell, activate the pillar and a few seconds later the game freezes.Which as I see it could mean one of several things:1) I'm declaring too many variables, which is ridiculous - this is a 21st-century computer we're talking about2) The declared perks still aren't recognised as the pre-existing perks; it's trying to invent new ones3) Judging by the fact that it takes a few seconds before it freezes (which is about how long it should be before the second procedure runs), there's probably something similar to an infinite loop or other problem with my code which is taking too much processing time. Which, considering I'm only using if statements, is also ridiculous. So I'm going with 2), because it actually kind of makes sense that it's trying to add to the player a null perk which I've just declared but haven't defined.Any futher ideas people? This script is getting to be more trouble than it's worth... EDIT: @grey79, That looks more to do with stats than skills. But I don't suppose you'd happen to know anything about this "SomeFunction" the wiki uses in all its examples? Does this function have to be called from somewhere else in another script, or is it actually defining the function? I'm also not sure about the "RegisterForUpdateGameTime(0.00139)" line. The floating decimal might be getting rounded to 2 decimal places or something (0.00 in this case), which would either not work at all or cause the second procedure to run repeatedly, no doubt crashing the game. Edited February 9, 2012 by Teh Masterer Link to comment Share on other sites More sharing options...
Extragorey Posted February 9, 2012 Author Share Posted February 9, 2012 (edited) Also, just the addperk line by itself in an OnActivate event still doesn't correctly add the perk. Honestly, unless anyone who knows how the language works can advise me on how to fix it, I'm just going to give up until there's some proper tutorials for Papyrus.The official tutorials consist of little more than Hello World and a few if statements, so there's just no way I'm going to be able to learn how to properly write this script without weeks of trial and error. It's a shame, though, because I have a few friends who really wanted this. Edited February 9, 2012 by Teh Masterer Link to comment Share on other sites More sharing options...
gengrimm Posted February 9, 2012 Share Posted February 9, 2012 I did some looking my self and didn't see any on skillup or onlevel up. Next idea would be to find one that activates on activation of the perk, and refund a perk point to the player. Link to comment Share on other sites More sharing options...
Edlennion Posted February 9, 2012 Share Posted February 9, 2012 Also, just the addperk line by itself in an OnActivate event still doesn't correctly add the perk Have you defined the perk in the properties window? If you created the script before assigning it to the object, you need to open the "Scripts" tab in the Reference Window for the pillar you're activating from, select your script and click properties. Then, for each property (i.e perk) you need to assign it to the correct property in the drop down list. Since you've used the correct perk names, you should be able to just click Auto-fill for each of them, and it will use the correct perk. Link to comment Share on other sites More sharing options...
jimhsu Posted February 9, 2012 Share Posted February 9, 2012 +1 for proper tutorials. I literally figured out stuff like extending, global functions, etc only by wasting hours messing around. Might write some tutorials if I find the time (less likely). Link to comment Share on other sites More sharing options...
MofoMojo Posted February 10, 2012 Share Posted February 10, 2012 Also, just the addperk line by itself in an OnActivate event still doesn't correctly add the perk Have you defined the perk in the properties window? Replying with QUOTE above for emphasis. This is VERY important. None of the tutorials seem to point that out. I learned about it writing scripts attached to objects, but then forgot completely about it when working on a script for a quest and got bit. You MUST do the above. -MM Link to comment Share on other sites More sharing options...
Extragorey Posted February 10, 2012 Author Share Posted February 10, 2012 (edited) Thank you Edlennion and MofoMojo, it worked! The script now runs exactly as it should. Now I only need to think of a good place to call it. I agree that running it every 5 seconds is a bad idea - I think I'll make it run when the player wakes up from sleeping. EDIT: Argh, you need to "RegisterForSleep()" to use that event. Which, of course, needs to be in a different procedure. Sort of redundant really. Why must everything be so complicated with this language? EDIT2: Okay, I made it run OnSit. Random, I know, but it seems the simplest because you don't need to register for it.So now whenever you sit down it checks to see if there's any perks it can grant you! Now to upload to the nexus. Edited February 10, 2012 by Teh Masterer Link to comment Share on other sites More sharing options...
Extragorey Posted February 10, 2012 Author Share Posted February 10, 2012 (edited) Okay everyone, the mod is up at Skyrim Nexus.Thank you everyone for your help, I couldn't have done it without you.Let me know if there's any problems with it. Edited December 3, 2012 by Teh Masterer Link to comment Share on other sites More sharing options...
Recommended Posts