Jump to content

A script to make all actors except for designated actors leave a room?


VanyarElf

Recommended Posts

Hey everyone, I'm having trouble finding a way to program a script  for New Vegas GECK which makes every NPC who hasn't been designated ( I.E, Player and another NPC ) leave a room located inside an interior cell. Any idea how I would go about doing it?

Edited by VanyarElf
Link to comment
Share on other sites

On top of my head I’m thinking through packages. See https://geckwiki.com/index.php?title=AddPackageAt

https://geckwiki.com/index.php?title=Category:Package_Functions

you can set everyone that should leave be in a certain faction. Then do an if statement that says if the npc is in that faction. Add this package. Which makes them travel to the specified location in that package.

 

Link to comment
Share on other sites

6 hours ago, oscarwellton said:

On top of my head I’m thinking through packages. See https://geckwiki.com/index.php?title=AddPackageAt

https://geckwiki.com/index.php?title=Category:Package_Functions

you can set everyone that should leave be in a certain faction. Then do an if statement that says if the npc is in that faction. Add this package. Which makes them travel to the specified location in that package.

 

Yeah, seems like an NVSE function, so far I've been working exclusively with the GECK's native script for accessibility and relying on OnTriggerEnter GetActionRef to basically expel all NPC's by teleportation while a quest objective or stage is running, but if it doesn't work out too well then something more natural will certainly be nice.

Link to comment
Share on other sites

True!
Maybe you could achieve the same with purely conditions in packages and “activate” it depending on how you want to trigger it. https://geckwiki.com/index.php/GetInCell?
 

Or if you wanna get more specific I think you need to use triggerboxes like you’re already doing.

What is considered natural for you? That they aren’t teleporting? Then I suppose packages is your only route. 

Link to comment
Share on other sites

9 hours ago, oscarwellton said:

True!
Maybe you could achieve the same with purely conditions in packages and “activate” it depending on how you want to trigger it. https://geckwiki.com/index.php/GetInCell?
 

Or if you wanna get more specific I think you need to use triggerboxes like you’re already doing.

What is considered natural for you? That they aren’t teleporting? Then I suppose packages is your only route. 

Yeah I thought about packages, the problem is that the room I want to bar them from is not a separate cell, it's a single room inside the same interior cell so getincell wouldn't work, specifically I'm modifying a room in the BoS bunker in Hidden Valley, which means that I'd have to add a package for like 20 different NPC's just to stop them from entering the room, which seems prone to bugs and bloat sadly.

NVSE or using what I'm doing right now appear to be the only options. It's strange there isn' a function other than MoveTo which simply makes NPC's turn around and walk away.

Link to comment
Share on other sites

I see.. but then again, it is a 13 year old game. So in that perspective I think we got quite a lot to work with though.

I'm quite new to modding but come to think of it. How does evelators move in the game? I'm thinking if you can "move" objects, why not npcs. But maybe then they might not even walk, just floating away 😂

Link to comment
Share on other sites

On 12/18/2023 at 8:35 AM, oscarwellton said:

I see.. but then again, it is a 13 year old game. So in that perspective I think we got quite a lot to work with though.

I'm quite new to modding but come to think of it. How does evelators move in the game? I'm thinking if you can "move" objects, why not npcs. But maybe then they might not even walk, just floating away 😂

I don't recall any functional elevators in New Vegas, I think all the 'elevators' just transition you to a different cell. Theoretically you would probably just set them to move up the Z axis on player button trigger, which could be done with an actor but you run into the same problems:

1. There doesn't seem to be a way for the game to recognize actors present in a certain area *within* a a cell and then apply actions to all of them save for an excluded actor. GetActionRef only returns the last object/actor to interact with an activator

2. Pushing them out will only make them keep trying to go inside and constantly get pushed against an invisible wall because their package is still turnning

3. Even if you modified the packages of every single NPC in that cell individually, it wouldn't help if say, you also wanted to make the mod compatible with custom NPC's and push them out from an area, not to mention being pretty messy for just clearing a room.

 

It's really weird to me that there's no simple function which simply tells every NPC, with dictated exceptions, to just avoid a room with a trigger box. Like, don't try walking into there. You could delete the navmesh in it, but that would prevent NPC's from *ever* coming back there, and I only want them leaving temporarily.

My current workaround of starting an OnTriggerEnter script upon reaching a certain quest stage and just teleporting every single NPC that goes in there who isn't the player or a desired NPC is taking care of all of that, would be great if it was more natural but can't have everything I suppose.

Link to comment
Share on other sites

Hmm, maybe have the original door disabled and replaced with a door that is inaccessible during the quest stage, parenting one to the other and using opposite to parent flags on the doors. Then have the original enabled again at the end of the stage? Being opposite to parent will make sure only 1 door is enabled so wont have issues there at least?

 

I dont know for sure if npcs can bypass the inaccessible flag but I dont think they can. It might keep them out of the room once you get them out and the door being marked inaccessible might prevent them from even trying to path back in there till the original door is enabled again. 

 

Just all some wild and half baked thinking lol. And still doesnt address your issue of getting them out at all, which seems to be the biggest part.

Link to comment
Share on other sites

GetDistance would do what you want ... place an object for their script to check against.

If GetDistance MyObject01 <= 2467

    StartQuest MyClock01

{which is set to slow delay}

    With a Quest Script checking a few simple variables , turning on Effect Scripts , or some such change to the game play.

Like I was thinking of a druid gameplay ... mostly based on all creature ally /~/ all humans .

Sorta like the zerg and terrans . . . and maybe later the protoss ?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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