AxlRocks Posted August 4, 2009 Share Posted August 4, 2009 Hi, I'm sorta new here, first post, but I've been modding for a little while now. However, I'm doing a mod that I'm having trouble with. Basically, I'm trying to make a set of potions that will be found in mines/caves/ruins as a reward for dungeon divers, rather than just the usual dungeon's worth of generic loot. (Not my idea by the way, someone on UESP's) I will have three sets, 10 in each, and each set will increase either your health, fatigue, and magicka by a certain amount when you drink each potion. So, for example, one health elixir will increase your health by lets say 20, the second will do the same, so, therefore, you've 40 more health. I have these increases set up as abilities rather than just directly modifying the health, magicka, or fatigue amounts, since those are more complicated to modify directly. So each potion is supposed to add a new ability. Example: Potion/elixir 1 = Fortify Health 20 Points (This is called AXRDivineHealth)Potion/elixir 2 = Fortify Health 40 Points (This is called AXRDivineHealth2) In my mod, the script is set up like this: (Not the whole thing, it descends from 10 down to this, but the third one (which this starts with) starts the error.Begin ScriptEffectStart If ( Player.removespell AXRDivineHealth2 ) - ** player.addspell AXRDivineHealth3 player.removespell AXRDivineHealth Endif If ( player.removespell AXRDivineHealth ) - * player.addspell AXRDivineHealth 2 Endif Player.addspell AXRDivineHealth End * - These two lines work right, I get 40 fortify health from the second ability (AXRDivineHealth2) and the other goes away. (This will occur on your second potion)** - I get the replacement from these three lines of code, except instead of having just 60 fortify health points, I've 80, because it adds AXRDivineHealth again. (This will occur on your third potion) The script always, always works correctly till the third potion. After 10 potions, I do not get 200 points of fortify health, I get more because it ends up adding more copies and stacking them in the active spells menu. What can I do to make this script actually replace the spell each time, so in the end, after dungeon diving and finding all 10 potions, there are truly 200 points of fortify health on your character? I can send the current ESP to someone if that'd help and I'll point out where everything is in it, please help and sorry for so much text. This thing is driving me crazy. :wallbash: :thanks: AxlRocks Link to comment Share on other sites More sharing options...
Vagrant0 Posted August 4, 2009 Share Posted August 4, 2009 The If ( Player.removespell AXRDivineHealth2 )Part is likely the cause. This is incorrect usage of the function since while it will return 1 if that spell is removed, it will always return a 0 if that spell is not in place, but another one is. This can lead to some logic issues. Instead, you would probably be better off just using a chain of conditions based off IsSpellTarget or, better yet, using a remove script, such as a quest script, or token, to just keep tally. In otherwords, something likebegin scripteffectstart if player.isspelltarget <ability 4> message "You can gain no further benefit from this kind of potion" return elseif player.isspelltarget <ability 3> player.removespell <ability 3> player.addspell <ability 4> return elseif player.isspelltarget <ability 2> player.removespell <ability 2> player.addspell <ability 3> return elseif player.isspelltarget <ability 1> player.removespell <ability 1> player.addspell <ability 2> return elseif player.isspelltarget <ability 1> != 1 player.addspell <ability 1> return endif end Link to comment Share on other sites More sharing options...
Recommended Posts