Aller au contenu

Photo

NWNX_funcs output all cariables on a creature


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
DM_Vecna

DM_Vecna
  • Members
  • 280 messages

Does anyone have a function already built that will output a list of all variables stored on a creature? Virusman said that this is possible by using GetFirstLocalVariable and GetNextLocalVariable. However I am no Virusman and it will take me much longer to figure this out than grab a working function from someone else. If anyone is interested below is where I am currently to get this to work for myself. But it seems that I am getting a TMI error due to my while statement never concluding. 

 

THanks for any help

 

 

void ListVariables(object oCreature)
{
AWA_DEBUG("awa_inc_spawn/ListVariables: Fired");
struct LocalVariable PCVars = GetFirstLocalVariable(oCreature);
AWA_DEBUG("awa_inc_spawn/ListVariables: name = "+PCVars.name+" pos = "+IntToString(PCVars.pos)+" obj = "+ObjectToString(PCVars.obj)+" type = "+IntToString(PCVars.type));
 
    while (PCVars.obj != OBJECT_INVALID)
    {
    PCVars = GetNextLocalVariable(PCVars);
    AWA_DEBUG("awa_inc_spawn/ListVariables: name = "+PCVars.name+" pos = "+IntToString(PCVars.pos)+" obj = "+ObjectToString(PCVars.obj)+" type = "+IntToString(PCVars.type));
 
    }
}


#2
leo_x

leo_x
  • Members
  • 223 messages

The object in the local variable struct is oCreature so it will never be OBJECT_INVALID.  In the while predicate you can use the nwnx_funcs function: 

int GetIsVariableValid (struct LocalVariable lv);