WarRatsG Posted May 30, 2012 Share Posted May 30, 2012 The scripts I gave you were just fragments, meant to be combined into one big block instead of several little blocks. It's fine though, no harm done ;D One thing you should know about return though - it kills the entire script. All blocks, everything. Anything below return, whether it's in the current script block or not, will not run. Which means we have to be careful where we put it ;) If you look closely at what your script is actually doing, you will see that it is repeating the same actions in slightly different ways, with slightly different results. We need to unify these. I think the best way is like so: Scriptname DualityMagickaQuest Float fQuestDelayTime ;This is a variable recognised by the game engine, that tells the game how often to run this script. Default is every 5 seconds, which is too slow for us. Long PositiveMagic Long AntiMagic Long MagickaMax Short MagickaMod Short IsUsingAntimagic Short ChangeMagic Ref CurrentSpell Begin GameMode Set fQuestDelayTime to 0.01 ;Script runs every 0.01 seconds, or at least as close to that as possible. Essentially, every frame. 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 Set AntiMagic to MagickaMax - PositiveMagic Else ;Player is using Anti Magic Set AntiMagic to Player.GetAv Magicka Set PositiveMagic to MagickaMax - AntiMagic endif If Player.IsCasting != 0 Return Else If CurrentSpell == GetPlayerSpell Return Else 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 endif Set Changemagic to 0 End Hopefully, this will work the way you need it to. I look forward to seeing how if it does. Link to comment Share on other sites More sharing options...
Xenavire Posted May 30, 2012 Author Share Posted May 30, 2012 (edited) OK, first test and it seems to work fantastically! I also too the liberty to add stunted magicka to the player with the same script, so everything is working as intended. One minor issue though, this is broken with the use of Conduit Magicka, but I think soon I might move away from that mod and try and focus more on balancing this mod. I also still need to test it with Enhanced Hotkeys and it's autocast feature, will do that soon once I modify the spell costs on my spells to make a more noticable difference. Edit: At first look it seemed fine with Enhanced hotkeys autocast, but I hit an odd snag. It detected fine if I wanted to cast Antimagic, but casting positive magicka spell from autocast with another positive magicka spell as my active spell, it restored my magicka to max, and seemed to show a briefly swapping bar. Not sure why. The core parts that needed to work are working however and while it would be ideal to have hotkey autocasting available, I can just say in the mod description "don't use autocast". Not ready for release yet though, need to make some tweaks, like balancing out the Atronach Birthsign, add some spells, add some vendors for those spells, and possibly script some brand new spells if I can figure out how. Edited May 30, 2012 by Xenavire Link to comment Share on other sites More sharing options...
WarRatsG Posted May 30, 2012 Share Posted May 30, 2012 Oh yeah, I missed a bit of the script :/ ElseIf ChangeMagic == -1 If IsUsingAntiMagic == 1. ; see how this line fixes it? Set IsUsingAntimagic to 0 Set MagickaMod to PositiveMagic - AntiMagic Player.ModAV2 Magicka MagickaMod Endif endif Link to comment Share on other sites More sharing options...
Xenavire Posted May 30, 2012 Author Share Posted May 30, 2012 (edited) Ok, added that fix. I should have realized something was missing, it worked perfectly the opposite way. All working perfectly with Enhanced Hotkeys now! Conduit Magicka is a bit of an enigma here, I don't think we could make the mods compatible without getting the mod creators permission and incorporating into our own one. So I think we can give it a skip, as fun as that mod it. Now I just need to spend time balancing spells and placing new vendors to sell them, etc. I was still wondering if we could make an ini file that finds spells from other mods (like you put the spell ID into the ini along with the mod ID thingy, and it finds that spell and treats it as though it was part of our mod... I have seen it done to improve compatability with other mods.)Although that doesn't have to be done now, just knowing if it can be done in the future would be nice, in case I need to make changes to this mod solo. OH, before I forget, do you think we need to add support for Hud Status Bars? (So people can change the colour of thier "second magicka"). I mean I can easily figure it out without any colour changes, but people who are just trying it out might want more obvious signals. Edited May 30, 2012 by Xenavire Link to comment Share on other sites More sharing options...
WarRatsG Posted May 30, 2012 Share Posted May 30, 2012 You keep saying "we" - its your mod mate, you can take it whatever direction you want. Im just here to help out 8) You dont need to merge for compatibility, you just need to see how its code works. Once you (or me) can figure out what where when why and how it does stuff, you can adapt your script to be compatible. To add in specific spells like that, you will need an array. Ugh, I hate arrays. Support for HUD bars is easy enough - just take the template they give and fill out the info. Positioning is a little trial and error but thats alright.I think it would be cool to position it over the top of the original magic bar. Then set its display flag to IsUsingAntiMagic, and the colour of your magic bar will "change colour". That said, just to really get the message across, in your script, call "message "you are now using anti magic" " Link to comment Share on other sites More sharing options...
Xenavire Posted May 30, 2012 Author Share Posted May 30, 2012 (edited) I say "we" because you supplied a hell of a lot more code than I did! I think hard work should be acknowledged, I mean it is fine to say "I wish I had an endless bag of chips", but if someone actually MAKES an endless bag of chips, you don't give credit to the lazy bastard who said it because he was too lazy to get up and go get another one. As for Conduit Magicka, I don't want to go cannibalizing it without permission, and I don't know if we can work around it and it's own shortcomings. But if we could make it compatible, I would be a happy chap. Work for another day though. I need to go figure out how to get Hud Status Bars working then, to test out the colour change.And a message should be freaking simple, gonna add that now. EDIT: Message is working perfectly, makes for a fun time with the autocast though. "Antimagicka Enabled" "Cast AM-Flame Strike" "Magicka Enabled" all after each other. Looks quite comical. EDIT2: Can't figure out how to work Hud Status Bars right now, I think I am missing a piece of information about how to set it up. Also no idea how I should set it to hide/unhide. Edited May 30, 2012 by Xenavire Link to comment Share on other sites More sharing options...
WarRatsG Posted May 30, 2012 Share Posted May 30, 2012 (edited) Back when I used BIE, I messed around with it's HUD status bar. This was what I found worked best: set tnoHSB.hud_color to sv_Construct "HUDcolorRed*(PCVampire > 0)" set tnoHSB.hud_val to sv_Construct "vampire.blood" set tnoHSB.hud_max to sv_Construct "vampire.maxBlood" set tnoHSB.hud_min to sv_Construct "0" set tnoHSB.hud_size to 100 set tnoHSB.hud_x to HUDbars ; Same x pos as standard bars set tnoHSB.hud_y to 97.3 set tnoHSB.updateInterval to 1 SetStage tnoHSB 10 ; Init status bar BIE So I think you could tweak it about a bit. This may work... set tnoHSB.hud_color to sv_Construct "HUDcolor<colour>*(<name of quest>.IsUsingAntiMagic > 0)" ;Use whatever colour set tnoHSB.hud_val to sv_Construct "Player.GetAv Magicka" set tnoHSB.hud_max to sv_Construct "<name of quest>.MaxMagicka" set tnoHSB.hud_min to sv_Construct "0" set tnoHSB.hud_size to 100 ;Same size I think as standard bars. set tnoHSB.hud_x to HUDbars ; Parallel to standard bars. set tnoHSB.hud_y to 97.3 ; Right above standard bars I think. set tnoHSB.updateInterval to 1 SetStage tnoHSB 10 ; Init status bar Duality Magicka Deleting the line about Hud_size may just set the bar to the default bar size, but I remember hitting some kind of snag with that. Also, swap anything within < > with whatever applies to you. Edited May 30, 2012 by WarRatsG Link to comment Share on other sites More sharing options...
Xenavire Posted May 30, 2012 Author Share Posted May 30, 2012 I am having a few issues with this sadly. I tried the script name, and the quest name that runs the script, and I can't get it to work right. This is most likely my ineptitude with Hud Status Bars, but I cannot figure out what I am doing wrong. set tnoHSB.hud_color to sv_Construct "HUDcolorPink*(DualityMagickaQuest.IsUsingAntiMagic > 0)" ;Use whatever colour set tnoHSB.hud_val to sv_Construct "Player.GetAv Magicka" set tnoHSB.hud_max to sv_Construct "DualityMagickaQuest.MaxMagicka" set tnoHSB.hud_min to sv_Construct "0" set tnoHSB.hud_size to 100 ;Same size I think as standard bars. set tnoHSB.hud_x to HUDbars ; Parallel to standard bars. set tnoHSB.hud_y to 97.3 ; Right above standard bars I think. set tnoHSB.updateInterval to 1 SetStage tnoHSB 10 ; Init status bar Duality Magicka Link to comment Share on other sites More sharing options...
WarRatsG Posted May 30, 2012 Share Posted May 30, 2012 Honestly, I'm not too sure how it works either. It's definitely the name of the quest, not the script - that's true for all cross variable scripting. I don't know much else about HUD bars though... Btw, you are adding this to the HUD status bar ini right? Link to comment Share on other sites More sharing options...
Xenavire Posted May 30, 2012 Author Share Posted May 30, 2012 (edited) Yeah, at the bottom of the ini, just underneath the other statusbar entries. I can't be sure what is missing, to me it looks like it should work... I will try moving the X and Y a bit incase it is being layered behind somehow. EDIT: Interestingly, it shows up for a split second, then dissapears... Gonna toy around with it a bit, it hasn't been showing up when I swap magicka types though. Edited May 30, 2012 by Xenavire Link to comment Share on other sites More sharing options...
Recommended Posts