SirCumference64 Posted December 6, 2016 Share Posted December 6, 2016 I recently downloaded a shapeshifting mod that lets you turn into different monsters, and I'm trying to figure out how to get some of their specific script effects to play when you as the player has the corresponding ability and is the intended creature race. Despite having all the necessary abilities, the scripts don't seem to work the way they do for the NPCs. Specifically, I want to try and get the Spriggan auto revive script and the Wispmother FX/ability script to fire on the player (if they have the ability). For reference, the Spriggan script is: Scriptname SprigganFXSCRIPT extends ActiveMagicEffect{Attaches and controlss spriggan FX}import utilityimport formActor selfRefVisualEffect Property SprigganFXAttachEffect AutoSpell Property crSprigganHeal01 AutoSpell Property crSprigganCallCreatures AutoIdle Property FFselfIdle Autoint doOnce;===============================================;RegisterForSleep() ; Before we can use OnSleepStart we must register.EVENT OnEffectStart(Actor Target, Actor Caster);Play your particles.selfRef = caster;test to see if spriggan is in ambush modeif (selfRef.GetSleepState() == 3); Debug.Trace("Spriggan is sleeping! 3")selfRef.PlaySubGraphAnimation( "KillFX" )elseSprigganFXAttachEffect.Play(selfRef, -1)endIfENDEVENTEvent OnEffectFinish(Actor akTarget, Actor akCaster)SprigganFXAttachEffect.Stop(selfRef)endEventEvent OnGetUp(ObjectReference akFurniture); Debug.Trace("We just got up from " )SprigganFXAttachEffect.Play(selfRef, -1)selfRef.PlaySubGraphAnimation( "Revive" )endEventEVENT onDeath(actor myKiller);(selfRef as actor).PlaySubGraphAnimation( "LeavesScared" );wait(10.0)selfRef.PlaySubGraphAnimation( "KillFX" )wait(10.0)SprigganFXAttachEffect.Stop(selfRef)ENDEVENTEVENT onCombatStateChanged(Actor akTarget, int aeCombatState)if aeCombatState == 1selfRef.playIdle(FFselfIdle)utility.wait(3.0)crSprigganCallCreatures.cast(selfRef,selfRef)endifendEVENTEvent OnEnterBleedout(); Debug.Trace("dude im bleeeding out" )if doOnce == 0selfRef.PlaySubGraphAnimation( "KillFX" )wait(2.0)crSprigganHeal01.Cast(selfRef)selfRef.setActorValue("variable07",1)selfRef.evaluatePackage()wait(1.0)selfRef.PlaySubGraphAnimation( "Revive" )doOnce = 1endIfENDEVENT And the Wispmother script is: Scriptname WispActorScript extends ActiveMagicEffect{Abilities and FX for Wisp/Glimmerwitch};======================================================================================;; IMPORTS /;=============/import utilityimport formimport debug;======================================================================================;; PROPERTIES /;=============/keyword property wispChild01 autokeyword property wispChild02 autokeyword property wispChild03 autospell property wispBuff01 autospell property wispBuff02 autospell property wispBuff03 autospell property Phase1ConcSpell auto{A long range concentration spell for phase #1}spell property Phase2ConcSpell auto{Shorter range spell for phase #2}actorBase property encWispShade autoVisualEffect Property WispFXAttachEffect Autoexplosion property ExplosionIllusionLight01 autoActivator property AshPileObject auto{The object we use as a pile.}float property PhaseThreeHPPercent auto{At what % of HP should I spawn my dopplegangers?. DEFAULT: 0.2};======================================================================================;; VARIABLES /;=============/ObjectReference selfRef; let's refer to the witchlights as "orbs" to avoid confusion.objectReference orb01objectReference orb02objectReference orb03objectReference Shade01objectReference Shade02;track number of living orb babiesint liveLights = 3; have my FX been attached?bool bFX = FALSE;======================================================================================;; EVENTS /;=============/EVENT onLoad()trace("Wisp: Has Loaded 3D ("+selfRef+")")EVPall()endEVENTEVENT OnEffectStart(Actor Target, Actor Caster)trace("AbWisp Effect Start on: "+SelfRef+"")selfRef = casterif selfref.getLinkedRef() == NONE; only attack FX at this point if I am not in an ambush linkWispFXAttachEffect.Play(selfRef, -1)bFX = TRUEendiforb01 = selfref.getLinkedRef(WispChild01)orb02 = selfRef.getLinkedRef(WispChild02)orb03 = selfRef.getLinkedRef(WispChild03)EVPall()if phaseThreeHPpercent > 1.0; if we passed a high value, the user probably meant a whole number percentage like 30%phaseThreeHPpercent = phaseThreeHPpercent/100endifENDEVENTEVENT onGetup(ObjectReference akFurniture)if akFurniture == selfRef.getLinkedRef() && bFX == FALSE; if I was in a furniture ambush, then add my FX when I leave itWispFXAttachEffect.Play(selfRef, -1)bFX = TRUEendifendEVENTEvent OnCombatStateChanged(Actor victim, int aeCombatState)if aeCombatState != 0 ; 0 means not in combat, so non-zero means we entered combat; debug.trace("Wisp began combat with "+victim+" ("+self+")")if aeCombatState == 1(orb01 as actor).startCombat(victim)(orb02 as actor).startCombat(victim)(orb03 as actor).startCombat(victim); Start listening for critically low HPregisterforSingleupdate(1.0)endifendifendEVENTEVENT onActivate(objectReference actronaut); debug.trace("Wisp Activated")if actronaut == orb01 || orb02 || orb03utility.wait(0.1); debug.trace("Actronaut was one of my orbs")liveLights -= 1; debug.trace("Livelights = "+livelights)if liveLights <= 0; debug.trace("All child lights dead for "+selfref);Variable07 sets up the berserk package/combat style(selfRef as actor).setActorValue("Variable07",1);also "eliminate" her ability to cast spells - take all her magicka away.trace("WISPS: move to combat phase 2"); Take away her magicka (she'll regen) and shuffle her spell set(selfRef as actor).damageActorValue("Magicka", -((selfref as actor).getActorValue("Magicka")))(selfref as actor).removeSpell(Phase1ConcSpell)(selfref as actor).addSpell(Phase2ConcSpell)endifendifendEVENTEVENT onUpdate(); Check HP for Phase 3 Combat - Last ditch doppleganger attack!if (selfRef as actor).getActorValuePercentage("health") > phaseThreeHPpercent; HP still high, so hold off.;utility.wait(0.5)RegisterforSingleUpdate(0.5)else; create my dopplegangers and unregister for updateShade01 = (selfref as actor).placeAtMe(EncWispShade)Shade02 = (selfref as actor).placeAtMe(EncWispShade);Set AV06 to 1 as a flag for being in this state (used in Frostmere Crypt)(selfref as actor).SetAV("Variable06", 1); Dump the orbs.(orb01 as actor).kill()(orb02 as actor).kill()(orb03 as actor).kill(); restore her longer-range spell(selfref as actor).addSpell(Phase1ConcSpell)endifendEVENTEVENT OnDying(Actor akKiller); Effects automatically finish onDeath so use this EVENT hook insteadtrace("Actor has died: "+selfref)(selfRef as actor).SetCriticalStage((selfRef as actor).CritStage_DisintegrateStart)WispFXAttachEffect.Stop(selfRef)utility.wait(0.90)selfRef.placeatme(ExplosionIllusionLight01)(selfRef as actor).AttachAshPile(AshPileObject); pause a second before killing inheritors - I've seen massive damage skip over thisutility.wait(0.5)(orb01 as actor).kill()(orb02 as actor).kill()(orb03 as actor).kill()(Shade01 as actor).kill()(Shade02 as actor).kill()(selfRef as actor).SetCriticalStage((selfRef as actor).CritStage_DisintegrateEnd)ENDEVENTFUNCTION EVPall()trace("Sending EVP to self and witchlight children ("+selfRef+")")trace("Witchlights are the Following:")trace("--------------------------------")trace(orb01)trace(orb02)trace(orb03)trace("--------------------------------")(orb01 as actor).evaluatePackage()(orb02 as actor).evaluatePackage()(orb03 as actor).evaluatePackage()endFUNCTION I don't want to change anything about what these scripts actually do, just that they work on me when I'm a Spriggan or Wisp Mother. Any help would be really appreciated - I don't even know if this is something I can do, and I've really hit a wall in looking up info on it. I don't know nearly enough about scripting to pick up on what I'm doing wrong. Link to comment Share on other sites More sharing options...
SirCumference64 Posted December 7, 2016 Author Share Posted December 7, 2016 Figured out what seems to be the major problem with the Spriggan script. The revive spell and associated animations are set to play when the caster bleeds out, which the player never does without mods. I'd need to find a way to get the script to look for the player's health getting low and then to run the event that way. I've tried using GetActorValuePercentage("Health") > a float property I created, but I must be doing something wrong because it's still not working. Would anyone have an idea on how to script something like that? I'm more or less off the Wisp Mother, that's a monster of a script, and I'd be better off trying to make something simpler to emulate the effects, likely just to spawn the wisps when in combat and spawn the shades when health gets low, but since that's more complex, I'm just focusing on the Spriggan. Link to comment Share on other sites More sharing options...
Recommended Posts