niston Posted January 7 Share Posted January 7 Will return the plugin-relative record ID for references defined in plugins. For references created at runtime, the full form ID is returned. The record ID is the form's ID without the plugin index, ie FE001003 becomes 3. Likewise, 4C006481 becomes 6481. However, FF040205 will remain FF040205. Int Function GetRecordIdFromForm(ObjectReference queryForm) Int formId = queryForm.GetFormID() Int msByte = Math.RightShift(formId, 24) If (msByte == 0xff) ; not a plugin defined reference Return formId EndIf Int recordId = 0 If (msByte == 0xfe) ; light plugin recordId = Math.LeftShift(formId, 20) recordId = Math.RightShift(recordId, 20) Else ; regular plugin recordId = Math.LeftShift(formId, 8) recordId = Math.RightShift(recordId, 8) EndIf Return recordId EndFunction Requires F4SE. 1 Link to comment Share on other sites More sharing options...
Recommended Posts