Aller au contenu

Photo

Retrieving a struct from an object


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
  I'm curious if this can even be done.

  Essentially, I want to be able to retrieve the data stored in the CombatInfo struct on the PC.

   A simple way to retrieve things like base AB modifier would be extremely useful for certain things, like a properly calculated disarm check.
 
  An ability to write directly to the struct would be even better. but just read access to it would be a nice start.

  Does anyone know of a way to go about this?

#2
henesua

henesua
  • Members
  • 3 883 messages
How is the data that populates the struct stored? In my understanding, you can not store a struct on an object, but rather you have to store all the pieces as ints, floats, strings, or objects. If I am wrong I would be very happy to hear it. Once you load this data into the struct however it is easy to return the struct entire from a function.

So as to your question I assume that it is this particular struct you are trying to access. To do so I think you need to find the functions buried in the scripts that were written to organize the struct in the first place. As to that I don't know where they are.

You could however create your own version of the same struct, and write your own custom functions to populate it.

#3
WhiZard

WhiZard
  • Members
  • 1 204 messages

henesua wrote...

How is the data that populates the struct stored? In my understanding, you can not store a struct on an object, but rather you have to store all the pieces as ints, floats, strings, or objects. If I am wrong I would be very happy to hear it. Once you load this data into the struct however it is easy to return the struct entire from a function.


It's not on the object so much as it is on the bic save character file.  I have no clue on how to access it.

#4
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
The numbers stored in that struct in the bic seem to be the ones displayed on the character sheet, which would mean they're stored somewhere the engine can rapidly access them.

I suppose someone might be able to trace the functions that run when the character is initially loaded to find what reads them, and where they're stored, but that's well beyond what I know how to do.

#5
henesua

henesua
  • Members
  • 3 883 messages
Why not just make your own struct and set of functions? Is there any data that you are unable to access? It seems to me that with regards to PC stats every one is accessible by standard functions. You could pull all this off and fill your own struct. Additional modifiers can be determined by a sweep through PC feats correct?

Or am I missing the point in that you didn't want to have to recreate the wheel?

#6
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
Checking an existing int is almost always going to be more efficient than recalculating what went into it to begin with.

It's a similar issue with things like GetMetamagicFeat(). It's data either stored on the PC, or on the module but in a way directly referencing the PC. A way to access and manipulate these "hidden" data types would open up a huge number of scripting possibilities.

#7
virusman

virusman
  • Members
  • 282 messages
Check the list of functions in nwnx_funcs. Only NWNX can access this data, so if there are such functions, they'll be in nwnx_funcs.