InAComaDial999 Posted March 29, 2016 Share Posted March 29, 2016 Okay, I'm almost certain there's a way to do this, but I've already spent over an hour trying to figure out how so... How would you apply an enchantment to an item with a script? SKSE has the SetEnchantment function for that. There is no function to do that in vanilla, however. Link to comment Share on other sites More sharing options...
avenger404 Posted March 29, 2016 Share Posted March 29, 2016 (edited) Just realized now I completely forgot to thank IsharaMeradin and Darkxenoth for their help last time, thank you so much - it works beautifully now! I wrote myself into a scripting wall again, and have no idea what's going wrong this time. The script loads with no errors, but shows no evidence of executing ingame. I'm attempting to partially override an NPC's specific combat behavior by directly using a script. To simplify I want it to equip and cast certain combat spells at varying percentages of its health as the battle goes on. Fair warning the script is quite messy, so optimization help would be greatly appreciated. Scriptname ReaperCombatScript extends ObjectReference Actor Property akCaster AutoActor Property akTarget AutoSPELL Property AvengersWrathSpell AutoSPELL Property AvengersFreezeSpell AutoSPELL Property AvengersSoulrendSpell AutoFunction Wait(float afSeconds) native globalfloat Function GetActorValuePercentage(string asValueName) nativefloat Function GetAVPercentage(string asValueName) return GetActorValuePercentage(asValueName)EndFunctionFunction EquipSpell(Spell akSpell, int aiSource) nativeFunction Cast(ObjectReference akSource, ObjectReference akTarget = None) native Event OnCombatStart(Actor akCaster, Actor akTarget)float ReaperHealth = akCaster.GetAVPercentage("Health") If akCaster.GetAVPercentage("Health")<0.8 akCaster.AddSpell(AvengersWrathSpell) akCaster.EquipSpell(AvengersWrathSpell,1) AvengersWrathSpell.cast(akTarget) akCaster.RemoveSpell(AvengersWrathSpell) Endif If akCaster.GetAVPercentage("Health")<0.75 akCaster.EquipSpell(AvengersFreezeSpell,1) AvengersFreezeSpell.cast(aktarget) Utility.Wait(1.0) akCaster.EquipSpell(AvengersSoulRendSpell,1) AvengersSoulRendSpell.cast(akTarget) Endif If akCaster.GetAVPercentage("Health")<0.6 akCaster.EquipSpell(AvengersWrathSpell,1) AvengersWrathSpell.cast(akTarget) Endif If akCaster.GetAVPercentage("Health")<0.5 akCaster.EquipSpell(AvengersFreezeSpell,1) AvengersFreezeSpell.cast(akTarget) Utility.Wait(1.0) akCaster.EquipSpell(AvengersSoulRendSpell,1) AvengersSoulRendSpell.cast(akTarget) Endif If akCaster.GetAVPercentage("Health")<0.4 akCaster.EquipSpell(AvengersWrathSpell,1) AvengersWrathSpell.cast(akTarget) Endif If akCaster.GetAVPercentage("Health")<0.25 akCaster.EquipSpell(AvengersFreezespell,1) AvengersFreezeSpell.cast(akTarget) Utility.Wait(1.0) akCaster.EquipSpell(AvengersSoulRendSpell,1) AvengersSoulRendSpell.cast(akTarget) EndifEndEvent *EDIT* - I forgot to add the addspell and removespell commands to every event. Is this necessary or not? The NPC has none of these spells normally equipped.I'm wondering if elseif's could be used instead of them all being separate events? I'm also wondering if the script should be tied directly to a quest to have a better chance of it working, or if it can be attached directly the the NPC to override its combat style all the time? If this is too big a question to post here, notify me and I'll remove this post. Should any who can help wish it, proper credit will be given if this mod ever gets uploaded. Edited March 29, 2016 by avenger404 Link to comment Share on other sites More sharing options...
Derps4Days Posted March 30, 2016 Share Posted March 30, 2016 I feel like I shouldn't even be posting in here because I'm just that new to modding beyond your run-of-the-mill follower made from a quick tutorial, but how would you set a spell to be on a certain part of the body? I don't get how I would end up editing Candlelight to summon two of itself and have them appear as a kind of overlay for the eyes. If you want more clarification, I want to do the same as I mentioned before. If you've played the MMORPG Aion as an Asmodian, you should know what I mean. If not, having glowing eyes for a follower when he is in combat, just for that one follower, then they vanish when he is no longer in combat. I have the script to have them toggle on when in combat, and off when not, but I still don't know how to edit a spell beyond making it summon an ally (or two without using the perk; I figured out that much) or hit enemies and damage them. Help? Link to comment Share on other sites More sharing options...
avenger404 Posted March 30, 2016 Share Posted March 30, 2016 I feel like I shouldn't even be posting in here because I'm just that new to modding beyond your run-of-the-mill follower made from a quick tutorial, but how would you set a spell to be on a certain part of the body? I don't get how I would end up editing Candlelight to summon two of itself and have them appear as a kind of overlay for the eyes. If you want more clarification, I want to do the same as I mentioned before. If you've played the MMORPG Aion as an Asmodian, you should know what I mean. If not, having glowing eyes for a follower when he is in combat, just for that one follower, then they vanish when he is no longer in combat. I have the script to have them toggle on when in combat, and off when not, but I still don't know how to edit a spell beyond making it summon an ally (or two without using the perk; I figured out that much) or hit enemies and damage them. Help? A little clarification as to what you still need for your desired effect would be extremely helpful. Are you working on a companion NPC or a helper you summon via conjuration or some other spell? I'm also not sure what you mean where you need a spell to do damage? Link to comment Share on other sites More sharing options...
lofgren Posted March 30, 2016 Share Posted March 30, 2016 Just realized now I completely forgot to thank IsharaMeradin and Darkxenoth for their help last time, thank you so much - it works beautifully now! I wrote myself into a scripting wall again, and have no idea what's going wrong this time. The script loads with no errors, but shows no evidence of executing ingame. I'm attempting to partially override an NPC's specific combat behavior by directly using a script. To simplify I want it to equip and cast certain combat spells at varying percentages of its health as the battle goes on. Fair warning the script is quite messy, so optimization help would be greatly appreciated. Scriptname ReaperCombatScript extends ObjectReference Actor Property akCaster AutoActor Property akTarget AutoSPELL Property AvengersWrathSpell AutoSPELL Property AvengersFreezeSpell AutoSPELL Property AvengersSoulrendSpell AutoFunction Wait(float afSeconds) native globalfloat Function GetActorValuePercentage(string asValueName) nativefloat Function GetAVPercentage(string asValueName) return GetActorValuePercentage(asValueName)EndFunctionFunction EquipSpell(Spell akSpell, int aiSource) nativeFunction Cast(ObjectReference akSource, ObjectReference akTarget = None) native Event OnCombatStart(Actor akCaster, Actor akTarget)float ReaperHealth = akCaster.GetAVPercentage("Health") If akCaster.GetAVPercentage("Health")<0.8 akCaster.AddSpell(AvengersWrathSpell) akCaster.EquipSpell(AvengersWrathSpell,1) AvengersWrathSpell.cast(akTarget) akCaster.RemoveSpell(AvengersWrathSpell) Endif If akCaster.GetAVPercentage("Health")<0.75 akCaster.EquipSpell(AvengersFreezeSpell,1) AvengersFreezeSpell.cast(aktarget) Utility.Wait(1.0) akCaster.EquipSpell(AvengersSoulRendSpell,1) AvengersSoulRendSpell.cast(akTarget) Endif If akCaster.GetAVPercentage("Health")<0.6 akCaster.EquipSpell(AvengersWrathSpell,1) AvengersWrathSpell.cast(akTarget) Endif If akCaster.GetAVPercentage("Health")<0.5 akCaster.EquipSpell(AvengersFreezeSpell,1) AvengersFreezeSpell.cast(akTarget) Utility.Wait(1.0) akCaster.EquipSpell(AvengersSoulRendSpell,1) AvengersSoulRendSpell.cast(akTarget) Endif If akCaster.GetAVPercentage("Health")<0.4 akCaster.EquipSpell(AvengersWrathSpell,1) AvengersWrathSpell.cast(akTarget) Endif If akCaster.GetAVPercentage("Health")<0.25 akCaster.EquipSpell(AvengersFreezespell,1) AvengersFreezeSpell.cast(akTarget) Utility.Wait(1.0) akCaster.EquipSpell(AvengersSoulRendSpell,1) AvengersSoulRendSpell.cast(akTarget) EndifEndEvent *EDIT* - I forgot to add the addspell and removespell commands to every event. Is this necessary or not? The NPC has none of these spells normally equipped.I'm wondering if elseif's could be used instead of them all being separate events? I'm also wondering if the script should be tied directly to a quest to have a better chance of it working, or if it can be attached directly the the NPC to override its combat style all the time? If this is too big a question to post here, notify me and I'll remove this post. Should any who can help wish it, proper credit will be given if this mod ever gets uploaded. First of all, delete all those function definitions. Second, delete the properties "akTarget" and "akCaster," because you are trying to use parameters with those same names and that will confuse your script. Third, there is only one event as far as I can tell, so I'm not sure what you are referring to when you say "separate events." Fourth, the event "OnCombatStart" does not appear to exist. Is this a custom event? If so, how are you triggering it? There is no need to give an object a spell in order to have the object cast it. In fact you repeatedly give the spell to akCaster yet you have akTarget actually doing the casting. Link to comment Share on other sites More sharing options...
dpgillam Posted March 30, 2016 Share Posted March 30, 2016 If I make a light armor, and set it with any of the "mage armor" keywords, will that allow it to work with the mage armor perks?Or will it still count as wearing armor, and not allow the mage armor perk to activate? Im making boots and gloves, and it makes sense for them to be a very light armor, and fits the visuals, as well. But I dont know if that will block the mage armor perks from working. Thanks in advance for answers. Link to comment Share on other sites More sharing options...
lofgren Posted March 30, 2016 Share Posted March 30, 2016 If I make a light armor, and set it with any of the "mage armor" keywords, will that allow it to work with the mage armor perks?Or will it still count as wearing armor, and not allow the mage armor perk to activate? Im making boots and gloves, and it makes sense for them to be a very light armor, and fits the visuals, as well. But I dont know if that will block the mage armor perks from working. Thanks in advance for answers. The mage armor perk checks for the keywords ArmorLight and ArmorHeavy, so as long as your armor does not have either of those keywords you should get the bonus to mage armor. You can check for yourself by opening any of the "-flesh" spells and double-clicking the bonus effects to see what conditions they check for. Assuming by "mage armor keywords" you mean the MagicArmor30Perk et al keywords, putting them on a piece of armor won't do anything at all. They are attached to the magic effects that grant the bonuses, not any pieces of armor. You can check what other forms reference a given form by right-clicking on it and selecting "Use Info." If you do that for the MagicArmor30Perk you will see that no armor references that keyword at all. Link to comment Share on other sites More sharing options...
Ryagard Posted March 30, 2016 Share Posted March 30, 2016 I feel like I shouldn't even be posting in here because I'm just that new to modding beyond your run-of-the-mill follower made from a quick tutorial, but how would you set a spell to be on a certain part of the body? I don't get how I would end up editing Candlelight to summon two of itself and have them appear as a kind of overlay for the eyes. If you want more clarification, I want to do the same as I mentioned before. If you've played the MMORPG Aion as an Asmodian, you should know what I mean. If not, having glowing eyes for a follower when he is in combat, just for that one follower, then they vanish when he is no longer in combat. I have the script to have them toggle on when in combat, and off when not, but I still don't know how to edit a spell beyond making it summon an ally (or two without using the perk; I figured out that much) or hit enemies and damage them. Help?You can tell you have no experience, so maybe try starting small? I will explain it one last time and if you still can't figure it out wait till you are more experienced. You need to make a custom .nif based of of any spell (my example was candlelight). Take the .nif and alter it so the affect of the spell is just a glowing light at eye height. Attach that .nif to a custom candle light in the CK and use the script i gave you. Link to comment Share on other sites More sharing options...
dpgillam Posted March 30, 2016 Share Posted March 30, 2016 Thank you, lofgren. Link to comment Share on other sites More sharing options...
Derps4Days Posted March 30, 2016 Share Posted March 30, 2016 I feel like I shouldn't even be posting in here because I'm just that new to modding beyond your run-of-the-mill follower made from a quick tutorial, but how would you set a spell to be on a certain part of the body? I don't get how I would end up editing Candlelight to summon two of itself and have them appear as a kind of overlay for the eyes. If you want more clarification, I want to do the same as I mentioned before. If you've played the MMORPG Aion as an Asmodian, you should know what I mean. If not, having glowing eyes for a follower when he is in combat, just for that one follower, then they vanish when he is no longer in combat. I have the script to have them toggle on when in combat, and off when not, but I still don't know how to edit a spell beyond making it summon an ally (or two without using the perk; I figured out that much) or hit enemies and damage them. Help?You can tell you have no experience, so maybe try starting small? I will explain it one last time and if you still can't figure it out wait till you are more experienced. You need to make a custom .nif based of of any spell (my example was candlelight). Take the .nif and alter it so the affect of the spell is just a glowing light at eye height. Attach that .nif to a custom candle light in the CK and use the script i gave you. How would you go about editing/making the .nif? It would require Blender to edit and Nifskope to export it to an editable format, right? Link to comment Share on other sites More sharing options...
Recommended Posts