Jump to content
Sign in to follow this  
CamDawg

CRE file update/states.ids

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.

Share this post


Link to post

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.

Share this post


Link to post

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.

Edited by Avenger

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...