[Modding Question] BHAV calling scope

(1/2) > >>

rufio:
I understand the concept of globals: any BHAV from any group can call them, but they can't call BHAVs from other groups.  Does this extend to BHAVs defined in a package file that contains overridden globals with the group 0xFFFFFFFF?  E.g., say I have written a new version of global BHAV 0x0XYZ and in the same package where my version of 0x0XYZ is, there is a private BHAV with instance 0x1001 and group 0xFFFFFFFF.  Can I call the 0x1001 BHAV from 0x0XYZ, or do I have to create a new global?  I did create new globals in my family hack, but I do (and did) realize that that's not a great thing to do, and I want to know if there's a way around it.

J. M. Pescado:
0xFFFFFFFF is automatically remapped to a random group, so 0xFFFFFFFFs cannot call others not in their package. An 0x2XXX semiglobal can call a local 0x1XXX, with the resulting local that runs being the one attached to that object. It is not known what happens if an 0x0XXX global tries this, as there is no telling what will run if this happens. If you wish to invoke a specific effect, it is best to use RTBN, so that the BHAV will be invoked by name instead of by instance number.

rufio:
I see.  If the 0xFFFFFFFF BHAV is in the same package as the OBJD/OBJf of the current stack object than it can be called via RTBN, right?

I have another question about tokens, too - I have gotten one to work as I want it to, but it does not seem to be saving when the game is saved.  I've looked through multiple token-using hacks made by other people, and I can't see what I'm doing wrong.  HALP?  Token has OBJD, OBJf, unique GUID, can be added to neighborhood memory and have its properties modified, etc., but when the game reloads it can't be found.

J. M. Pescado:
Quote from: rufio on 2009 December 22, 22:30:27

I see.  If the 0xFFFFFFFF BHAV is in the same package as the OBJD/OBJf of the current stack object than it can be called via RTBN, right?
Any BHAV may be called by RTBN, regardless of whether it is global, semiglobal, or local, whether or not is an 0x7FXXXXXX, or an 0xFFFFFFFF. That's the entire point of RTBN. Any "local" will always be run in preference over a semiglobal over a global. It does not matter what groups are involved here, or whether the instance numbers are the same across all objects that may the RTBN may be invoked on.

rufio:
Right - but just to be clear, it's local/semiglobal where the current stack object is concerned, right?  So, like with the spell code, you get something like:

Ensure that SO is an instance of (Spell GUID)
RTBN "CT - Cast Spell"

which will run the CT - Cast Spell that's in the same group as the spell object, if it exists, and otherwise some general semiglobal version, and this is completely independent of the group number of the calling BHAV.  (Right?)

Navigation

[0] Message Index

[#] Next page