daisy8 Posted March 5, 2012 Share Posted March 5, 2012 Hi again guys I have been trying to get a standard lvlBandit to disintergrate into and ashpile on death, but have found this simple project tough. I need a script I can place on a number of different NPC so they turn to ash when killed. I have been playing with the Skyrim script "magicAttachAshPileOnDeath" but it really is too complicated. Here is the full unedited script - (I do not need a formlist or any immune races - I need it to just act on the NPC running the script.) scriptName magicAttachAshPileOnDeath extends ActiveMagicEffect {Scripted effect for on death ash pile} import debug import FormList ;======================================================================================; ; PROPERTIES / ;=============/ float property fDelay = 0.75 auto {time to wait before Spawning Ash Pile} ; float property fDelayAlpha = 1.65 auto ; {time to wait before Setting alpha to zero.} float property fDelayEnd = 1.65 auto {time to wait before Removing Base Actor} float property ShaderDuration = 0.00 auto {Duration of Effect Shader.} Activator property AshPileObject auto {The object we use as a pile.} EffectShader property MagicEffectShader auto {The Effect Shader we want.} Bool property bSetAlphaZero = True auto {The Effect Shader we want.} FormList Property ImmunityList auto {If the target is in this list, they will not be disintegrated.} Bool property bSetAlphaToZeroEarly = False Auto {Use this if we want to set the acro to invisible somewhere before the effect shader is done.} ;======================================================================================; ; VARIABLES / ;=============/ actor Victim race VictimRace bool TargetIsImmune = True ; bool DeadAlready = FALSE ;======================================================================================; ; EVENTS / ;=============/ Event OnEffectStart(Actor Target, Actor Caster) victim = target ; DeadAlready = Victim.IsDead() trace("victim == " + victim + ", is this right?") EndEvent Event OnDying(Actor Killer) if ImmunityList == none TargetIsImmune = False else ActorBase VictimBase = Victim.GetBaseObject() as ActorBase VictimRace = VictimBase.GetRace() if ImmunityList.hasform(VictimRace) TargetIsImmune = True elseif ImmunityList.hasform(VictimBase) TargetIsImmune = True else TargetIsImmune = False endif endif if TargetIsImmune == False trace("victim just died") ; DeadAlready = true victim.SetCriticalStage(Victim.CritStage_DisintegrateStart) ;victim.SetAlpha (0.99,False) if MagicEffectShader != none MagicEffectShader.play(Victim,ShaderDuration) endif if bSetAlphaToZeroEarly victim.SetAlpha (0.0,True) endif utility.wait(fDelay) Victim.AttachAshPile(AshPileObject) ; AshPileRef = AshPileObject ; AshPileRef.SetAngle(0.0,0.0,(Victim.GetAngleZ())) utility.wait(fDelayEnd) if MagicEffectShader != none MagicEffectShader.stop(Victim) endif if bSetAlphaZero == True victim.SetAlpha (0.0,True) endif victim.SetCriticalStage(Victim.CritStage_DisintegrateEnd) endif EndEvent I am having trouble getting the script to recognise the NPC as the 'victim'. Debug logs tell me that none of the effects are being applied because - "warning: Assigning None to a non-object variable named "::temp1"stack:[ (0300535F)." "error: Cannot call SetCriticalStage() on a None object, aborting function call stack:[ (0300535F)" I have stared at this for hours now. No idea. Any help would be appreciated. Thanks everyone daisy Link to comment Share on other sites More sharing options...
fg109 Posted March 5, 2012 Share Posted March 5, 2012 I don't see anything wrong with the script, and it works fine in the game after all. Perhaps you should post what your modified script looks like, or describe how you're using the original script. Link to comment Share on other sites More sharing options...
daisy8 Posted March 6, 2012 Author Share Posted March 6, 2012 Hi FG Thanks for the reply I have really only been trying to attach the standard script to my NPC. And for some reason it isn't working. Really all I need is a script that turns a plain old levelled Bandit into a Bandit Zombie. How is this done in the game when a NPC is raised from the dead ? Is it race change ? Magical effect ? D Link to comment Share on other sites More sharing options...
fg109 Posted March 6, 2012 Share Posted March 6, 2012 Well, the script magicAttachAshPileOnDeath is for active magic effects. So if you're attaching it to an actor, then it probably wouldn't work properly. So you can either change this into an actor script or create a magic effect with this script (I can't seem to find a vanilla one that uses this script), attach the effect to a spell/ability/disease/etc. and somehow add that to your bandit. If you do decide to turn it into an actor script, I think all you really need to change is the first line, have it be "extends Actor" instead of "extends activemagiceffect". Also, you need to get rid of the code for OnEffectStart, and add "victim = Self" at the beginning of the code for OnDying. Link to comment Share on other sites More sharing options...
daisy8 Posted March 7, 2012 Author Share Posted March 7, 2012 Doh !!! I am still getting used the new script from the old one in Fallout. I consistently forget the extends part. I will give it a try with extends actor and some other changes. I post what I do here and whether it works or not. Thanks againDaisy Link to comment Share on other sites More sharing options...
daisy8 Posted March 7, 2012 Author Share Posted March 7, 2012 Hi guys. Now have a fully working script turning NPCs into ash when they get killed. Nice ! scriptName ADZDeadBanditToDust2 extends Actor float property fDelay = 0.75 auto {time to wait before Spawning Ash Pile} float property fDelayEnd = 1.65 auto {time to wait before Removing Base Actor} float property ShaderDuration = 0.00 auto {Duration of Effect Shader.} Activator property AshPileObject auto {The object we use as a pile.} EffectShader property MagicEffectShader auto {The Effect Shader we want.} Bool property bSetAlphaZero = True auto {The Effect Shader we want.} Bool property bSetAlphaToZeroEarly = False Auto {Use this if we want to set the acro to invisible somewhere before the effect shader is done.} Event OnDeath(Actor Killer) Self.SetCriticalStage(self.CritStage_DisintegrateStart) if MagicEffectShader != none MagicEffectShader.play(Self,ShaderDuration) endif if bSetAlphaToZeroEarly Self.SetAlpha (0.0,True) endif utility.wait(fDelay) Self.AttachAshPile(AshPileObject) utility.wait(fDelayEnd) if MagicEffectShader != none MagicEffectShader.stop(Self) endif if bSetAlphaZero == True Self.SetAlpha (0.0,True) endif Self.SetCriticalStage(Self.CritStage_DisintegrateEnd) EndEvent Thanks to fg109 for all their help CheersDaisy Link to comment Share on other sites More sharing options...
tonycubed2 Posted January 23, 2013 Share Posted January 23, 2013 Hi, What did you set in properties for magic effect shader and ash pile object? nice job. Tony :thumbsup: Link to comment Share on other sites More sharing options...
Recommended Posts