Setting a Form as a Property works OK

Post » Wed Jun 20, 2012 7:47 am

The wiki entry for http://www.creationkit.com/RemoveItem_-_ObjectReferencestates
The function accepts a form object, however you can't make a property to a form object

That is not the whole story.

Assume you have a line in your script such as
Form Property myEditorID Auto

If you have added an new form with myEditorID, then using the auto-fill option in the CK it will assign it without problem.
However, if the EditorID does not exist, then the CK selection window does not list the available forms to assign.

Edit: auto-fill does not always work.

So this is a minor bug with the CK.

Workaround simple example.

Assume you have a script that you want to apply to many of your base items to give the player an item when Activated.

ScriptName MyGiverScript Extends ObjectReferenceForm Property myEditorID01 AutoEvent OnActivate(ObjectReference akActionRef)  akActionRef.AddItem(myEditorID01)EndEvent

With one item, as long as you had a base Object called myEditorID01 then auto-fill will work.
But if you had to repeat this on several base objects, you'd need to write a new script with a change of property name for each item.

A workaround exists using TESVEdit.
Add the same script to your itemgiver objects.
Use the CK to autofill the property.
Save and close.
Open TESVEdit and find one of your itemgiver objects.
Select the VMAD subrecord, and open it with the 'Hex Edit' button.
You'll notice the last 4 bytes contain the FormID of myEditorID01, so you can edit this to other base form objects.

So in theory there should be no problem writing one script that can handle multiple types of Form, without the suggested wiki solution of creating different property types for MiscItem Ingredient, etc...

I don't know what all the bytes represent in the VMAD subrecord, so more research is needed here.
User avatar
Big Homie
 
Posts: 3479
Joined: Sun Sep 16, 2007 3:31 pm

Post » Wed Jun 20, 2012 11:21 am

I think I know what you have in mind. Looking forward to seeing the finished product.

Cipscis
User avatar
Thomas LEON
 
Posts: 3420
Joined: Mon Nov 26, 2007 8:01 am

Post » Wed Jun 20, 2012 6:33 am

Well it's not a finished product yet as I'd be more comfortable knowing the full structure of the VMAD.
For single items though it's handy knowing autofill will work.

I'd only used a Form property once and as I'd used an editorID I didn't know it was a problem.

Decoding VMAD: The 2 bytes before the String's for the ScriptName and PropertyNames is the string length.
That's an easy bit.

Edit:
Just found that SkyEdit displays the VMAD records. Thankyou Dave :smile:
For Forms though, there's a popup that displays "I can't select records of type 'Form' Yet!"

Edit2:
Thanks Xetrill for the link to http://uesp.net/wiki/Tes5Mod:Mod_File_Format/VMAD_Field
User avatar
Chris Jones
 
Posts: 3435
Joined: Wed May 09, 2007 3:11 am


Return to V - Skyrim