PacmanZ3ro Posted April 5, 2018 Share Posted April 5, 2018 Hi all, So the general gist of it is that I'm trying to create a script attached to a spell so that if an actor dies while under the effect of the magic effect an explosion is triggered and spreads the magic effect to all actors near the one that just exploded. I've tried doing it with just triggering an area spell when the actor dies, but target actor spells apparently can't have an area or at least I haven't been able to get it to work for me so far. With that said, I decided I would just use a script to get all actor references near the one that just died and then apply the spell to them. The problem is that after searching around I stumbled on the objRef.FindAllNearbyReferencesWithKeyword(kwd, radius) function, but my CK won't compile it as it returns the error that it doesn't exist/isn't a function. So, I'm here for some help on this one since I've been trying for quite a while now to get this working without success. If you can point me to the correct function to do what I'm looking for or maybe give me an idea on how to do it without the script I'd appreciate it. What it needs: - destruction spell that triggers an explosion when the affected actor dies- all other actors within the explosion radius have the spell/effect applied to them as well- both the main spell and the secondary triggers/explosions need to use the player's destruction stats What I've tried: - using onDying event to trigger a second spell (target actor, area, with an explosion) but that doesn't affect anyone but the actor that's already dead- using onDying event to trigger a second spell (aimed, invis proj, with an explosion) which works, but it's really clunky because any debris in the way or corners, ect block the effect. This is the one that has worked the best so far, but like I said it's really clunky and feels kinda bad, especially if you have multiple enemies attacking you and one of them gets in the way. - using placeAtMe to get the explosion and a script to apply the effect but I can't get the actor references near the one that just died. This is where I'm at now. I've done a few other things relating to the above and messed with various projectile/explosion settings to try and get what I wanted, but it either didn't use the player's stats (thus being a horribly scaled spell) or it just didn't work at all. With all that out of the way, here's the full script for reference: scriptname z3_spreadFireDmg extends ActiveMagicEffect ObjectReference[] targetArray Actor target; Actor Property PlayerRef Auto Spell Property mySpell Auto Explosion Property spreadBoom Auto FormList Property actorType Auto event onEffectStart(Actor akTarget, Actor akCaster) target = akTarget; endEvent event onDying(Actor akKiller) int aIndex = actorType.GetSize() while aIndex aIndex -= 1 targetArray = target.FindAllReferencesWithKeyword(actorType.GetAt(aIndex) , 384) endWhile target.PlaceAtMe(spreadBoom) int tIndex = targetArray.Length while tIndex tIndex -= 1 mySpell.Cast(PlayerRef, targetArray[tIndex]) endWhile target.DispelAllSpells() endEvent Any help would be greatly appreciated! Link to comment Share on other sites More sharing options...
Evangela Posted April 5, 2018 Share Posted April 5, 2018 (edited) FindAllReferencesWithKeyword is a Fallout 4 function. Looks like you were looking at the wrong wiki. The existing Find functions for Skyrim work poorly for actors because it'll return the passed in actor when its arCenter. You could use SKSE's GetNumRefs to grab all actors that has a specific keyword, but it's a rather slow function if you're fine with that. Edited April 6, 2018 by Rasikko Link to comment Share on other sites More sharing options...
PacmanZ3ro Posted April 5, 2018 Author Share Posted April 5, 2018 Hmm, noticed that. Welp, that's unfortunate. After some thinking and tinkering I managed to get it working and with a much much simpler script. For those curious, how I handled it was: creating 3 seperate spells & magic effects - Initial spell (target actor, fire&forget, fire damage over time) - primer spell (self, area, fire&forget, 0 magnitude and w/e area & duration you want, in this case 18ft/20sec) - secondary damage spell (self, area, fire&forget, fire damage over time, huge area & area ignore LoS, conditional on target being affected by primer magic effect) and then attached the following script to the initial spell and primer spell: scriptname z3_spreadFireDmg extends ActiveMagicEffect Actor target Actor player Spell Property primerSpell Auto Spell Property dotSpell Auto Explosion Property spreadBoom Auto event onEffectStart(actor akTarget, actor akCaster) target = akTarget player = game.getPlayer() endEvent event onDying(actor akKiller) primerSpell.Cast(target) target.PlaceAtMe(spreadBoom) dotSpell.Cast(player) target.DispelAllSpells() endEvent and voila, now I get to enjoy aggro'ing a whole bunch of enemies and then watch as they all explode one by one. Link to comment Share on other sites More sharing options...
Recommended Posts