Jump to content

Is there a way to "automagically" update actor values depending on other actor values?


Recommended Posts

I'm making all sorts of perks for both player and NPC in order to make SPECIAL stats have at least a token effect. For example, for every point of agility anyone gets 1% movement speed, perception slightly decrease enemy resistances and increases accuracy (decreases Cone-of-fire Mult), that sort of thing.

Perks have "Multiply 1 + Actor Value Mult" which is great, but I can't find a way to apply that to actor values, and think there may not be one, maybe so you can't create feedback loops (e.g. increasing charisma by luck and luck by charisma).

Perks can of course apply spells which in turn apply magic effects, but unless I'm mistaken you can't pass in the magnitude from the perk to the magic effect (i.e. make the magnitude depend on the actor value). Can that taking an AV into account be done in the spell or magic effect itself maybe?

Worst case I'll just do it in an OnLoad event via script, and since this doesn't need to be updated constantly, I'd be more than okay with that. But I barely know enough about perks, spells and magic effects to make very simple things work, so I wanted to ask just in case I missed something.

Edited by NeinGaming
Link to comment
Share on other sites

WOuldnt it be possible to add a inherent perk, spell, ability, with a condition which fires based on your preference ? You of course must add this by default to your player actor and or race

Link to comment
Share on other sites

  On 4/28/2025 at 11:25 PM, NeinGaming said:

Worst case I'll just do it in an OnLoad event via script, and since this doesn't need to be updated constantly, I'd be more than okay with that. But I barely know enough about perks, spells and magic effects to make very simple things work, so I wanted to ask just in case I missed something.

Expand  

When magic effect with Archetype=Script is applied (bacause of Perk or Spell) then corresponding ActiveMagicEffect script is attached to the actor.

Entry point of ActiveMagicEffect is OnEffectStart, exit point - OnEffectFinish

But... there is the big problem - script can be silently detached (moved to unbound state) by engine when Actor remain in unloaded cell. No events, no warnings, you just face that script is in unbound state (when script's properties partially cleaned up) during this script function execution.

You can check ActorManager.psc and API.psc from my Additional Attributes. I've tried to handle all possible combinations of use cases.

Actually, you can use it as an example how to ensure that timer started within ActiveMagicEffect is properly executing.

  • Like 1
Link to comment
Share on other sites

Posted (edited)
  On 4/29/2025 at 12:17 AM, Qrsr said:

WOuldnt it be possible to add a inherent perk, spell, ability, with a condition which fires based on your preference ? You of course must add this by default to your player actor and or race

Expand  

Yeah I'm using SPID for that to give them to all with ActorTypeNPC keyword

  On 4/29/2025 at 3:54 AM, DlinnyLag said:

When magic effect with Archetype=Script is applied (bacause of Perk or Spell) then corresponding ActiveMagicEffect script is attached to the actor.

Entry point of ActiveMagicEffect is OnEffectStart, exit point - OnEffectFinish

But... there is the big problem - script can be silently detached (moved to unbound state) by engine when Actor remain in unloaded cell. No events, no warnings, you just face that script is in unbound state (when script's properties partially cleaned up) during this script function execution.

You can check ActorManager.psc and API.psc from my Additional Attributes. I've tried to handle all possible combinations of use cases.

Actually, you can use it as an example how to ensure that timer started within ActiveMagicEffect is properly executing.

Expand  

Oh, that explains so much! I had to put all sorts of weird checks to get rid of warnings in the papyrus in some scripts.

I will dig into your mod for sure, I never saw it before!

Before I had thought of a super lo-tech way to do it, by basically storing a copy of each SPECIAL stat as actor value, and then do something like this
 

if (currentAgility != oldAgility)

    ModActorValue(AV_SpeedMult, (oldAgility - currentAgility) * 0.01)

    SetValue(oldAgility, currentAgility)

endif

But being able to register for attribute changes is so much cooler, thank you ๐Ÿ™‚

I barely skimmed the description and example and I can only say I wish I had known of this sooner haha, so cool. Especially being able to init AV with a random value between min / max values, I always wanted this.

Edited by NeinGaming
Link to comment
Share on other sites

  On 4/29/2025 at 9:51 AM, NeinGaming said:

Before I had thought of a super lo-tech way to do it, by basically storing a copy of each SPECIAL stat as actor value, and then do something like this

Expand  

You can use my F4DS to implement it in more predictable way.

1) Use for example, DS:FormSet to store all Actors you want to manage

2) Create a Quest with some timer. For example, run timer each several minutes

3) In the timer handler iterate over all stored Actors and calculate new values for each Actor. 

 

Edited by DlinnyLag
  • Like 1
Link to comment
Share on other sites

Oh those data structures look very cool... I will use that for sure, but not to keep track of all the actors, since it applies to so almost everyone anyway ^^

And I just saw your String Attributes mod, too! Another thing I often wished for. Right now I generate a name for some peeps with the formlists from the Alias mod, and just store it in a local script variable to then append stuff to it for the actual name. Storing that name in an actor value instead is so much better.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
ร—
ร—
  • Create New...