Jump to content

Going from Form to Reference


TheNonsenseFactory

Recommended Posts

Hi all,

 

I know there is a script extender function to go from a reference to the base object, but how do I go the other way?

 

I have a Form reference, and I want to find out how many instances of that form are in the game, so I can determine if it is a unique NPC.

 

If it is a NPC and there is only one in the game then I want to perform some reference functions on it, so I need it as a reference, not Form.

 

Grateful for any assistance!

 

 

 

 

Link to comment
Share on other sites

So, essentially you want a function to return the 'Count' in GECK. I do not think there is one. Also, some unique NPCs are not unique (There are 3 Bennies and 2 Fantastics) and some generic named ones are.

 

You could:

 

1) Create a form list "Unique NPCs" or "Non-Unique NPCS" and check actors against it. Simple, but problematic for mod-added NPCs.

 

2) Create an array with the names of all generic actors ("Wastelander", "Fiend", "NCR Trooper", etc), if the name of an NPC is not in it, assume they are unique. Make sure you get the names from NPCs in game rather than typing them in, if you want compatability with other language games.

 

let Generic_Names := Ar_List $1EFiendMeleeAAM, $1ERefugeeAAF...

if eval (Ar_Find $SomeActor, Generic_Names) == -1

; SomeActor is unique, they do not have a generic name

 

--

 

There could be an easier solution, what purpose do you have?

Link to comment
Share on other sites

My purpose is to find out if an interior cell can be considered "abandoned" or not. I know I could hand-code it for each cell, or make a list of each unique NPC, but I was hoping there was a nice dynamic script solution like so:

  1. Check what cell the player is in
  2. Get owner of that cell
  3. If owner is unique, is not the player and is dead then cell is abandoned.

I can do 1 and 2, but since the result from 2 is a Form then I can't do 3.

 

The end goal is my own curiosity and helping out GodOfWolves with his Massive Object Ownership Revamp mod (if he hasn't figured it out himself already).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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