MaximillionBhalti Posted July 23, 2010 Share Posted July 23, 2010 Alright. I'm a new modder that is trying to make an amulet that, while worn on the PC, detects when an NPC (not a creature) dies in it's radius and adds a custom soul gem to the PC's inventory. I have the script for the gem figured out, but the amulet is giving me trouble. I tried on the Bethesda Forums and got nothing. I also don't know whether to use an Item Script on an Enchantment Script on the amulet, but I have tried both. Here is my script so far. (enchantment script). scn "AASoulCageABILITYSCRIPT" ref NPCshort hesdead begin scripteffectupdate set NPC to getFirstRef 35 while NPC if hesdead == 0 if getdead NPC == 1 player.additem AASoulCageCapturedSoulITEM 1 message "You captured a soul with the Soul Cage." set hesdead to 1 endif endif set NPC to getnextref loopend Thanks for the help in advance! Link to comment Share on other sites More sharing options...
slygothmog Posted July 23, 2010 Share Posted July 23, 2010 (edited) Use an object script on the Amulet...you can then add enchantment to boost player stats, reistances etc scn "AASoulCageABILITYSCRIPT" ref NPCshort hesdead begin gamemode set NPC to 0set NPC to player.getfirstref 69 1 while NPC != 0if isformvalid NPC == 1if NPC.getdead == 1 && hesdead == 0player.additem AASoulCageCapturedSoulITEM 1message "You captured a soul with the Soul Cage."set hesdead to 1endifendif set NPC to 0set NPC to getnextref loop end This will only happen once unless you add an extra command to return hesdead to 0 Lets say you are fighting 3 Bandits, you kill one you get the soul, then thats it..you will not recieve it again with the hesdead variable set to 1. I know a nifty little way to get the soul with each death without it being added repeatedly. Edited July 23, 2010 by slygothmog Link to comment Share on other sites More sharing options...
MaximillionBhalti Posted July 23, 2010 Author Share Posted July 23, 2010 Thank you for the reply. I'm interested in the method in your last sentence. Link to comment Share on other sites More sharing options...
slygothmog Posted July 23, 2010 Share Posted July 23, 2010 just need to sort something, will be back in a min with the method. Link to comment Share on other sites More sharing options...
slygothmog Posted July 23, 2010 Share Posted July 23, 2010 scn "AASoulCageABILITYSCRIPT" ref NPC begin gamemode set NPC to 0set NPC to player.getfirstref 69 1 while NPC != 0if isformvalid NPC == 1if NPC.getdead == 1 && NPC.getav strength >= 2player.additem AASoulCageCapturedSoulITEM 1message "You captured a soul with the Soul Cage."NPC.modav strength -100endifendif set NPC to 0set NPC to getnextref loop end Their strength will always be above 2, so you will recieve a soul from the dead one just once, reducing their strength to 0 is immeterial...they are dead, and will not give you a further soul as this will reduce their strength to 0 and that NPC will then be discounted. Link to comment Share on other sites More sharing options...
slygothmog Posted July 23, 2010 Share Posted July 23, 2010 (edited) Just rememberd....if anyone dies in your location you will auto recieve the soul...extra condition will need to be placed to ensure only evil NPC souls are colleced. Oh and change... message "You captured a soul with the Soul Cage." to this. messageex "You captured a soul with the Soul Cage." Edited July 23, 2010 by slygothmog Link to comment Share on other sites More sharing options...
MaximillionBhalti Posted July 23, 2010 Author Share Posted July 23, 2010 Thank you so much for your help! I have one more question (for now ;) ). Can I make it so that it only captures souls in a certain radius around my PC, say, 20 meters? Link to comment Share on other sites More sharing options...
slygothmog Posted July 23, 2010 Share Posted July 23, 2010 scn "AASoulCageABILITYSCRIPT" ref NPC begin gamemode set NPC to 0set NPC to player.getfirstref 69 1 while NPC != 0if isformvalid NPC == 1if NPC.getdead == 1 && NPC.getdistance player < 900 && NPC.getav strength >= 2player.additem AASoulCageCapturedSoulITEM 1messageex "You captured a soul with the Soul Cage."NPC.modav strength -100endifendif set NPC to 0set NPC to getnextref loop end I hope I get a Kudo for all of this. 900 is a guess, you will need to play around with this value to get the result you desire. Link to comment Share on other sites More sharing options...
MaximillionBhalti Posted July 24, 2010 Author Share Posted July 24, 2010 Kudo given. Thank you so much for helping me. I would probably have never figured it out on my own. Link to comment Share on other sites More sharing options...
slygothmog Posted July 24, 2010 Share Posted July 24, 2010 A pleasure to help Maximillion :thumbsup: Good luck with your mod ( send me a PM when you upload ) and thanks for the kudo :thumbsup: :biggrin: :smile: Link to comment Share on other sites More sharing options...
Recommended Posts