Jump to content

Couple MagicEffect script/function questions


sLoPpYdOtBiGhOlE

Recommended Posts

Hi, thanks for taking the time to peruse my post.

 

I'll start by saying I'm fairly new to FO3 scripting, but I'm fairly fluid in scripting in general.

Loops, Lists, Objects, Conditions and statements, parameters, arrays (even though FO3 lacks them), variables...etc are not new to me and I have no problem in most cases making scripted menus and mods in Skyrim and Fallout 3 (mainly for my own use).

 

I recently decided to make a mod for myself based on AP's animations.

All works well and NPCs randomly approach and ask if I'd like to join for some fun and play multiple scenes in a row linked together without user intervention.

Based on player/npc arousal, chance and if they like the player to how many linked scenes they play in a session.

 

Then I discover that my Magic Effect (Ability) script keeps getting it's variables reset when the NPC leaves and re-enters the cell.

Mind you no mention anywhere on the Geck Wiki about this type of behavior.

 

I understand that the the ability effect should not be active when the NPC isn't loaded, but the script variables being reset.. WTH ?

I can understand that Non Persistent, Low Level AI disabled or Reset of NPCs would maybe drop the Magic Effect.

But this isn't the case, just blatant reset the declared Variables at the top of the script while the effect is still on the NPC, just they left a cell and re-entered the cell later, effect still in tact, just the variables reset.

Am I missing something here or is this expected behavior for a Magic Effect Ability?

 

I have other methods to store per NPC stats, but I was hoping the effect could hold the variables until the effect is actually removed.

 

Another question about ScriptEffectUpdate:

How often is the ScriptEffectUpdate called eg: every frame?

 

I have tried referencing as much documentation as I can, but the info on FO3 ScriptEffect blocks is very minimal to say the least.

 

 

 

 

Link to comment
Share on other sites

I'm far from a scripting expert, but I have come to find out a few things while wading through some complicated GECK work and scripts. The variable in Effect Scripts can reset. They are not designed to do so, but they can reset for some reason. I rarely if ever use them for that reason.

A ScriptEffectUpdate Block should attempt to run every frame that the Effect is still active.

Link to comment
Share on other sites

Thank you for taking the time.

Yep I was sort of blown away the way it was working.

 

Basically the effect is a constant Scripted Ability with no duration.

Basically stay on till removed by death or whatever else removes the spell.

 

I know better then to assume anything with Geck and CK's implementation of papyrus, but old habits die hard :smile:

 

My simple logic was

 

EffectStart would fire once (since I wasn't using conditions on the effect or spell.)

Init my 5 starting vars at the top of my script.

 

EffectUpdate fired every frame while the actor is in an attached cell.

 

4 of those variables are what I call flush variables, that are updated via timer in the UpdateEffect block, the maths was calculated every new timer cycle. so resetting made no difference.

1 variable was a count that increments by one and should never get reset while the effect is on the actor.

 

But the way the effect works is nothing like that at all...lol

 

I ended up storing the 1 variable in a token as at least it doesn't reset the variable.

Just sorta blows adding more moving parts to the process that need to sync with each other as it just adds more room for errors.

But work fine from my testing.

Edited by sLoPpYdOtBiGhOlE
Link to comment
Share on other sites

  • Recently Browsing   0 members

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