Jump to content

Help - MGEFs falling off actors, SPEL Ability, Constant Effect, still there.


darkconsole

Recommended Posts

Posted

Im having an issue getting magic effects to stick to these actors for some reason. I've never had the issue until now.

 

Here is a bear. It is persistent. It will not be deleted by the game. It will even follow me into cities. It has a spell that is Constant Effect, Self that contains 1 effect that is Script, Constant Effect, Self. And it works great. Nothing wrong with it. The script has an OnDeath that makes the player enrage if the bear dies. It's pretty awesome.

 

post-501843-0-76507500-1422485344_thumb.png

 

Until I walk through a city door, or fast travel, or anything that prompts a loading screen. Then what happens is while the SPELL is still there. As you can see, the Spell even says "yo this effect should be there"

 

post-501843-0-82371400-1422485349_thumb.png

 

BUT the magic effect (and therefore the script) have fukken VANISHED. It is even calling OnEffectEnd, I can make it print "effect has fallen off" and it happens as soon as the load screen is done.

 

post-501843-0-39892600-1422485354_thumb.png

 

What I cannot do is from Within OnEffectEnd, RemoveSpell the ability, and then AddSpell it back on. When I attempt this it gets removed, but then it removes itself so fast that it doesn't call the next line of re-adding. I been through the god damn logs thousands of times, nothing is throwing any flags out. I cannot OnLoad because that does not bubble to ActiveMagicEffects. I will not make Quest Aliases because I want to support an infinite number of pets.

 

post-501843-0-58340500-1422485638_thumb.png

 

I am at a loss, I have been chasing this down since saturday.

 

I have a list in StorageUtil of all the pets that are following me. My only sure fire solution so far is to have the player do a periodic check to make sure the effect is still there on all its pets. I sure as fuck do not want to do that.

Posted

From what I've seen and read here, mgef's on NPC's can disappear (without OnEffectEnd being called) when the NPC changes cells.

Posted

and so. shit code is created.

Event OnUpdate()
	If(Untamed.OptCheckPack)
		self.UpdatePack()
	EndIf

	self.RegisterForSingleUpdate(5)
	Return
EndEvent

Function UpdatePack()
{this is a really shitty maintenance function because magic effects will just
randomly fall off non-player actors.}

	;; http://www.loverslab.com/topic/42498-help-mgefs-falling-off-actors-spel-ability-constant-effect-still-there/
	;; http://www.loverslab.com/topic/30613-best-practice-for-scripts-attached-to-magic-effects-oneffectfinish-or-registerforsingleupdate/?p=764305

	Int a = 0
	Int len = StorageUtil.FormListCount(None,"Untamed.TrackingList") 
	Actor what

	While(a < len)
		what = StorageUtil.FormListGet(None,"Untamed.TrackingList",a) as Actor

		If(what != None && !what.IsDead() && !what.HasMagicEffect(Untamed.dcc_ut_EffectFollower))
			what.RemoveSpell(Untamed.dcc_ut_SpellFollower)
			what.AddSpell(Untamed.dcc_ut_SpellFollower)
		EndIf

		a += 1
	EndWhile

	Return
EndFunction
Posted

 

and so. shit code is created.

Event OnUpdate()
	If(Untamed.OptCheckPack)
		self.UpdatePack()
	EndIf

	self.RegisterForSingleUpdate(5)
	Return
EndEvent

Function UpdatePack()
{this is a really shitty maintenance function because magic effects will just
randomly fall off non-player actors.}

	;; http://www.loverslab.com/topic/42498-help-mgefs-falling-off-actors-spel-ability-constant-effect-still-there/
	;; http://www.loverslab.com/topic/30613-best-practice-for-scripts-attached-to-magic-effects-oneffectfinish-or-registerforsingleupdate/?p=764305

	Int a = 0
	Int len = StorageUtil.FormListCount(None,"Untamed.TrackingList") 
	Actor what

	While(a < len)
		what = StorageUtil.FormListGet(None,"Untamed.TrackingList",a) as Actor

		If(what != None && !what.IsDead() && !what.HasMagicEffect(Untamed.dcc_ut_EffectFollower))
			what.RemoveSpell(Untamed.dcc_ut_SpellFollower)
			what.AddSpell(Untamed.dcc_ut_SpellFollower)
		EndIf

		a += 1
	EndWhile

	Return
EndFunction

 

That's brutal. What the argument for RegisterForSingleUpdate(), hmmm? :)

Posted

register for single update is how you get it to repeat itself without causing a backup of unprocessed events. if i go straight RegisterForUpdate(5) and for some reason this function takes more than 5 seconds to process, it'll start a cascading savegame clusterfuck.

Posted

If you're using PapyrusUtil, maybe you could take advantage of the package overrides and package fragment scripts. I'm not sure if this would work they way I'm picturing it, but...

 

Create a very simple package, for example using a "DoNothing" template. The condition for this package to run should be that the creature DOESN'T have the magic effect that you want to keep running (and maybe also that the creature is in the SAME cell than the player, so it doesn't trigger while it's still unloaded). Add this package though PapyrusUtil functions with the highest priority you can get. That way, those creatures will always switch to this one regardless of what they had before.

 

On the package's Begin fragment, simply re-apply the spell. If it works as I think it does, the creature will get the effect back and that should also cause it to switch to the proper package afterwards. I'm not sure of how exactly are packages handled when the creature is unloaded, but I'm pretty sure that they don't just vanish.

 

Other than that, I'm not really sure of what to do. You said you got the bear to move between load zones. How did you do that? I had some trouble in my mod to get creatures with the "can't-open-doors" flag to do so, and in the end I managed to work over the issue using packages as well. If you're using some method to warp your creatures through load zones, maybe you could just re-apply the effect there as well.

 

Personally, I too dislike the idea of having a cap on the number of creatures that can be tamed, but I think that using aliases isn't that bad. You need the aliases only to carry a single script, so all you gotta do is to make one alias and duplicate it a shit ton of times... A couple hundreds? I doubt much people is going to use that many creatures, and if you're worried about savegame clusterfucks, I think that having a cap on the creatures that the mod manages would also contribute to avoid them.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...