Hi there, just registered because the last week all i been doing with papyrus was hitting walls, hard ones, repeately banging my head at them just won't work.
Before i go on an even bigger rant, i just go to the question i'm asking myself right now.
Is there some way to get the currently equipped weapon by an actor as an object reference?
The goal of this is:
I made a sword, which has an enchantment, which has a magic effect, which has a script attached to it. This script counts how often the magic effect is applied to enemies, and do something ones the count reached a certain number. So far the script works great, however what i want it to do is .play (and .stop) an effect shader on the sword.
Function Play(ObjectReference akObject, float afDuration)
Plays this magic effect shader on the specified object for the specified duration in seconds.
there is the problem, i have no idea how to get to the ObjectReference.
I tried .GetEquippedWeapon and cast that as ObjectReference, which i'm sure is utterly stupid, but noobs try stupid things.
I think i can get the object reference with the OnObjectEquipped event, but i can't check this before the magic effect is applied, and when it is applied, the weapon is already equipped so the event will never run.
I also looked at the weapon rack script, this script used .DropObject, wich returns an ObjectReference of the dropped object, but again it's pretty useless. I don't want to drop the sword.
Slowly but surely the thought is creeping up on me, that the equipped weapon can't even be referenced to, that it has to be just lying around in a cell. But why woudn't there be something to do this.
Really hope this is not a total stupid question/issue and that someone can point me in the right direction.