SKKmods Posted October 5, 2017 Share Posted October 5, 2017 I am trying to centralise quest alias-trigger-stage event logic from individual alias/stage scripts into a main script for many and varied reasons. Attaching a standard trigger script to all aliases works great for pre-filled forced references, passing the various events (OnTriggerEnter, OnDeath, OnPlayerDialogueTarget, onActivate ... blah blah) events to the main script: Quest alias: pMQScript.MQTriggerEvent(Self.GetReference(), akActionRef) Main script: Function MQTriggerEvent(ObjectReference akCaller, ObjectReference akAction) Which matches and validates against public properties for action. Fine. The problem is for unfilled quest aliases that are runtime generated either in the stage (PlaceActorAtMe + ForceRefTo) or using the {Create Ref to Object Alias} function. The Main Quest script cant match their Self.GetReference() to anything public for action. So, is it possible to expose example below variables akGunnerBoss or Alias_MQGunnerboss that are generated in a quest stage fragment to the main script for matching when it receives their Self.GetReference() triggers ? Actor akGunnerBoss = pMQTriggerLocation.PlaceActorAtMe(pLvlGunnerBoss, iLevelMod) Alias_MQGunnerBoss.ForceRefTo(akGunnerBoss as ObjectReference) I have had a read around public properties and conditional scripts, but they elude my comprehension. Link to comment Share on other sites More sharing options...
JonathanOstrus Posted October 5, 2017 Share Posted October 5, 2017 I am trying to centralise quest alias-trigger-stage event logic from individual alias/stage scripts into a main script for many and varied reasons. Attaching a standard trigger script to all aliases works great for pre-filled forced references, passing the various events (OnTriggerEnter, OnDeath, OnPlayerDialogueTarget, onActivate ... blah blah) events to the main script: Quest alias: pMQScript.MQTriggerEvent(Self.GetReference(), akActionRef) Main script: Function MQTriggerEvent(ObjectReference akCaller, ObjectReference akAction) Which matches and validates against public properties for action. Fine. The problem is for unfilled quest aliases that are runtime generated either in the stage (PlaceActorAtMe + ForceRefTo) or using the {Create Ref to Object Alias} function. The Main Quest script cant match their Self.GetReference() to anything public for action. So, is it possible to expose example below variables akGunnerBoss or Alias_MQGunnerboss that are generated in a quest stage fragment to the main script for matching when it receives their Self.GetReference() triggers ? Actor akGunnerBoss = pMQTriggerLocation.PlaceActorAtMe(pLvlGunnerBoss, iLevelMod) Alias_MQGunnerBoss.ForceRefTo(akGunnerBoss as ObjectReference) I have had a read around public properties and conditional scripts, but they elude my comprehension. Some things you said don't make sense. I would suspect you have an issue with the implementation of something. Can you post the actual script code you're using to review? And I mean the whole script files not just the function in question. Passing a reference like you stated should work without problem. The only reason it wouldn't, is if the function is getting called on the alias before the alias is filled. Then the GetReference() will return None. And this doesn't make sense from what you described either because it sounds like you're using things like OnTriggerEnter in the script running on the alias. If it's not filled it should get triggered since there's no ref to trigger on. Maybe I misread something. Link to comment Share on other sites More sharing options...
SKKmods Posted October 5, 2017 Author Share Posted October 5, 2017 (edited) Its not passing/getting the reference that's the problem they all send and receive fine. The problem is finding something to compare the received reference to in the main script to know what the received reference actually is. For persistent stuff the script matches to defined ObjectReference properties fine, example: Received: MQTriggerEvent called by [ObjectReference < (0101B1C6)>] action by [ObjectReference < (00000014)>] Matched: MQTriggerEvent called by pTriggerGunnersLocation action by PlayerRef For the transient spawned stuff created in the quest stage fragments I cant see a way of getting the declarations to the main script, example from the GunnerBoss spawn code above: Received: MQTriggerEvent called by [ObjectReference < (FF00190B)>] action by [ObjectReference < (00000014)>] Matched: MQTriggerEvent called by ???????????????????? action by PlayerRef The main script has no way of knowing what FF00190B is. Manually stepping through the logs I can see it is the spawned ref for akGunnerBoss & Alias_MQGunnerBoss. So, how to elegantly post that fact to the main script for evaluation. The simple workaround I started with is to attach an individual calling script with hard coded flag e.g. "I am Alias_MQGunnerBoss" to each of the spawned aliases, but that is unpleasing whilst I'm tidying up the package. Edited October 5, 2017 by SKK50 Link to comment Share on other sites More sharing options...
JonathanOstrus Posted October 6, 2017 Share Posted October 6, 2017 (edited) I'm a bit confused about why you need that other than just pretty printing debug lines. You already know the actual reference because that is getting passed in. If you're just trying to match up which ref alias it was sent from you could add a 3rd parameter to the function call with an int value and then just set an int property on each alias script. You could still use a single templated script but you would need to specify some int value that the main quest script would then act upon. Sort of a rough work around but it might get what you want. Without seeing the sources I can't be of more help since I can't figure out what you're trying to do. Edit: Actually if you added each of the aliases as properties you could do the lazy man's matching game of calling each alias.GetReference() and compare to passedRef value. But again I don't understand why you would need to do that in the first place. Edited October 6, 2017 by BigAndFlabby Link to comment Share on other sites More sharing options...
SKKmods Posted October 6, 2017 Author Share Posted October 6, 2017 No worries, appreciate the ideas. If I cant figure it out from my pretty debug output :) I'll revert to hard coded identity flags or individual alias scripts. Considering the outcome I don't even want the reference, rather a unique but actionable identifier like "spawned boss 001 called this function" to run logic against. Link to comment Share on other sites More sharing options...
SKKmods Posted October 6, 2017 Author Share Posted October 6, 2017 Spawned quest aliases had to go with individual scripts passing a hardcoded OnDeath() flag. Inelegant. Results are here SKK Survival competitive benchmark quest Link to comment Share on other sites More sharing options...
Recommended Posts