Xenavire Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) So in the CS I can make all the Antimagic ATMG (example) and check for that in the script? And they would have to be the first 4 letters all the time? Or would all the spells need a unique one, making the script check for each unique one? (This would require a lot of lines of script right? And large edits any time I would add a spell or ten.) If this is the case, could I have this done in an ini? (So if other people make additions to my mod it can be easily added). It is good to know I don't have to restrict the player completely. It is hardly fair to expect them to burn all thier magicka at the start of a combat on attacking spells and then make them run around casting random junk from other scools to regenerate thier magicka. If I don't need that dummy script I shall go remove it and see about fixing my other issues for now. EDIT: Having some issues finding the right terminology for finding the ID. I tried GetIsID but that seems to only work with items, and I dont think I need GetMagicEffectName, so finding what I do need is a pain in the butt. Currently looks like this:Scriptname DualityMagicka Begin GameMode If Player.IsCasting != 0 Return Elseif Player.IsCasting == 0 GetPlayerSpell If GetIsID ATMG01 Endif Endif End Edited May 29, 2012 by Xenavire Link to comment Share on other sites More sharing options...
WarRatsG Posted May 29, 2012 Share Posted May 29, 2012 (edited) Making new spell effects is impossible, although I think its possible to edit old ones in certain ways. Generally though, this is avoided.Instead you may just have to refer to each spell by name. Should look something like this.. Set CurrentSpell to GetPlayerSpell If CurrentSpell == <editor id of some spell> set IsUsingAntiMagic to 1 ElseIf CurrentSpell == <another editor id of another spell> set IsUsingAntiMagic to 1 Else Set IsUsingAntiMagic to 0 Endif In your script, make sure you set GetPlayerSpell to a Ref variable, then always refer explicitly to the variable where needed. Edited May 29, 2012 by WarRatsG Link to comment Share on other sites More sharing options...
Xenavire Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) That makes a lot more sense than what I was trying to do... I think soon I will have 90% of the errors out of this section of script, than I have to work exclusively on the restore magicka if part. If all goes REALLY well, I should be able to alpha test this in a few days.Currently to be completed:Figuring out how to work the script to restore magicka instead of draining it while casting Antimagicka spells.Figuring out how to make this work with Hud Status Bars (and bug test with Expanded Hotkeys).Checking with other mods (Including Conduit Magicka). Still a lot to do, but things are falling into place all thanks to you WarRatsG! EDIT: I must be missing something again haha, it says IsUsingAntimagic is an unknown variable and CurrentSpell is an unknown command. Edited May 29, 2012 by Xenavire Link to comment Share on other sites More sharing options...
WarRatsG Posted May 29, 2012 Share Posted May 29, 2012 First off, currentspell and IsUsingAntiMagic are variables. To use them, you must first declare them. Variables are declared like this. Scn name Short MyShort Float MyFloat Ref MyRef Begin GameMode MyShort, MyFloat and MyRef are all variables.Currentspell is a Ref. The other one is a short. And remember what I said about how to use antimagic? Instead of making it add to your magic, you just set your current magic level to your anti magic level. Then just let it take magic off of you like the game normally would. When you change back to positive magic, just set your magic level to the positive magic level and again, let the game take magic off you as you cast spells. Link to comment Share on other sites More sharing options...
Xenavire Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) Ok, I had seen those references before and it kept bugging me that I didn't have any yet. I will add them now, which, if my quick asessment is correct, will complete that section of script for now. And no, I did NOT forget what you said, I remember quite clearly what you suggested because it was BRILLIANT, it is just putting that into script will take a bit of figuring out for me. EDIT: A few seconds of modifying things and it successfully saved. Now to move onto the core of the script that focuses on If IsUsingAntimagic == 0. That is the part I need to figure out, swapping it to restore magicka only if antimagicka is used... I have 2 test spells, so once I can get the core done, I can add it to my player in the console and see if it works. (I need to slot in stunted magicka too, not sure where I need to put that.) Edited May 29, 2012 by Xenavire Link to comment Share on other sites More sharing options...
Xenavire Posted May 29, 2012 Author Share Posted May 29, 2012 OK, while trying to figure out how to temporarily store the magicka cost as a reference/variable I have hit a snag... I don't know how to do it. Without it as a reference/variable I am not sure how I am meant to tell the script how to compare it to max magicka minus current magicka... Well here is what I have so far. Scriptname DualityMagicka Short IsUsingAntimagic Long AntiMagickaCost Ref CurrentSpell Begin GameMode If Player.IsCasting != 0 Return Elseif Player.IsCasting == 0 Set CurrentSpell to GetPlayerSpell If CurrentSpell == ATMG01 set IsUsingAntimagic to 1 Elseif CurrentSpell == ATMG02 set IsUsingAntimagic to 1 Else Set IsUsingAntimagic to 0 Endif If IsUsingAntimagic == 0 Return Elseif IsUsingAntimagic == 1 GetSpellMagickaCost CurrentSpell SetSpellMagickaCost AntiMagickaCost to CurrentSpell Endif Endif End Link to comment Share on other sites More sharing options...
WarRatsG Posted May 29, 2012 Share Posted May 29, 2012 (edited) I did NOT forget what you said, I remember quite clearly what you suggested because it was BRILLIANT, it is just putting that into script will take a bit of figuring out for me. When you where saying "restore magicka", it gave me the wrong impression. My apologies. OK, while trying to figure out how to temporarily store the magicka cost as a reference/variable I have hit a snag... I don't know how to do it. Without it as a reference/variable I am not sure how I am meant to tell the script how to compare it to max magicka minus current magicka... Well here is what I have so far. Scriptname DualityMagicka Short IsUsingAntimagic Long AntiMagickaCost Ref CurrentSpell Begin GameMode If Player.IsCasting != 0 Return Elseif Player.IsCasting == 0 Set CurrentSpell to GetPlayerSpell If CurrentSpell == ATMG01 set IsUsingAntimagic to 1 Elseif CurrentSpell == ATMG02 set IsUsingAntimagic to 1 Else Set IsUsingAntimagic to 0 Endif If IsUsingAntimagic == 0 Return Elseif IsUsingAntimagic == 1 GetSpellMagickaCost CurrentSpell SetSpellMagickaCost AntiMagickaCost to CurrentSpell Endif Endif End Don't forget, GetSpellMagickaCost requires an actor reference to calculate the cost of the spell for that actor. In other words, "Player.GetSpellMagickaCost CurrentSpell" If you ask me, a better way would be to simply get the level of antimagic through inference.By calling "Player.GetAv Magicka" you can get the players current magicka.I'm not entirely sure, but I think this will get you the player's maximum magicka... Long MaxMagicka Begin GameMode Set MaxMagicka to (Player.GetBaseAv Magicka) + (Player.GetAvMod Magicka max) + (Player.GetAvMod Magicka script) I base that off of this quote from the CS wiki about actor values: Current Value = Calculated Base Value + Max Modifier + Script Modifier + Damage Modifier From the information there, I think Base, max and script modifiers set your maximum magicka, while damage is the amount used up.I got the idea about getAvMod from a script that someone called SkyLine made for me when I was still kind of a rookie. This was what the OBSE documentation says about it: GetAVMod - returns one of the calling actor's modifiers for the specified actor value. The modifier is specified as a string: "script" refers to the script (or "offset") modifier applied by the script versions of ModAV and ForceAV; "max" refers to the modifier applied by magic effects like feather, drain, and fortify; and "damage" refers to that applied by effects like damage and restore, and by the console version of ModAV/ForceAV as well as ModAV2.(modifierValue:float) ref.GetAVMod actorValueName:string whichModifier:string(modifierValue:float) ref.GetAVModC actorValueCode:int whichModifier:string I think you can see where this is going. You can calculate anti magic like this: Long PositiveMagic Long AntiMagic Long MagickaMax Short IsUsingAntiMagic Begin GameMode Set MagickaMax to (Player.getBaseAv Magicka) + (Player.GetAVMod Magicka Max) + (Player.GetAvMod Magicka Script) If IsUsingAntiMagic == 0 ;Player is using positive magic Set PositiveMagic to Player.GetAv Magicka ;Positive magicka remaining == magicka remaining Set AntiMagic to MagickaMax - PositiveMagic ;It's the only logical inference Else ;Player is using Anti Magic Set AntiMagic to Player.GetAv Magicka ;AntiMagic remaining == Magicka Remaining Set PositiveMagic to MagickaMax - AntiMagic ;Again, it's the only logical inference endif ;;;;Continue Even I've learned quite a bit from this 8) Edited May 29, 2012 by WarRatsG Link to comment Share on other sites More sharing options...
Xenavire Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) OK, I think I understand what you have done to set flexible values to those variables... Now I need to translate those into the adding Magicka effect when using antimagicka? So tricky haha, glad I have someone so knowledgeable to help! *goes to search for a way to restore magicka on-use* Edit:... Looking at this, I am a little confused. Is this making the game do what I am just realizing it looks like it is doing? This is hard to explain, but in this state it looks like I could already put this script into testing... I just need to know if right now it will already "create" Magicka on casting an antimagicka spell. Also, if it is done, how do I implement it ingame? With a quest, or does it require something else? Edited May 29, 2012 by Xenavire Link to comment Share on other sites More sharing options...
WarRatsG Posted May 29, 2012 Share Posted May 29, 2012 I still don't think you understand - you do not need to make anti magic "restore" your current magicka. I think the best way to switch between them would be something like this. I hope your maths is up to scratch :tongue: This is just an "excerpt", if that makes sense. This just builds on my last script... Short MagickaMod ;How much Magicka is changed by Begin GameMode ;;;;IsUsingAntiMagic flag has just been set to 1. We have to switch from Positive Magicka to AntiMagicka... Set MagickaMod to AntiMagicka - PositiveMagicka Player.ModAv2 Magicka MagickaMod ;;;Continue... ;;;IsUsingAntiMagic flag has just been set to 0. We have to switch from AntiMagicka to PositiveMagicka... Set MagickaMod to PositiveMagicka - AntiMagicka Player.ModAv2 Magicka magickaMod ;;;Continue... I will show you a "paper test" for this one, to show you that it works. By that, I mean instead of using variables, we substitute them for real numbers to see if it makes sense. Test APositiveMagicka = 30AntiMagicka = 70Current Magicka = 30 (equal to positive magicka)Flag has just been set to 1. Magicka Mod = 70 - 30 = 40Current Magicka = 30 + 40Current Magicka = 70 (now equal to anti magicka) Test BPositiveMagicka = 20AntiMagicka = 80CurrentMagicka = 80 (equal to anti magicka)Flag has just been set to 0 Magicka Mod = 20 - 80 = -60Current Magicka = 80 + (-60)Current Magicka = 20 (equal to Positive Magicka) To let the script know that the flag has changed, another variable (we will call it ChangeMagic) is needed. Whenever it is set to 1, then you will switch to anti magic. When it is set to -1, you will switch to positive magic. At 0, your spell has not changed. This is to make sure that values aren't mucked up for no reason. In an example script, just to show you what I mean: Short IsUsingAntiMagic Short ChangeMagic Begin GameMode If CurrentSpell != GetPlayerSpell Set CurrentSpell to GetPlayerSpell If CurrentSpell == <an anti magic spell> Set ChangeMagic to 1 ElseIf CurrentSpell == <another Anti magic spell> Set ChangeMagic to 1 Else Set ChangeMagic to -1 endif If ChangeMagic == 1 If IsUsingAntiMagic == 0 Set IsUsingAntiMagic to 1 Set MagickaMod to AntiMagicka - PositiveMagicka Player.ModAv2 Magicka MagickaMod endif ElseIf ChangeMagic == -1 If IsUsingAntiMagic == 1 Set IsUsingAntiMagic to 0 Set MagickaMod to PositiveMagicka - AntiMagicka Player.ModAv2 Magicka MagickaMod endif endif Set ChangeMagic to 0 endif Am I making sense? Link to comment Share on other sites More sharing options...
Xenavire Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) Sorry this reply took so long, I lost my focus and had to take a break. Now I feel fresh and my focus is back, and I get this a LOT better than before. In fact I understand the whole thing a lot better, including your intentions on the magicka. Instead of ading magicka on-cast, you never bother with that at all, right? Instead you use the SetAV Magicka to tell it the new magicka amount to use, which will swap and work dynamically, rather than trying to force the game to restore magicka insttead of using it. IF you have given me enough info, I may be able to get very close to completing this by the weekend. Edit:Not quite a copy-paste, but you would barely notice to look at it! However this is currently the whole script:Scriptname DualityMagickaQuest Long PositiveMagic Long AntiMagic Long MagickaMax Short IsUsingAntimagic Short MagickaMod Short ChangeMagic Ref CurrentSpell Begin GameMode If Player.IsCasting != 0 Return Elseif Player.IsCasting == 0 Set CurrentSpell to GetPlayerSpell If CurrentSpell == ATMG01 set IsUsingAntimagic to 1 Elseif CurrentSpell == ATMG02 set IsUsingAntimagic to 1 Else Set IsUsingAntimagic to 0 Endif Endif End Begin GameMode Set MagickaMax to (Player.getBaseAv Magicka) + (Player.GetAVMod Magicka Max) + (Player.GetAvMod Magicka Script) If IsUsingAntiMagic == 0 ;Player is using positive magic Set PositiveMagic to Player.GetAv Magicka ;Positive magicka remaining == magicka remaining Set AntiMagic to MagickaMax - PositiveMagic ;It's the only logical inference Else ;Player is using Anti Magic Set AntiMagic to Player.GetAv Magicka ;AntiMagic remaining == Magicka Remaining Set PositiveMagic to MagickaMax - AntiMagic ;Again, it's the only logical inference endif End Begin GameMode If CurrentSpell != GetPlayerSpell set CurrentSpell to GetPlayerSpell If CurrentSpell == ATMG01 Set ChangeMagic to 1 ElseIf CurrentSpell == ATMG02 Set ChangeMagic to 1 Else Set ChangeMagic to -1 Endif If ChangeMagic == 1 If IsUsingAntimagic == 0 Set IsUsingAntimagic to 1 Set MagickaMod to AntiMagic - PositiveMagic Player.ModAV2 Magicka MagickaMod endif ElseIf ChangeMagic == -1 Set IsUsingAntimagic to 0 Set MagickaMod to PositiveMagic - AntiMagic Player.ModAV2 Magicka MagickaMod Endif Endif Set Changemagic to 0 End Edited May 29, 2012 by Xenavire Link to comment Share on other sites More sharing options...
Recommended Posts