» Sun Jun 17, 2012 7:22 pm
You should add this to your tutorial. it fixes the broken NPC merchant if the player acquires Investor perk.
1. create a new PerkInvestor global variable (search perkinvestor and duplicate any of the existing ones under GLOB, i.e. PerkInvestorRiverwoodBlacksmith)
2. rename the variable to something else like PerkInvestorYourNPCname
3. create a Level List that contains items the Merchant will carry after a player gets the Investor perk. (duplicate an existing level list such as PerkInvestorRiverwoodAlvorList)
4. double click the level list and add whatever items you want. also at the top change the Use Global dropdown to the same GLOB variable you created in step 1. add this list to your merchant's container and delete any other list that says PerkInvestor.
5. search for PerkInvestor quest in the object window and double click to open the edit window
6. click on the Player Dialog tab
7. with PerkInvestorBranch1 highlighted on the left side, click on PerkInvestorBranchTopic1
8. if you created your merchant by copying an existing NPC, find that NPC's dialog option and duplicate it (warning, this will create a dirty edit which you will have to manually clean later)
9. double click the copied dialog option (it will be the one without the asterisk)
7. The topic text should read "i'd like to make an investment in your business" - Go down to the Conditions box and look for GetGlobalValue
8. double click this line and change Global to the same variable you created in step 1. click ok
9. double click on the line GetIsID. change Actor to the name of your custom NPC merchant. click ok. click ok on the topic edit window to back out to the player dialog.
10. Under topics on the left side click on PerkInvestorReply2 to view the possible replies if you choose to invest in your merchant.
11. scroll through the list and look for your original merchant's reply (for example if you cloned Alvor, look for Alvor's reply)
12. Duplicate this reply entry (again, warning - this will create a dirty edit which you will have to clean later)
13. double click on the copied reply entry (it will be the one without the asterisk)
14. change GetIsID to you custom NPC like we did in step 9. click ok
15. At the bottom of the window under Script Name, right click on the script and select edit source
16. Look for the line that says PerkInvestorAlvorGV.value=http://forums.bethsoft.com/topic/1344887-tutorial-video-creating-a-merchant-npc/0 and change the Alvor part to your NPC's name (make sure there are no spaces, and keep the exact same format).
17. do the same at the bottom of the script where it says globalvariable Property
18. go to File > save (note you will have to include this script in your bsa if you want to publish this mod)
19. back in the edit window find the box under End: > Papyrus Fragment.
20. inside that box change Alvor to the NPC name like you did in step 16. press compile (you should get no warnings or anything if you did this right).
21. Click OK to back out of the topic info edit window.
22. click ok and save your esp.
Testing: you need to test this with a character that does not already have the perk. there is a glitch in the game related to merchants that doesnt update global variables. unfortunately if you distribute this mod, your NPC may possibly be broken to people who are using an existing save game that already has the perk unlocked.
when the script runs through the conditions it will check the variable value that is stored in the save game file and this will be totally messed up if your mod loads into a previously saved game with changed globals. This is a skyrim error, not a mod error. a workaround to this is to create a brand new character and visit that merchant. the proper dialog will show up even without the perk unlocked. then exit to main menu and load your saved game. this will offset the global variable glitch and your save game should now be working. once you save your game after this, it will save the global variables with the proper values and you shouldn't have to offset it again.