- 0
[RLS] Reduce Water Height Conflicts
-
Similar Content
-
xedit Trying to remove a few plugins from CR patch, tried reading guides, still confused
By ArcMcNabbs,
- 1 reply
- 155 views
-
- 0 replies
- 438 views
-
- 8 replies
- 386 views
-
-
Recently Browsing 0 members
- No registered users viewing this page.


Question
fireundubh
Here you go:
Reduce Water Height Conflicts v0.1
This script will copy the winning override's water height value to the processed record if the processed record is not flagged Has Water and yet still defines a water height. In my very limited testing, many of the conflicts were "resolved" this way.
{ Purpose: Reduce Water Height Conflicts Game: Probably Any Author: fireundubh <[email protected]> Version: 0.1 } unit userscript; uses mteFunctions; {Returns true if specific flag is set and false if not} function IsFlagSet(f: IInterface; i: integer): boolean; begin Result := (GetNativeValue(f) and i > 0); end; {Returns integer of flag matching string} function GetCellFlag(s: string): integer; var cellFlag: TStringList; begin cellFlag := TStringList.Create; cellFlag.DelimitedText := lowercase('"Is Interior Cell=1", "Has Water=2", "Behave like exterior=128"'); Result := StrToInt(lowercase(cellFlag.Values[s])); cellFlag.Free; end; {Processes each record} function Process(e: IInterface): integer; var o, f, fo: IInterface; begin {exit if we're not looking at the appropriate record types} if (geev(e, 'Record Header\Signature') <> 'CELL') and (geev(e, 'Record Header\Signature') <> 'WRLD') then exit; {get winning override object} o := WinningOverride(e); {exit if there is no override for comparison} if not Assigned(o) then exit; {exit if records are flagged as deleted} if GetIsDeleted(e) or GetIsDeleted(o) then exit; {get record flag objects} f := ElementByPath(e, 'Record Header\Record Flags'); fo := ElementByPath(o, 'Record Header\Record Flags'); {exit if either cell has water because we presumably don't want to screw anything up} if IsFlagSet(f, GetCellFlag('Has Water')) or IsFlagSet(fo, GetCellFlag('Has Water')) then exit; {copy the overriding cell's water height if the processed cell does not have water but defines a water height anyway} if not IsFlagSet(f, GetCellFlag('Has Water')) and Assigned(ElementBySignature(e, 'XCLW')) then seev(e, 'XCLW', geev(o, 'XCLW')); end; end.Edited by fireundubh0 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now