xcube2402 Posted February 16, 2012 Share Posted February 16, 2012 (edited) Hello, I'm not sure, but there may already be a similar question about this. Sorry if I'm posting up a question that has already been answered. I'm creating a toggle buff script, along with damage magicka (instead of using up magicka to use spell, you lose it over time) and stunted magicka (to prevent player from regenerating magicka while the buff is up), but the problem I'm having is that I can't get the condition in the script to detect the player's remaining magicka as 0 in order to deactivate the spell other than reusing the same spell. What command am I supposed to use in order to get this done? Edited February 16, 2012 by xcube2402 Link to comment Share on other sites More sharing options...
WarRatsG Posted February 16, 2012 Share Posted February 16, 2012 My guess is that the script will not detect it because magicka isn't as 0 for long enough for the script to notice. First thing you can do is change the "==" to "<=". The evaluation should now pass if magicka goes to 0 or less (which I'm not sure is possible anyway, but it's a first step). Also, make sure that the evaluation is in the ScriptEffectUpdate block of the spell. This block will run every frame for the entire duration of the spell, whereas the other blocks will only run once. Thats all I can think of just now. If that doesn't work then post your script - maybe there is a little logic error hiding in all the code. Link to comment Share on other sites More sharing options...
xcube2402 Posted February 17, 2012 Author Share Posted February 17, 2012 (edited) * I could change "==" to "<=" since there has been some occurrence of having a negative value for health, magicka, and fatigue. * I used "ScriptEffectUpdate" like you said, but it still doesn't read the player's remaining magicka. Could I have done something wrong in the script? * I think the problem is the "GetActorValue" command, but I can't find any other command that would match what I'm looking for. Scriptname Togglebreathscript Begin ScriptEffectStart If ( IsSpellTarget Togglebreath == 0 ) addSpell Togglebreath else removeSpell Togglebreath endifEnd Begin ScriptEffectUpdate if (GetActorValue Magicka <= 0 ) removespell Togglebreath endifEnd * Thanks for your help WarRatsG Edited February 19, 2012 by xcube2402 Link to comment Share on other sites More sharing options...
HeyYou Posted February 17, 2012 Share Posted February 17, 2012 Doesn't addspell, and IsSpellTarget require a reference to act upon? Maybe running a short routine to set "Target" (ref variable) to spell target, and doing: Target.IsSpellTarget..... etc..... Link to comment Share on other sites More sharing options...
xcube2402 Posted February 17, 2012 Author Share Posted February 17, 2012 (edited) You will need to change "Togglebreath" to another spell, since that is the editor ID of a spell I created while working on the script. The ScriptEffectUpdate section doesn't do anything when I tested the script out, since I don't know what I can do in order to detect the player's remaining magicka. Edited February 17, 2012 by xcube2402 Link to comment Share on other sites More sharing options...
WarRatsG Posted February 18, 2012 Share Posted February 18, 2012 * I could change "==" to "<=" since there has been some occurrence of having a negative value for health, magicka, and fatigue.Begin ScriptEffectUpdate if (GetActorValue Magicka == 0 ) removespell Togglebreath endifEnd Make sure you change it to GetActorValue Magicka <= 0 And trust me, there is nothing wrong with the GetActorValue command. Doesn't addspell, and IsSpellTarget require a reference to act upon? If no reference is given, a function will act on the calling object. For an object, this is the object being scripted; for a magic effect, this is the NPC that has been hit by the spell. Quests always require references. Link to comment Share on other sites More sharing options...
xcube2402 Posted February 19, 2012 Author Share Posted February 19, 2012 (edited) Sorry, forgot to change the symbol to "<=" in the post. The part of deactivating the spell effect when the player's magicka is not working when all of the player's magicka is gone, since it reads the player's maximum magicka instead. If I can get drain magicka effect to accumulate over time like damage magicka, then the script should work perfectly, but I'm not sure what can be done to get that accomplished. - Sorry about doubting GetActorValue, since it does work, but only with the player's maximum magicka. Edited February 19, 2012 by xcube2402 Link to comment Share on other sites More sharing options...
WarRatsG Posted February 21, 2012 Share Posted February 21, 2012 (edited) Sorry, forgot to change the symbol to "<=" in the post. The part of deactivating the spell effect when the player's magicka is not working when all of the player's magicka is gone, since it reads the player's maximum magicka instead. If I can get drain magicka effect to accumulate over time like damage magicka, then the script should work perfectly, but I'm not sure what can be done to get that accomplished. Drain magicka will not accumulate, unless you manually alter it's magnitude with script (requires OBSE)Unless you add several Drain Magicka spells to the target over time, which I personally would not recommend. You would be better off using Damage Magicka. - Sorry about doubting GetActorValue, since it does work, but only with the player's maximum magicka. Not quite - your thinking of GetBaseActorValue. Here is a quote from the CS Wiki on GetActorValue: "Returns the current, modified value of the specified stat." Hope this helps :) Edited February 21, 2012 by WarRatsG Link to comment Share on other sites More sharing options...
Recommended Posts