Jump to content

[LE] How to add a note to a existing actor without editing the source?


JPTR1

Recommended Posts

@ greyday01


"If you add an item to the actor reference wouldn't that actor's inventory eventually respawn back to what the base actor's inventory was set as? Like merchants."

- I'm not taking in account that there will be a long period between the moment you add the note to the moment the player meets the actor, I'm not taking in account the cell's 'Reset' function, since no further info on the matter was given.

I thought the OP wants this once it happens, then imidiately interact with the actor, or in a short period of time, until you go meet the actor.


"If you want that actor to always keep that item wouldn't you need to add it to the actor base object?"

- Yes


"If you needed the actor to only have it for a short period is there a way to add it to the actor reference shortly before you encounter him?"

- Yes, there a couple of ways this can be done, I'll expand 1 based on the same simple logic, but with 2 scripts and 1 AbSpell.

- We will use 'OnInit()' to add an AbSpell which will check for condition like if the player has interact with the actor, etc...

* We use an Ability Spell because its magic effect will only fire once the player loads the actor and the cell the actor is in, and we do this for consistency reasons, since OnLoad - OnCellAttach may not fire under specific conditions.


1) Create a Magic Effect and add to it this script:


Book Property MyNote Auto
Spell Property MyAbSpell Auto
Actor BaseActor

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
Actor BaseActor = akTarget.GetActorBase()
;;Here we can check for multiple things
ENDEVENT

EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
If ( ;;All that needed to be checked is checked, and now we remove the Ab and the note from the base actor )
BaseActor.RemoveSpell(MyAbSpell)
BaseActor.RemoveItem(MyNote)
EndIf
ENDEVENT

* Here we can expand this even further and check if the player has actually talk with the actor, or if after interacting with the actor it nay still have the note, or has 'LOS', or whatever your quest may require, before making the AbSpell remove itself from the actor.


2) Create an AbSpell with the Magic Effect above


3) Add an xMarker in a cell and add this script:


Actor Property MyActor Auto
Spell Property MyAbSpell Auto
Book Property MyNote Auto
Actor BaseActor

EVENT OnInit()
Actor BaseActor = MyActor.GetActorBase()
BaseActor.AddSpell(MyAbSpell, 1)
BaseActor.AddItem(MyNote, 1)
Self.Disable()
Self.Delete()
ENDEVENT

And that's about it, keep in mind that since I've no idea of the actual idea under development, I'm just providing example solutions of the logic, which need furthe development and that one can use to expand and modify it to his needs.

Most of the times is very hard to provide a solid solution since the OPs don't want to go into details, which are vital to provide a proper 100% with no issues working solution.


Also, sorry for any 'typos'. I'm on vacations and I\m using my phone which I can't see S****, and already had to make / edit this post 3 time...


EDIT: Had to edit it one more time because I confused my own thoughts.

Edited by maxarturo
Link to comment
Share on other sites

It is always my intention not to bother others with unnecessary details, but considering the various possibilities, it might would have been useful in this case.

 

For me, your first solution should be fine, since the note has no importance and doesn't bother even if my mod isn't played or has been finished. It's just a letter that explains the background of the story a bit. More like an easter egg if you find it.

 

Happy holiday!

 

Edit: Works now, even as quest-alias with showing the Player's name inside the letter.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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