PJMail Posted June 16, 2022 Share Posted June 16, 2022 I would like some advice from those knowledgeable on quest aliases and the pitfalls before attempting the following (as my knowledge in this area is very limited and am just trying to not have to learn by mistake). My idea is create a (stopped) quest with a single Refcol Alias (unpopulated) with the required package on it, fill that refcol via a separate script (using refcol.clear() and refcol.addref(npc) calls), then start/stop the quest when I want that package added/removed from those NPC's. Will this work? Can I change the contents of the refcol when the quest is stopped - and it will then use the new contents when started again? Are there delays in the application/removal of the Package when quest starts/stops? I simply want to force an AI package on (and off) a number of NPC's via script and this seems the only way - but if someone knows a better way then please enlighten me! Thanks in advance... Link to comment Share on other sites More sharing options...
SKKmods Posted June 16, 2022 Share Posted June 16, 2022 No that wont work well as the aliases will clear when you stop the quest, so you would just have to fill 'em again. Using that outline approach, best would be to add a global variable CONDITION to the AI package and switch the global variable value in script to enable/disable the package: If (bEnableMyPackage == True) pMyGlobalCondition.SetValue(1) Alias_MyRefCollectionAlias.EvaluateAll() Else pMyGlobalCondition.SetValue(0) Alias_MyRefCollectionAlias.EvaluateAll() EndIf Link to comment Share on other sites More sharing options...
PJMail Posted June 16, 2022 Author Share Posted June 16, 2022 (edited) Thanks SKK, I knew it wouldn't be as simple as it looked (Bethesda...). I gather from what you say that I can change the contents of the refcol while the quest is running but nothing actually happens until I do the 'evaluateall()'? As I don't want the quest running all the time can I instead do something like this (assume the Package has that Global condition on it as you suggested): myquest.start()Alias_MyRefCollectionAlias.addref() - however I wish to populate the refcol (via script as no fill will do what I want)pMyGlobalCondition.Setvalue(1)Alias_MyRefCollectionAlias.evaluateAll() And when I no longer want the NPC's to use the package I do: pMyGlobalCodition.SetValue(0)Alias_MyRefCollectionAlias.evaluateAll()myQuest.stop() So I don't need to do a 'refcol.clear' as the quest stop will do that? And remove the package from all those NPC's in the refcol?Immediatelyy? Edited June 16, 2022 by PJMail Link to comment Share on other sites More sharing options...
SKKmods Posted June 16, 2022 Share Posted June 16, 2022 Actors update their AI package "stack" priorities on a regular basis, although when busy it can take a minute. EvaluateAll causes that to happen RIGHT NOW for time critical packages. When a quest is shut down it clears its aliases so the packages/keywords/spells attached to actors via its aliases should also be removed, although I have never actually done this to validate. Why do you not want the quest running all the time ? If its a one time only limited deal you may be better off using ReferenceAlias.ApplyToRef(thisActor) to apply alias data to actors without holding them in the alias. Then switch the package(s) with the global variable and wait a little for actors to update themselves. Its how workshop parent configures settlers without holding 'em all persistent in an alias. Link to comment Share on other sites More sharing options...
PJMail Posted June 17, 2022 Author Share Posted June 17, 2022 (edited) I understand how the AI stack works, but I am clueless on how/when quest aliases apply a package to the references in the alias's refcol (particularly when not using a fill criteria to populate it). All black magic to me. So - I assumed stop/starting the quest would 'force' this (the placement of the AI package on the NPC's stack I mean).I'm not talking about the NPC 'noticing' the new package (I know this can take time unless evaluate is called). However, the 'applytoref()' sounds like it may do what I want directly - thanks, I will look into it.As I said, I am not wedded to any particular solution - I just want to be able to 'inject' an AI package into a number of NPC's 'on the fly' temporarily (via scripting) - and quest aliases seemed the only way.I should add a solution 'with the least number of undesirable side effects' is preferable!!! (though the NPC's I am dealing with are normally Persistent anyway) Update: I assume the quest that has the alias you reference in the questalias.applytoref() call must be running? Edited June 17, 2022 by PJMail Link to comment Share on other sites More sharing options...
SKKmods Posted June 17, 2022 Share Posted June 17, 2022 A quest must be running for aliases and dialog to work. I dont know what would happen to packages if you stop your ApplyToRef host quest. You would need to test that if leaving a quest that isn't doing anything running is a big deal (it is not). Link to comment Share on other sites More sharing options...
niston Posted June 18, 2022 Share Posted June 18, 2022 Look at the settler bell.It temporarily adds a package to make the settlers go to the bell and stand around there.After a timeout, the package is removed. Basically, it uses an event that starts a quest which then applies the package and runs a timer. As the timer expires, the quest shuts down.The Refcol alias used is filled by the quest script itself. I based the Church Bell in Concord on the same method, to have settlers flock to the church and sit in the pews, when the bell starts tolling as you push a button on the lectern to call a town hall meeting. The bell will toll for 15 minutes gametime and those settlers that don't make it in time, get teleported in and snapped into interaction. When you push the button again (or after some timeout which exact value I don't remember), the settlers go back to do whatever settlers are doing. Link to comment Share on other sites More sharing options...
PJMail Posted June 18, 2022 Author Share Posted June 18, 2022 Thanks niston - I had the concept but a working example is always welcome. Update: The settler Bell uses addref to fill the quest alias, whereas SKK's example (workshopparent) uses 'applytoref' which avoids filling the alias (so will probably work better for my purposes). Thanks anyway - now I know how the settler bell works though... Link to comment Share on other sites More sharing options...
SKKmods Posted June 18, 2022 Share Posted June 18, 2022 My ApplyToRef suggestion is just a creative option. For supportability I prefer to keep actors in an active quest alias that is applying an AI package so I can track down issues in the future (persistence be damned in favour of stability and support). Lost many many hours faffing about trying to figure out how a particular base game package got applied to an actor to suppress or over ride with a higher prioirty package ... Link to comment Share on other sites More sharing options...
PJMail Posted June 18, 2022 Author Share Posted June 18, 2022 (edited) Thanks SKK, I was going to risk it - but your reservations have brought up a couple of questions on how 'applytoref' works (looking at workshopparentscript code for example). Perhaps you and/or niston could enlighten me (and any future googlers)... The ref alias used is not a refcol - yet it looks like any number of settlers (NPCs) can use it simultaneously via 'applytoref' - so what remembers it has been applied to particular NPC's? The NPC's themselves? Some dodgy code in the quest (not the alias obviously - that is the point of using applytoref)? Nothing?Corollary to above question - if the quest shuts down how does the game know what 'alias data' to remove from what NPC's?What does 'removefromref' therefore actually do if it is run multiple times against the same NPC (or against an NPC that never had 'applytoref' used)? Bad things? Nothing?If there is actually some disconnect (in this case) between the quest alias 'data' applied, and the quest alias, then what determines the 'priority' of the applied data? My understanding is the quest priority determines the priority of (say) the AI packages it injects via an alias...I simply want to brute force a package on the (top of) the AI stack on a small number NPC's only while they are on a Vertibird (so people stop complaining their poorly created companion/plaything won't stay seated). So many other factors are also involved with those NPC's this will only be a 'best minimum effort' solution anyway... Edited June 18, 2022 by PJMail Link to comment Share on other sites More sharing options...
Recommended Posts