Jump to content
  • 0
Sign in to follow this  
fireundubh

[RLS] Reduce Water Height Conflicts

Question

Okay here is a question for you much more wise people out there! 

It has been annoying me for a long while now... and I guess I should just ask. 

 

Is there somehow a way to make tes5edit equal the water height values. So that -2147483648.000000  = 0.000 for the intents of conflict resolution. Or does there exist a script that simply just set the value in all .esp .esm (The only case where it was not one of those two it was set as default I think) to either of the two ?

 

Just so I can finally remove that stupid conflict from my list all together!

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 <fireundubh@gmail.com>
	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 fireundubh

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.