Jump to content

Can I use properties on ActiveMagicEffect


Recommended Posts

Hello.

 

Lets say I have an active magic effect script with a property like this:

Scriptname MyAbiltiy Extends ActiveMagicEffect

bool Property CurrentState Auto

Then I apply that ability to some actor.

Now, If I have a referance to that actor in some other script (like quest script, etc) can I get or change the CurrentState. Something Like this:

ObjectReference target = Game.GetCurrentCrosshairRef()
Actor targetActor = target As Actor
If (targetActor)
	If (targetActor.HasSpell(MyAbiltiy))
		If (targetActor.CurrentState )
			.... some code here
			targetActor.CurrentState = false
		EndIf
	EndIf
EndIf

The above code will not work because the Actor script doesn't have a CurrentState property. Also I can't cast targetActor to MyAbiltiy because an ActiveMagicEffect is not comparable. It isn't even a Form.

 

Is there some way to get a reference to the ActiveMagicEffect for the target actor so I can interact with it's properties?

Link to comment
Share on other sites

No, there's no way to get remote access to the properties of an active magic effect script.

 

Instead you need the active magic effect to look at something else. If that thing needs to be specific to the particular actor you can use factions, inventory items, some of the unused actor values, or even a second magic effect as the general equivalent bool or int properties (or even others in some cases if you're creative). There may be special cases for leveled list generated actors but at least some of those things work.

 

If you need to make sure the active magic effect does something immediately you can make use of default events that get passed through from the ObjectReference or Actor scripts like OnActivate(), OnItemAdded(), OnMagicEffectApply(), etc.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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