Campaigner Posted January 3, 2013 Share Posted January 3, 2013 Hello nexus, I bring an issue that I can't quite solve. With the use of the CK wiki, I made a simple onread script. Scriptname aaaaPerkonUseScript extends ObjectReference {Adds perk to player} Perk Property myPerk auto Event OnRead() Debug.Trace("perk added") Game.GetPlayer().AddPerk(myPerk) endEvent See? Very simple. It works somewhat, as it does indeed give me the perk that I tell it to give me, but two problems happen; it doesn't notify me ingame when I earn the perk, and this script only seems to work one time. In my testing, I made two separate perks for two separate items; Spiced Wine and Black Briar Private Reserve. I set up a recipe for both, set the conditions "hasperk perk01/perk02" (for spiced/reserve, respectively). I set up two books, each with one script adding one perk using the above script. Only Spiced Wine works. I can't get any other recipes to work with this. Do I need to remake the script multiple times? Because that would be most annoying. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 3, 2013 Share Posted January 3, 2013 You should be able to have it work on more than one object provided you set the properties correctly for each object. Double check on the one that doesn't work that you did set the property correctly. To have for testing purposes an in-game notice of when the book is read copy your debug.trace line and change it to debug.notification it will then appear at the top left corner. just be sure to comment it out before release. Link to comment Share on other sites More sharing options...
Campaigner Posted January 3, 2013 Author Share Posted January 3, 2013 (edited) I've got perk1 on book1, and perk1 attached to Spiced Wine's recipe. I've got perk2 on book 2, and perk 2 attached to Black Briar's recipe. The properties on the script, attached to each book, match up correctly with the wanted perk and recipe. I've triple checked this, and it still isn't working. Here's how it is in my progress; Recipe 1 makes Spiced Wine. Recipe 2 makes Black Briar Private Reserve. Recipe 1 requires 1 mead, Recipe 2 requires 1 black briar mead.Recipe 1 has a condition that requires Perk01. Recipe 2 has a condition that requires Perk02. Both require a cooking pot.Book 1 has the aforementioned script pointing to Perk01. Book 2 has the aforementioned script pointing to Perk02. I've built them together from scratch again, and the same result occurs; Recipe 1 works, but not Recipe 2. EDIT: Adding in the notification tells me why it isn't working; the second recipe's script isn't even working. There's nothing I can change to make it work, since it's literally an exact copy with a different ID. What is causing this? Edited January 3, 2013 by Campaigner Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 3, 2013 Share Posted January 3, 2013 Sometimes when you add an existing script it doesn't always stick to the object. Try compiling & saving the script again on both objects. It just might keep the script attached to the object. That's the only thing I can think of. Link to comment Share on other sites More sharing options...
Campaigner Posted January 3, 2013 Author Share Posted January 3, 2013 Sorry for the late reply. Buggy bethesda programs keep crashing without any error. Redid the script completely from scratch and tested it in a new mod. Made both perks, then both books, then both recipes, then linked them. It suddenly worked. Went back to the original mod, deleted EVERYTHING related to the perks and script, and did exactly the same as the other mod. This time, neither worked. This is the order I took for both the test mod and my real mod: Made Perk 1Made Perk 2Made Book 1Made Book 2Made Duplicate of Crafted Item 1Made Duplicate of Crafted Item 2Made Recipe 1 for Crafted Item 1Made Recipe 2 for Crafted Item 2Attached Script to Book 1Attached Perk 1 to Book 1's scriptSaved, Reopened Book 1 to verify that Perk 1 was in useAttached Script to Book 2Attached Perk 2 to Book 2's scriptSaved, Reopened Book 2 to verify that Perk 2 was in usePlaced recipes in a containerPlaced container somewhere in gameLooted both recipes, read both recipesWent to Cooking SpitTest Mod: Both crafted items appeared.Real Mod: No crafted items appeared. In that exact order. My mod does not conflict with any other mods, as it's nothing but new stuff that is not used by any other mod. I'm confused. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 3, 2013 Share Posted January 3, 2013 Does your real mod have the scripts loose or inside a BSA file? I've found that sometimes things don't get properly read from the BSA file. However, I've also been informed that much of those issuse can be solved by creating the BSA outside of the CK with the archive.exe program. At this point I'm stretching... Cause obviously if it worked for the test mod then it should work for the real mod. Link to comment Share on other sites More sharing options...
bloomingdedalus Posted January 4, 2013 Share Posted January 4, 2013 Sorry for the late reply. Buggy bethesda programs keep crashing without any error. Redid the script completely from scratch and tested it in a new mod. Made both perks, then both books, then both recipes, then linked them. It suddenly worked. Went back to the original mod, deleted EVERYTHING related to the perks and script, and did exactly the same as the other mod. This time, neither worked. This is the order I took for both the test mod and my real mod: Made Perk 1Made Perk 2Made Book 1Made Book 2Made Duplicate of Crafted Item 1Made Duplicate of Crafted Item 2Made Recipe 1 for Crafted Item 1Made Recipe 2 for Crafted Item 2Attached Script to Book 1Attached Perk 1 to Book 1's scriptSaved, Reopened Book 1 to verify that Perk 1 was in useAttached Script to Book 2Attached Perk 2 to Book 2's scriptSaved, Reopened Book 2 to verify that Perk 2 was in usePlaced recipes in a containerPlaced container somewhere in gameLooted both recipes, read both recipesWent to Cooking SpitTest Mod: Both crafted items appeared.Real Mod: No crafted items appeared. In that exact order. My mod does not conflict with any other mods, as it's nothing but new stuff that is not used by any other mod. I'm confused. Did you load a saved game that you had saved while the previous version of the mod's scripts were active? I've had a lot of problems with saved games keeping previous scripts running when I change something in the .esp file. For example, I'll make an x-marker cast at another x-marker. Then I readjust the target in Creation kit of the x-marker target, and, if I load a game which had been saved before moving the target, but after putting the target in, it will still try to cast in the old direction. Loading a game that was existent prior to any of these objectreferences usually fixes it. Make sure you're using a fresh load EACH TIME. If you make a script and it compiles, it often gets saved in the save game, then, if you change the script, it will often still run the old script even though that script isn't in your plugin anymore. Link to comment Share on other sites More sharing options...
steve40 Posted January 4, 2013 Share Posted January 4, 2013 (edited) @bloomingdedalus: that will not be an issue on a simple passive script that does not have running OnUpdate calls or While loops. @Campaigner: Check your Papyrus log for runtime errors. But is seems to me that it is the recipe that is not working, the script is fine. If you want to check if your perks have been added or not, then use the "HasPerk" console command. Edited January 4, 2013 by steve40 Link to comment Share on other sites More sharing options...
Recommended Posts