Kohdi Posted November 9, 2012 Share Posted November 9, 2012 Hey all, I've got yet another scripting question for you. I'm trying to make an amulet which, by its enchantment, senses when the player gets below a certain health percentage, then activates a few beneficial effects. I'd like the amulet to change its appearance during this time to an identical model with a glow map, but the amulet needs to remain the same object or the enchantment-script will be interrupted. The only workaround I can think of is if there is a way to modify an armor object's ArmorAddon properties via script, which would allow me to take out or switch the non-glowing with the glowing (I'm not going to sweat the inventory model). Any suggestions? Link to comment Share on other sites More sharing options...
Grimoa Posted November 9, 2012 Share Posted November 9, 2012 Uneducated guess: Can you use a second object with an identical but - apart from a glow map - completely transparent mesh which is addiitionally equipped to the character in one of the unused slots? I know it's not what you asked for but I just thought I share a spontaneous idea. Sorry if you already tried that. Link to comment Share on other sites More sharing options...
KingsGambit Posted November 9, 2012 Share Posted November 9, 2012 There's no way to change the armoraddon via script. There are a couple of other workarounds you may consider however. Both use a 2nd model of the amulet with the changes you want made. You can move the enchantment effect to an ability on the player, added during OnEquip of the first model. This ability can monitor global variables set by the 1st amulet.You can use global variables for temporary storage of float values inbetween the change.If you know the state the enchantment script will be in at the point the interruption would occur, it should be quite easy for the 2nd one to pick up where the 1st left off as it were. Along the lines of. 1st AmuletOnEquipStuff OnUnequipStop stuffSet Global Variable to x 2nd AmuletOnEquipIf (global variable == x)Carry on with stuffelsedo other stuff I think the first approach I suggested should work. There will be no interruption to the script and you can freely manipulate the ability with either amulet and global variables. If you don't mind giving away a little about script, what function is it running that cannot be interrupted? Is it a graphical sequence? Link to comment Share on other sites More sharing options...
Kohdi Posted November 10, 2012 Author Share Posted November 10, 2012 Thanks for the suggestions, I think what I'll try to do is make the inactive amulet run the script to check the player's health, then if the percentage is reached it will switch to the active, glowing amulet which will have the actual magic effects, which can switch itself back out when it's done working. The reason I was trying to keep the same amulet equipped was because the script runs out of an enchantment, and if the amulet is unequipped, the enchantment-script will no longer run. The enchantment itself is a modified version of the Kohnariik mask, without the dragon priest summoning and with a magic drain applied to the player (this works pretty well). Link to comment Share on other sites More sharing options...
KingsGambit Posted November 10, 2012 Share Posted November 10, 2012 Forgive me if I oversimplify or miss something, but from the looks of it, the values that need to be monitored are health and magicka. You can use two global variables as temporary storage during the change over. 1st amulet:OnEquipDrain MagickaIf Current Health Percentage <= ThresholdGlobal Variable 1 = Current HealthGlobal Variable 2 = Current MagickaForce add and equip 2nd AmuletRemove 1st amulet from inventory 2nd AmuletOn EquipSet wearer's health to GV1Set wearer's magicka to GV2Drain MagickaSpecial Enchantmentif Current Health Percentage > ThresholdForce add and equip 1st AmuletRemove 2nd amulet from inventory OnUnequipRemove 2nd amulet from inventory and add 1st amulet to inventory It may not even be necessary to use GVs to store the values as the change will be very fast. Assuming the special voodoo actually going on only happens below the threshold as with the mask you mention, that part can be left solely on the 2nd amulet. Link to comment Share on other sites More sharing options...
Kohdi Posted November 11, 2012 Author Share Posted November 11, 2012 That's essentially what I did, and after some frustrated script finagling and tweaking to visual effects, the amulet is working beautifully. Thanks for your help! Now I just need to write the owner's journal... Link to comment Share on other sites More sharing options...
Recommended Posts