This is driving me crazy--I've been trying to debug for the past 3 hours. Maybe someone else can spot my error. Getting things to compile has been easy, but getting a real value returned has proven fruitless.
I have a script attached to a quest, the relevant snippet of which is:Scriptname ESFAelaCoreDialogueScript extends Quest Conditionalint Function GetiAggroMode() return 1EndFunction
Then, to a reference alias in another quest, I attached this script:Scriptname ESFAelaActorAliasScript extends ReferenceAlias ESFAelaCoreDialogueScript Property CoreQuest Autoint iOldAggroMode = -1Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) iOldAggroMode = (CoreQuest as ESFAelaCoreDialogueScript).GetiAggroMode() Debug.MessageBox("Aela Hit Event -- Old iAggroMode is " + iOldAggroMode)EndEventWhen Aela gets hit in combat and the OnHit event triggers, what appears in the MessageBox is "Old iAggroMode is 0". It should be 1.
I can tell from debugging that the GetiAggroMode() function simply isn't being called--a debug messagebox added to the top of that function never appears. Yet it all compiles fine. And if I change the function name in the OnHit handler to, say, GetiAggroModeX(), the compiler throws an error that a function of that name doesn't exist--so it is looking in the right place.Edit:
Success!The code above this post in this thread may have worked for other people, but what ended up working for me was much simpler. I should have just read the wiki text more carefully, as it basically lays out the solution. Basically, in the script that needs to access a property from a quest script, you first define a Quest property, assign it to the quest in the Properties window, and then accessing that quest's properties and functions is simple:
Scriptname ESFAelaActorAliasScript extends ReferenceAlias Quest Property MyQuest Auto int iOldAggroMode = -1Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) iOldAggroMode = (MyQuest as ESFAelaCoreDialogueScript).iAggroMode
Is how I can access the iAggroMode property--there's no need to create separate functions for set and get, as long as you used "auto" on the property in the core quest.