candlepin Posted March 18, 2017 Author Share Posted March 18, 2017 Thanks, Contrathetix. I'll give those SKSE commands a try. Another issue I've run into (seems others have had a similar issue) is that OnEffectFinish() is not working for one of my Magic Effect scripts. I'm trying to add a Fortify Speed alchemy effect. My script-based Magic Effect works for increasing speed, but OnEffectFinish doesn't work at resetting the player's speed. I've read that this can be caused by the magic effect stopping before it's supposed to. Any recommendations to fix this issue? Link to comment Share on other sites More sharing options...
FrankFamily Posted March 18, 2017 Share Posted March 18, 2017 I think the issue is you can't/shouldn't call member functions on the oneffectfinish event, that is, those on the activemagiceffect script. I've never have a problem with one one-liners affecting other references, like calling something on the player. How are you getting the player? (the parameters, getplayer function, etc.) Do note speed changes don't apply unless carryweight is updated, so try adding a simple modav +1 on effect start and modav -1 on effect finish. Might be what's going on. Link to comment Share on other sites More sharing options...
candlepin Posted March 24, 2017 Author Share Posted March 24, 2017 (edited) I'm having an issue with a script for a magical effect I'm working on. Specifically, I'm having an issue with LeftWeaponSpeedMult (see script below). I can get my script to change WeaponSpeedMult, but not LeftWeaponSpeedMult. I set up my variables correctly (they return the correct output), but for some reason when I use the associated potions in-game, it only changes WeaponSpeedMult (LeftWeaponSpeedMult stays at 0). Could someone take a look at the script for me and tell me where I'm going wrong? Scriptname CP_AlchFlurry extends activemagiceffect {Increases target's weapons speed by <mag>} ObjectReference property PlayerRef auto Bool Property NoStack = true auto Bool Property NormalSpeedZero = true auto Bool Property NormalSpeedLeftZero = true auto Event OnEffectStart(Actor akTarget, Actor akCaster) If NoStack == true NoStack = false Float Mag = self.GetMagnitude() Float MagSmall = Mag / 100 Float NormalSpeed = akTarget.GetAV("WeaponSpeedMult") Float NormalSpeedLeft = akTarget.GetAV("LeftWeaponSpeedMult") Float FlurrySpeed = NormalSpeed + MagSmall Float FlurrySpeedLeft = NormalSpeedLeft + MagSmall If NormalSpeed == 0.0 Float FlurrySpeed0 = FlurrySpeed + 1.0 akTarget.SetActorValue("WeaponSpeedMult", FlurrySpeed0) Debug.Notification("Weapon Speed is " + FlurrySpeed0) ; REMOVE AFTER TESTING Else NormalSpeedZero = false akTarget.SetActorValue("WeaponSpeedMult", FlurrySpeed) Debug.Notification("Weapon Speed is " + FlurrySpeed) ; REMOVE AFTER TESTING EndIf If NormalSpeedLeft == 0.0 Float FlurrySpeedLeft0 = FlurrySpeedLeft + 1.0 akTarget.SetActorValue("WeaponSpeedMult", FlurrySpeedLeft0) Debug.Notification("Left Weapon Speed is " + FlurrySpeedLeft0) ; REMOVE AFTER TESTING Else NormalSpeedLeftZero = false akTarget.SetActorValue("WeaponSpeedMult", FlurrySpeedLeft) Debug.Notification("Left Weapon Speed is " + FlurrySpeedLeft) ; REMOVE AFTER TESTING EndIf EndIf akTarget.ModActorValue("Carryweight", 0.01) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) Float FlurrySpeedRight = akTarget.GetAV("WeaponSpeedMult") Float FlurrySpeedLeft = akTarget.GetAV("LeftWeaponSpeedMult") Float Magnitude = self.GetMagnitude() / 100 If NormalSpeedZero == true akTarget.SetActorValue("WeaponSpeedMult", 0) Else Float ResetSpeed = FlurrySpeedRight - Magnitude akTarget.SetActorValue("WeaponSpeedMult", ResetSpeed) EndIf If NormalSpeedLeftZero == true akTarget.SetActorValue("LeftWeaponSpeedMult", 0) Else Float LeftResetSpeed = FlurrySpeedLeft - Magnitude akTarget.SetActorValue("LeftWeaponSpeedMult", LeftResetSpeed) EndIf akTarget.ModActorValue("Carryweight", -0.01) EndEvent Edited March 24, 2017 by candlepin Link to comment Share on other sites More sharing options...
FrankFamily Posted March 24, 2017 Share Posted March 24, 2017 LeftWeaponSpeedMult? Haven't heard of that actor value before and it doesn't appear among the actor values on the wiki: http://www.creationkit.com/index.php?title=Actor_Values but it does in the actorvalueinfo script: http://www.creationkit.com/index.php?title=ActorValueInfo_Script. Maybe skse added new actor values? Have you tested changing that actor value with the console and see if it has an effect ingame? Link to comment Share on other sites More sharing options...
candlepin Posted March 24, 2017 Author Share Posted March 24, 2017 I have not tested it; was planning on doing so with this effect. I'll try altering it with the console tonight. If WeaponSpeedMult handled the weapon speed is both weapons, that would be great! My script works pretty well at changing that actor value. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 24, 2017 Share Posted March 24, 2017 Before changing things up, I noticed in your script in the OnEffectStart event that you are using WeaponSpeedMult when changing the left speed. Perhaps this is a copy/paste that you forgot to edit to be LeftWeaponSpeedMult. If so, this could explain why it is not working as intended. Link to comment Share on other sites More sharing options...
candlepin Posted March 24, 2017 Author Share Posted March 24, 2017 Before changing things up, I noticed in your script in the OnEffectStart event that you are using WeaponSpeedMult when changing the left speed. Perhaps this is a copy/paste that you forgot to edit to be LeftWeaponSpeedMult. If so, this could explain why it is not working as intended. Wow, not sure how I missed that. It definitely was a copy-paste issue that I forgot to edit. I'll change those two lines tonight & test it. Thanks for looking over my script! Link to comment Share on other sites More sharing options...
candlepin Posted March 24, 2017 Author Share Posted March 24, 2017 (edited) I have a question about another script that is still in the conceptual phase. I'd like to add a Silence alchemy effect. The way I've seen other modders go about silencing someone (usually via a spell) is to just drain the target's Magicka and Magicka Regen (or set them to 0). While this seems like it would work, it seems to me that there are a few shortcomings: 1) This prevents the character from draining Magicka from the target. I could see using these two effects in combination very effectively. 2) If it's truly a silence effect, the player's Magicka should be at full when the script is over. This, I admit could be done with a little extra scripting.3) The biggest problem; couldn't the target just drink a magicka potion to restore their magicka and be able to cast spells while they are still "silenced"? Maybe this is moot for NPCs (I've seen conflicting reports on whether NPCs use restore magicka potions). I've looked a bit at other options and come up with a few options. First option; temporarily remove all the actor's spells and return them when the effect is done. I see all sorts of issues with this though. Mainly, there could be some major issues if I get my dispel effect to work; hit an enemy with silence and then dispel before the silence effect has time to wear off (they'd never get the chance to get their spells off) = enemy permanently loses all spells. This seems like a drastic (and poor) way to achieve silence. The second option, which seems like it might be better, is to unequip a spell whenever the actor tries to cast it. Perhaps using something like: akTarget.UnequipSpell(akTarget.GetEquippedSpell(0), 0) andakTarget.UnequipSpell(akTarget.GetEquippedSpell(1), 1) The main problem I see is that this might turn an NPCs into a moving dummy; they might just continually try to use spells and never switch over to melee combat. Third option; change Combat Style of akTarget via script. I have a few questions about this. Is there a way to alter the Combat Style (particularly the Equipment Score Mults: Magic, as seen on http://www.creationkit.com/index.php?title=Combat_Style) via script? If that could be set to zero then, theoretically, the player would use anything other than magic when attacking (i.e. silence). I imagine I could go through and make alternate Combat Styles to those that exist in-game where the Magic mult is set to zero, but then the mod wouldn't be compatible with any mods that add new/custom Combat Styles. Not sure how many of these Combat Styles there are (don't have access to the CK at the moment), but I imagine it is doable. Tedious, but possible. I'd appreciate thoughts/input on the subject. Thanks! Edited March 24, 2017 by candlepin Link to comment Share on other sites More sharing options...
candlepin Posted March 26, 2017 Author Share Posted March 26, 2017 I have another question, maybe simpler. Is there any way to add a Magic Effect by script? I have a constant effect Magic Effect that I'd like to use as an Alchemy Effect, but for some ungodly reason the CK doesn't allow constant effects for Alchemy Effects. I know that I could make it an Ability and add it via scripting, but from what I've read this path has issues when it comes to NPCs (removing Spells from NPCs seems like a no-go). Link to comment Share on other sites More sharing options...
candlepin Posted March 27, 2017 Author Share Posted March 27, 2017 Before changing things up, I noticed in your script in the OnEffectStart event that you are using WeaponSpeedMult when changing the left speed. Perhaps this is a copy/paste that you forgot to edit to be LeftWeaponSpeedMult. If so, this could explain why it is not working as intended. Indeed, that fixed the issue. I'm not 100% sure whether LeftWeaponSpeedMult does anything or not, but I'll leave it in just in case. Thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts