Jump to content

CRE file update/states.ids


CamDawg

Recommended Posts

IESDP lists the dword at 0x20 in a creature file as 'Permanent status flags (STATE.IDS)'. However, bit 19 (STATE_DISEASED per state.ids) is set by Deactivate() and a creature with this flag will be invisible and return false to IsActive() checks in BG2-ToB.

Link to comment

It already says that in the state.ids description:

0x80000 STATE_DISEASED

This state indicates whether the creature is "active" (as set by Activate/Deactivate actions).

 

The "permanent" in the "permanent status flags" is not absolutely true, since the core, actions and effects can set/unset them. It was meant more in a non-temporary (no predefined duration) way.

Link to comment

The creature activate/deactivate bit is used only when the creature is saved. In memory, it is always STATE_DISEASED.

 

Lynx: CamDawg surely knows what 'permanent' means in this context his problem was not about that.

 

CamDawg: the relevant 'hack' that does this is here:

loc_8B7118:							; CODE XREF: sub_8B6E7F:loc_8B70F9j
.text:008B7118 210				 mov	 edx, [ebp+pActor]
.text:008B711E 210				 cmp	 [edx+actor.field_2C08], 0
.text:008B7125 210				 jz	  short loc_8B7147
.text:008B7127 210				 mov	 eax, [ebp+pActor]
.text:008B712D 210				 mov	 ecx, [eax+actor.basestats.state]
.text:008B7133 210				 and	 ecx, not 80000h
.text:008B7139 210				 mov	 edx, [ebp+pActor]
.text:008B713F 210				 mov	 [edx+40Eh], ecx
.text:008B7145 210				 jmp	 short loc_8B7165
.text:008B7147	; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
.text:008B7147
.text:008B7147	 loc_8B7147:							; CODE XREF: sub_8B6E7F+2A6j
.text:008B7147 210				 mov	 eax, [ebp+pActor]
.text:008B714D 210				 mov	 ecx, [eax+actor.basestats.state]
.text:008B7153 210				 or	  ecx, STATE_DISEASED
.text:008B7159 210				 mov	 edx, [ebp+pActor]
.text:008B715F 210				 mov	 [edx+actor.basestats.state], ecx

 

In other words, field 0x2c08 (actor is hidden) determines the 0x80000 bit of basestats[iE_STATE] (the permanent state flags).

This hack is called before every 'writeactor', 'exportactor' etc.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...