Smirkyguy Posted May 10, 2020 Share Posted May 10, 2020 Tried going after this a few times, i want my custom follower to cast candlelight when the light level reaches a certain darkness, and keep casting it after the spell runs out. SKSE code is available for use. SCRIPTING IS HARD OKAY? Link to comment Share on other sites More sharing options...
dylbill Posted May 11, 2020 Share Posted May 11, 2020 (edited) What I would do, is make a new global variable and a new spell ability with the conditions GetLightLevel < SomeAmount AND GetGlobalValue MyGlobalCheck == 0. Also duplicate the CandleLight spell and magic effect. Put this script on the ability's magic effect: Scriptname MyModCastLightScript extends ActiveMagicEffect Spell Property MyCandlelightCopySpell Auto Event OnEffectStart(Actor akTarget, Actor akCaster) MyCandlelightCopySpell.Cast(akTarget) EndEvent Put this script on your duplicate candlelight spell's magic effect: Scriptname MyModCandleLightScript extends ActiveMagicEffect GlobalVariable Property MyGlobalCheck Auto Event OnEffectStart(Actor akTarget, Actor akCaster) MyGlobalCheck.SetValue(1) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) MyGlobalCheck.SetValue(0) EndEvent As always, name the scripts and other properties something more unique to your mod. Edited May 11, 2020 by dylbill Link to comment Share on other sites More sharing options...
Smirkyguy Posted May 11, 2020 Author Share Posted May 11, 2020 uh, explain global variable setup? XD i think i might be rather hopeless at this rate... Link to comment Share on other sites More sharing options...
dylbill Posted May 11, 2020 Share Posted May 11, 2020 Basically, you make a spell ability and put it on your follower. The spell has the condition GetLightLevel < SomeAmount. If that were the only condition, the magic effect would start as soon as the light level was below the certain amount. So the sequence would be, you go to a low light area, your follower would cast the candlelight spell from the script. If however, you went to a higher light area, and back to the low light area, the follower would cast the spell again, even if the candlelight spell was still active. Also, if you were still in a low light area, and the candlelight spell ends, the follower wouldn't cast it again until you went to a high light area, and again to a low light area. This is why the global variable is necessary. With the second script I posted, it sets the MyGlobalCheck global variable to 1 when the candlelight effect starts, and 0 when it ends. So if you also have the condition GetGlobalValue MyGlobalCheck == 0 on the ability, and you are still in a low light area, the ability effect will start again, causing the follower to cast the candlelight spell again. Also he won't cast it again until the candlelight effect ends. Link to comment Share on other sites More sharing options...
Smirkyguy Posted May 11, 2020 Author Share Posted May 11, 2020 i shall attempt the script, and report back if it works Link to comment Share on other sites More sharing options...
Smirkyguy Posted May 11, 2020 Author Share Posted May 11, 2020 (edited) Alright, what did i do wrong...? https://www.dropbox.com/s/h1zfp9led3im5fb/light%20test.zip?dl=0 all entries can be found by searching "koahni" Edited May 11, 2020 by Smirkyguy Link to comment Share on other sites More sharing options...
dylbill Posted May 11, 2020 Share Posted May 11, 2020 I noticed you only have 1 candlelight script. For it to work, you need 2 scripts. step by step instructions 1. In the CK under miscellaneous / Global make a new global variable and name it KoahniCandleLightCheckGV. Keep it on 'short' and set it to 0. 2. duplicate the magic effect LightFFSelf. Name it something unique. Compile and attach this script to it: Scriptname KoahniCandlelightScript extends ActiveMagicEffect GlobalVariable Property KoahniCandleLightCheckGV Auto Event OnEffectStart(Actor akTarget, Actor akCaster) KoahniCandleLightCheckGV.SetValue(1) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) KoahniCandleLightCheckGV.SetValue(0) EndEvent After attaching, click on Properties and then Auto Fill All. 3. Duplicate the vanilla CandleLight Spell. Name it KoahniCandlelightSpell. Delete the magic effect LightFFSelf from it, and put the duplicate magic effect you just made on it. Magnitue 5, duration 1m , which is the same as the vanilla spell. 4. make a new magic effect Archetype: Script Type: Constant Effect Delivery: Self With the No Hit Event, Painless and Hide in UI boxes checked. Attach this script to it: Scriptname KoahniCandlelightAbilityScript extends ActiveMagicEffect Spell Property KoahniCandlelightSpell Auto Event OnEffectStart(Actor akTarget, Actor akCaster) KoahniCandlelightSpell.Cast(akTarget) EndEvent Again after attaching click on Properties and then Auto Fill All. Make a new spell - KoahniCandlelightAbility.Type: Ability Casting: Constant Effect Delivery: Self. Put the magic effect you just made above on it, with the condition GetLightLevel < SomeAmount, have it run on the player, and the condition GetGlobalValue KoahniCandleLightCheckGV == 0. Give the KoahniCandlelightAbility to your follower by adding it to their spells list. Link to comment Share on other sites More sharing options...
Smirkyguy Posted May 11, 2020 Author Share Posted May 11, 2020 alright, that mostly works, but i want the casting animation to play still Link to comment Share on other sites More sharing options...
Smirkyguy Posted May 11, 2020 Author Share Posted May 11, 2020 also is it possible to make the light a warmer orange, rather than the blindingly harsh white it is now? Link to comment Share on other sites More sharing options...
dylbill Posted May 11, 2020 Share Posted May 11, 2020 (edited) If you want to have the animation play, I think you need to use an Ai Package with UseMagic: https://www.creationkit.com/index.php?title=Procedure_UseMagicYou would use that instead of the ability. Put the same conditions on the Ai Package: GetLightLevel < SomeAmount and GetGlobalValue KoahniCandleLightCheckGV == 0 For making the candlelight warming, I'm not sure how, but others have made mods that do this. You can look at how they did it and incorporate it into your mod. https://www.nexusmods.com/skyrim/mods/4419 Edited May 11, 2020 by dylbill Link to comment Share on other sites More sharing options...
Recommended Posts