Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- Create OMOD records for selected KYWDs
- }
- unit FO4CreateOMODforKYWD;
- const
- sEditorID = 'modcol_ColorSwaps_%s_Primary';
- iTemplateOMOD = $001ADA29; // modcol_Deliverer_Scopes_Any [OMOD:001ADA29]
- iPlugin = 1; // plugin where to create OMODs: 0 - same plugin as keyword, 1 - the last loaded plugin
- function Process(e: IInterface): Integer;
- var
- id: string;
- f, tpl, omod: IInterface;
- begin
- if Signature(e) <> 'KYWD' then
- Exit;
- if iPlugin = 0 then
- f := GetFile(e)
- else
- f := FileByIndex(Pred(FileCount));
- id := Format(sEditorID, [EditorID(e)]);
- // check if such record already exists
- omod := MainRecordByEditorID(GroupBySignature(f, 'OMOD'), id);
- // if not found
- if not Assigned(omod) then begin
- // get template OMOD record from the game master
- tpl := RecordByFormID(FileByIndex(0), iTemplateOMOD, False);
- // copy it as a new record
- omod := wbCopyElementToFile(tpl, f, True, True);
- // set new editor id
- SetElementEditValues(omod, 'EDID', id);
- AddMessage(Name(e) + ': Created ' + Name(omod));
- end else
- AddMessage(Name(e) + ': OMOD already exists ' + Name(omod));
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement