GetFirstRef and Stacks of Objects

Post » Thu May 03, 2012 11:45 pm

I'm trying to work with all the MISC objects in a cell. Using:

GetFirstRef 31 0 0

and

GetNextRef

I'm walking through the items. Unfortunately, it seems that if the cell has a stack of MISC items (say a stack of coffee cups), those functions point to the stack and not to the individual items in the stack. If I activate that "item" (which should be the stack) as the player, it puts a single item (coffee cup) into the players inventory and not the stack. Everything beyond that first item is gone.

So, a couple of things: first, I'm assuming GetFirstRef and GetNextRef point to (approximately) the closest item of that type to the player and not to ALL items of the type closest to the player. Second, is there some way to get a count of the items being pointed to before activating them and getting them into the inventory (or, failing that, some way to activate the whole stack)?
User avatar
Vincent Joe
 
Posts: 3370
Joined: Wed Sep 26, 2007 1:13 pm

Post » Thu May 03, 2012 10:42 pm

int form.GetRefCount() - returns the number of items in a stack

it's one of the commands that were added in the last update.
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Thu May 03, 2012 2:24 pm

Thanks. That does the job. Unfortunately, the game doesn't seem to like processing many stack of items (CTD after a bit). I'll have to figure out why. But, the GetRefCount function is what I need.

BTW: where did you find reference to that? I searched the GECK and FOSE pages and came up with nothing.
User avatar
Kat Stewart
 
Posts: 3355
Joined: Sun Feb 04, 2007 12:30 am

Post » Thu May 03, 2012 8:53 am

When the FOSE team did their last command update (I think only Scruggs(?) was left doing it for FO3 at the time), I kept the list of commands he posted here.

float form.GetCurrentHealth() - returns the health of form
void SetCurrentHealth(float health, ref form) - sets the health of a form
float Rand(float min, float max) - returns a random value between min and max
int form.GetNumItems() - returns the number of items in a container
ref form.GetInventoryObject(int idx) - returns the type of the specified item in the container
int form.GetRefCount() - returns the number of items in a stack
void form.SetRefCount(int count) - sets the number of items in a stack
float Pow(float a, float B) - returns a ^ b (b does not need to be an integer)
int form.IsQuestItem(ref obj = NULL) - returns if form (or obj if present) is a quest item
void form.SetQuestItem(int arg, ref obj) - sets if form/obj is a quest item
int form.IsOffLimits(ref actor) - returns if the specified door is off-limits to the actor (note: apparently not 100% reliable for the player yet)
ref form.GetParentCellOwner() - returns a ref to form's parent cell
ref form.GetOwner() - returns a ref to form's owner
int form.GetOwningFactionRequiredRank() - returns the rank someone must be of the owning faction to be considered an owner of form
int form.GetOwningFactionRequiredRank() - returns the rank someone must be of the owning faction to be considered an owner of form's parent cell
ref GetCurrentQuest() - returns the current quest
ref GetCurrentObjective() - returns the current objective
int GetQuestObjectiveCount(ref quest) - returns the number of objectives for the specified quest
ref GetNthQuestObjective(ref quest, int idx) - returns the specified objective of the specified quest
void SetCurrentQuest(ref quest) - sets the player's current quest
int form.IsPersistent() - returns if form is persistent
int form.SetEyes(ref eyes, ref target = NULL) - sets the eyes of form (or target if specified)
int form.SetHair(ref hair, ref target = NULL) - sets the hair of form (or target ir specified)
int form.SetHairLength(float length, ref target = NULL) - sets the hair length of form (or target if specified)
ref form.GetEyes(ref target = NULL) - gets the eyes of form (or target if specified)
ref form.GetHair(ref target = NULL) - gets the hair of form (or target if specified)
float form.GetHairLength(ref target = NULL) - gets the hair length of form (or target if specified)
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am


Return to Fallout 3