Jump to content

Some suggestion about script


liarliar00

Recommended Posts

1. about workshop

I am creating a custom settlement mode. For test I sent NPCs from Sanctuary to the new settlement. Marcy Long, Piper, Cait, and 2 settlers(who were orignally in the tenpines bluff and I moved them to Sanctuary using console command). All of them moved to the new location successfully, except the settlers : They stuck near the Red Rocket Station and Abernathy Farm.

So I created another plug-in just to monitor how they move. Simple quest which has the settlers as aliases and display objective at quest start so the compass will be pointing them. Then they suddenly moved to my settlement successfully without getting lost. Then I thought, maybe adding them to quest alias prevent them to lost tracks. So I edited quest alias and script about workshop a little bit.

(1) add a RefCollectionAlias to WorkshopParent Quest with Optional flag and 0 Max Initial Fill Count
(2) Add functions at the end of WorkshopParentScript to add or revmove refs to/from alias I created in (1)
(3) add some lines to the WorkshopNPCScript to run the function in (2) : on transfer event and on picking up companion event
(4) Attach a script to the Alias I created in (1) : to remove refs when NPC is in the new settlement / or NPC died

Then the settlers didn't get lost again. This might not be a solution for every lost settlers while in transfer, but at least some of them won't get lost.

2. about Multi Actor Trigger

 I experienced bug about Piper and Nat Dialogue Scene : Nat runs to try to initiate dialogue with Piper while she's not even in Diamond City. As you can see above, Piper was in the Sanctuary, but anytime player walk into diamond city, Nat runs for the scene.

At first, I suspected it would has to do with quest conditions. But after looking at it, I realized it has to do with trigger's script : DefaultOnEnterMultiActor

I knew it because I exprienced similar bug when I was creating another mod : I placed some cages to imprison some NPCs. Cages also have doors that is automatically closed. And I also added a trigger outside of the cages to prevent the door closed while player's in the cage or the prisoner's out of it. The trigger add or reduce integer when OnEnter or OnLeave event(just like the way MultiActor script counts the refs)

Then the trigger malfunctioned : any ref which is already in the trigger also can trigger another enter event without leaving it, makes the intergar unreliable. So I changed the script : OnEnter or OnLeave event, ref will be added or removed to/from RefCollectionAlias to prevent overlap. And the count is directly from the Alias. After that, the malfunction was gone.

And this time, I used similar solution to edit DefaultOnEnterMultiActor script : it doesn't add or reduce the number, but it add or remove refs to/from objectrefence array and get count from it. Then the dialogue scene bug was also gone.

I attach my files here. Please take a look at it and use it on your next update if you think it's worth of it. Thank you for reading this long article.

 

Workshop Transfer Patch UF4P Ver.zip DefaultOnEnterMultiActor.psc

Link to comment
Share on other sites

You can't move settlers around with console commands. There's a ton of extra stuff that needs to be done to make this work, and there are dedicated functions on WorkshopParentScript to handle that. If you don't do it properly, the affected NPCs may glitch out in various ways. That's nothing new.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...