Oblivion
0 of 0

File information

Last updated

Original upload

Created by

FiveSixKilo

Uploaded by

Fivesixkilo

Virus scan

Safe to use

About this mod

This mod extends the default conversation UI to make it more flexible and allow a wider range of topics. This is primarily intended to give quest makers greater control over how they allow the player to express their character. It has additional QOL changes that some users may enjoy as well.

Requirements
Permissions and credits
DYNAMIC DIALOG

This mod extends the default conversation UI to make it more flexible and allow a wider range of topics. This is primarily intended to give quest makers greater control over how they allow the player to express their character. It has additional QOL changes that some users may enjoy as well.


FEATURES:

  • Dialog supports extended topic length by allowing for line breaks and dynamically repositioning topics. Want dialog choices/topics to be long enough to actually say something? That's why I made this.
  • Dynamic dialog window. The dialog window will resize to accommodate topics (and scroll after a certain point).
  • NPCs can be made to skip their lines. Ever wanted to have a nested dialog menu without the NPC responding? Now you can.
  • Topics are now numbered to improve readability. (Very helpful if you have lots of topics or topics that break to multiple lines).
  • The dialog window has a slight shadow now to improve readability in bright environments. (Pleasant if you have crummy eyes like me.)
  • Line breaks in quest entries and associated popup windows.
  • Darnified compatibility. (For more details, see the “Compatibility” section below.)

USAGE:

Extended Topic Length.
  • For users: simply install the mod.
  • For modders: Edit the ConstructionSet.ini file (located at "...\Documents\My Games\Oblivion\ConstructionSet.ini") and change "iExtendedTopicLength" to your desired length. This will allow extended topic length within the editor.

For reference, this is what various character lengths look like:
  • 50
    Sed ut perspiciati unde omnis iste natus error si.
  • 100
    Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, t.
  • 150
    Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventor.
  • 250
    Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia v.

Dynamic Dialog Window
  • For users: Simply install the mod.
  • For modders: Changes to the dialog window are done through a combination of XML edits and scripting. I've tried to keep the edits fairly well commented. The dynamic dialog script controls the window height.


Line Breaks
  • Line breaks can be added to quest log entries (or message boxes) by inserting " ¶ " (that's a space+¶+space). This will force anything after the pilcrow onto a new line.


Skip NPC Response
  • Setting an NPC's response text to "   " (that's three spaces in a row, i.e. "space+space+space") will skip that response. This is useful if you want to have a nested topic without the NPC responding or if you want the player to be able to choose multiple topics in a row without the NPC responding in between.



REQUIREMENTS:
OBSE
MenuQue



INSTALLATION:

  • Download the version that corresponds to your UI (default or Darnified).
  • For default UI users: I recommend using Vortex for easy install/uninstall.
  • For Darnified users: See “Manual Installation”

MANUAL INSTALLATION:

!!BEFORE YOU DO ANYTHING ELSE!!
Backup these folders:
  • …/Oblivion/Data/Menus
  • …/Oblivion/Data/Fonts
This will make any future uninstallation a breeze. (Just a quick ctrl-c, ctrl-v will work)
(If you do not already have these folders then there is no need to back them up.)

ALL USERS:

  • Did you backup the folders I said to?
  • Copy the contents of the "DynamicDialog" folder into your ".../Oblivion" root folder (the same folder that has Oblivion.exe). You may be asked to overwrite a few files.
  • IF YOU ARE USING DARNIFIED FOLLOW THESE STEPS:

    • Run DarnifiedPatcher.cmd - You may receive a “publisher could not be verified” warning. Click “Run” to proceed.

      • (make sure you are running this from the ".../Oblivion" root folder, the folder that has Oblivion.exe).
      • (If you want to know exactly what the patcher does, the full code can be found at the bottom of this page or you can open the .cmd and associated .ps1 file with notepad.)

    • The patcher will backup the dialog_menu.xml file (suffixed with "_BACKUP"). It will then make the necessary XML additions. (Why do it like this? Because Darn is AWOL and I can't rehost modified versions of his files w/o permission.)

  • Enable the correct .esp file. (ONLY use one):

    • DynamicDialog.esp - for the default UI


    • DynamicDialog-Darnified.esp - if you are using Darnified



UNINSTALL:

If you backed up the Fonts and Menus folders, then all you need to do is delete the new ones and rename the backups.

When manually uninstalling, the most important files to delete are:
"...\Oblivion\Data\Menus\Dialog\dialog_menu.xml"
"...\Oblivion\Data\Menus\message_menu.xml"
And any fonts from this mod.

These MUST be removed if you want to uninstall the mod as they will continue to affect the UI even with the .esp disabled.


LOAD ORDER:


Not too picky, but it should go after any UI mods.


COMPATIBILITY:

  • Currently, this mod supports the default UI as well as Darnified.
    • It may work with other UIs if they do not affect the dialog_menu.xml file.
  • The “Line breaks in quest entries” feature only supports the default fonts and the Darnified fonts listed below. If you want to use this feature with other fonts then let me know and I’ll walk you through it or make a guide.
  • Darnified
    • Specifically DarnUI 132 (the latest version). If you are using a different version or you have made extensive custom changes to the dialog_menu.xml file then this may not play nice.
    • The “Line breaks in quest entries” feature is done through font edits. I have recreated (from scratch) Darn’s default fonts as closely as possible, but there may be subtle differences. If you are using fonts other than the following then this particular feature will not work:
      • DarN_Kingthings_Petrock_14
      • DarN_Kingthings_Petrock_16
      • DarN_LG_Kingthings_Petrock_14
      • DarN_LG_Kingthings_Petrock_18
      • That said, using custom fonts won’t break anything. You might just see the occasional ¶ character in quest entries.
  • The Darnified patcher is only compatible with Windows 7 and above. It may not work if you’re still on Vista or XP (you’re probably not, but just in case).

PERMISSIONS:

Dynamic Dialog is licensed under: 
Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
https://creativecommons.org/licenses/by-nc-sa/4.0/

You are free to:
  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material

Under the following terms:
  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • NonCommercial — You may not use the material for commercial purposes.
  • ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
  • No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.


Lastly, (and this isn’t a part of the license) if you do use the mod or remix it or whatever then please shoot me a link! I’d love to see whatever neat stuff you do with it.


TRANSPARENCY:

Below is the full code that is executed by the Darnified compatibility patcher. Essentially, it checks if it is in the correct location, if the necessary files are found, and then makes a series of edits to the dialog_menu.xml file.

DynamicDialogDarnifiedPatcher.cmd:
@ECHO OFF

set /a DarnInstalled = 0

set /A ExitBool = 1

echo:
echo Dynamic Dialog Darnified 1.4 Compatibility Patcher
echo:
echo:

:: Checks to make sure this is run from the right folder
if exist "Oblivion.exe" (
echo Oblivion.exe Found
echo:
) ELSE (
   powershell write-host -fore Red Oblivion.exe NOT FOUND
   echo:
   set /A ExitBool = 0
)
if exist "data/Oblivion.esm" (
echo Oblivion.esm Found
echo:
) ELSE (
   powershell write-host -fore Red Data/Oblivion.esm NOT FOUND
   echo:
   set /A ExitBool = 0
)
if exist "Data/Menus/Dialog/dialog_menu.xml" (
echo Dialog Menu XML Found
echo:
) ELSE (
  powershell write-host -fore Red Data/Menus/Dialog/dialog_menu.xml NOT FOUND
   echo:
   set /A ExitBool = 0
)
if exist "Data/DynamicDialog/DarnifiedPatchScript.ps1" (
echo Patch Script Found
echo:
) ELSE (
   powershell write-host -fore Red Data/DynamicDialog/DarnifiedPatchScript.ps1 NOT FOUND
   echo:
   set /A ExitBool = 0
)

if %ExitBool% == 0 (
   echo Necessary files could not be found.
   echo Please ensure you're running this from the Oblivion root folder and all Dynamic Dialog files have been copied correctly.
   echo:
   echo Press ENTER to exit.
   PAUSE>nul
   EXIT 0
)
setlocal EnableDelayedExpansion
(for /F "delims=" %%a in (data/menus/dialog/dialog_menu.xml) do (
   set "line=%%a"
   set "patchCheck=!line!"
   set "darnCheck=!line!"
   if not "x!patchCheck:Patched for Dynamic Dialog=!" == "x!patchCheck!" (
  powershell write-host -fore Green You have already run the Dynamic Dialog Patcher.
  echo:
  echo Press ENTER to exit.
  PAUSE>nul
  EXIT 0
   )
   if not "x!darnCheck:DarN Version 1.4=!" == "x!darnCheck!" (
  set /a DarnInstalled = 1
   )
))
if !DarnInstalled! == 1 (
   echo DarnUI 1.4 Detected
   echo:
) ELSE (
  echo:
  powershell write-host -fore Red DarnUI 1.4 NOT FOUND
  echo:
  echo Darnified 1.4 is required to run this patch, please ensure you are using the correct version.
  echo:
  echo Press ENTER to exit.
  PAUSE>nul
  EXIT 0
)
EndLocal

powershell write-host -fore Green All Files Found
echo:
echo Press ENTER to begin patching.
PAUSE>nul

cd /D "%~dp0/data/menus/dialog"
rename dialog_menu.xml "dialog_menu_BACKUP.xml"

if exist "dialog_menu_BACKUP.xml" (
echo:
echo dialog_menu.xml Backup Made
echo:
) ELSE (
  powershell write-host -fore Red DIALOG_MENU.XML BACKUP FAILED
   echo:
   echo Press ENTER to exit.
   PAUSE>nul
   EXIT 0
)

(for /F "delims=" %%a in (dialog_menu_BACKUP.xml) do (
   set "line=%%a"
   setlocal EnableDelayedExpansion
   set "newLine=!line!"
   set "newLine=!newLine:&=&!"
   set "newLine=!newLine:;=;!"
   set "newLine=!newLine:&=&!"
   echo\ !newLine!
   EndLocal
)) > dialog_menu_TEMP.xml

(echo ^<!-- Patched ^f^or Dynamic Dialog --^>) >>dialog_menu_TEMP.xml.new
(echo ^<!DOCTYPE doctypeName ^[) >>dialog_menu_TEMP.xml.new
(echo^<!ENTITY semi ^"^&^#^5^9^;^"^>) >>dialog_menu_TEMP.xml.new
(echo^<!ENTITY amp ^"^&^#^3^8^;^"^>) >>dialog_menu_TEMP.xml.new
(echo ^]^> ) >>dialog_menu_TEMP.xml.new
type dialog_menu_TEMP.xml >>dialog_menu_TEMP.xml.new
move /y dialog_menu_TEMP.xml.new dialog_menu_TEMP.xml

echo:
cd /D "%~dp0/"
SET ThisScriptsDirectory=%~dp0data\DynamicDialog\
SET PowerShellScriptPath=%ThisScriptsDirectory%DarnifiedPatchScript.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'";

DarnifiedPatchScript.ps1:
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
$xmlPath = Split-Path -Path $scriptPath -Parent
$xmlFileName = "$xmlPath/menus/dialog/dialog_menu_TEMP.xml"
$newFileName = "$xmlPath/menus/dialog/dialog_menu.xml"

#$xmlFileName = "dialog_menu.xml"

#force the config into an XML
[xml]$xml = Get-Content $xmlFileName

#find the node to insert after
# $targetNode = $xml.SelectSingleNode('configuration/configSections[@name="thisOne"]')

#These are edits to various XML values
$targetNode = $xml.SelectSingleNode('//menu[@name="DialogMenu"]/rect[@name="dialog_topics"]/rect[@name="dialog_topics_layout"]/width')
$targetNode.InnerText = "2000"

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/rect[@name="dialog_topics"]/rect[@name="dialog_topics_layout"]/x/add')
$targetNode.InnerText = "10"

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/rect[@name="dialog_topics"]/rect[@name="dialog_topics_layout"]/rect[@name="npc_rect"]/x')
$targetNode.InnerText = "0"

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/rect[@name="dialog_topics"]/rect[@name="dialog_topics_layout"]/rect[@name="dialog_topics_scroll_pane"]/width')
$targetNode.InnerText = "2000"

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/rect[@name="dialog_topics"]/rect[@name="dialog_topics_layout"]/rect[@name="dialog_topics_scroll_pane"]/x')
$targetNode.InnerText = "20"

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/rect[@name="dialog_topics"]/rect[@name="dialog_topics_layout"]/locus')
$newNode = [xml]@"
  <rect name="dialog_background_rect">
    <height> <copy src="parent()" trait="height" /></height>
      <image name="dialog_background_shadow">
      <clips> falseBool </clips>
      <visible> <copy> 1 </copy> <eq> 1 </eq> </visible>
      <zoom> -1 </zoom>
      <filename>Menus\Dialog\Background\background_shadow_mid.dds</filename>
    
      <depth> -10 </depth>
      <width> 560 </width>
      <height> <copy src="parent()" trait="height" /><sub>28</sub></height>
    
      <x> -18 </x>
      <y> 14 </y>
      <alpha>    120 </alpha>
      <red> 0 </red>
      <green> 0 </green>
      <blue> 0 </blue>
  
    </image>
    <image name="dialog_background_shadow_top">
      <clips> falseBool </clips>
      <visible> <copy> 1 </copy> <eq> 1 </eq> </visible>
      <zoom> -1 </zoom>
      <filename>Menus\Dialog\Background\background_shadow_top.dds</filename>
          
      <depth> -10 </depth>
      <width> 560 </width>
      <height> 64</height>
          
      <x> <copy src="dialog_background_shadow" trait="x" /> </x>
      <y> -50 </y>
      <alpha>    120 </alpha>
      <red> 0 </red>
      <green> 0 </green>
      <blue> 0 </blue>
    </image>
    <image name="dialog_background_shadow_btm">
      <clips> falseBool </clips>
      <visible> <copy> 1 </copy> <eq> 1 </eq> </visible>
      <zoom> -1 </zoom>
      <filename>Menus\Dialog\Background\background_shadow_btm.dds</filename>
          
      <depth> -10 </depth>
      <width> 560 </width>
      <height> 64</height>
          
      <x> <copy src="dialog_background_shadow" trait="x" /> </x>
      <y> <copy src="dialog_background_shadow" trait="height" /><add> 14 </add> </y>
      <alpha>    120 </alpha>
      <red> 0 </red>
      <green> 0 </green>
      <blue> 0 </blue>
        
    </image>    
    <image name="dialog_background_shadow_right">
      <clips> falseBool </clips>
      <visible> <copy> 1 </copy> <eq> 1 </eq> </visible>
      <zoom> -1 </zoom>
      <filename>Menus\Dialog\Background\background_shadow_right.dds</filename>
          
      <depth> -10 </depth>
      <width> 64 </width>
      <height> <copy src="dialog_background_shadow" trait="height" /></height>
          
      <x> <copy src="dialog_background_shadow" trait="width" /> <add><copy src="dialog_background_shadow" trait="x" /> </add> </x>
      <y> 14 </y>
      <alpha>    120 </alpha>
      <red> 0 </red>
      <green> 0 </green>
      <blue> 0 </blue>
        
    </image>
    <image name="dialog_background_shadow_corner_top">
      <clips> falseBool </clips>
      <visible> <copy> 1 </copy> <eq> 1 </eq> </visible>
      <zoom> -1 </zoom>
      <filename>Menus\Dialog\Background\background_shadow_corner_top.dds</filename>
          
      <depth> -10 </depth>
      <width> 64 </width>
      <height> 64</height>
          
      <x> <copy src="dialog_background_shadow" trait="width" /><add><copy src="dialog_background_shadow" trait="x" /> </add> </x>
      <y> -50 </y>
      <alpha>    120 </alpha>
      <red> 0 </red>
      <green> 0 </green>
      <blue> 0 </blue>    
    </image>
    <image name="dialog_background_shadow_corner_btm">
      <clips> falseBool </clips>
      <visible> <copy> 1 </copy> <eq> 1 </eq> </visible>
      <zoom> -1 </zoom>
      <filename>Menus\Dialog\Background\background_shadow_corner_btm.dds</filename>
          
      <depth> -10 </depth>
      <width> 64 </width>
      <height> 64</height>
          
      <x> <copy src="dialog_background_shadow" trait="width" /><add><copy src="dialog_background_shadow" trait="x" /> </add> </x>
      <y> <copy src="dialog_background_shadow" trait="height" /><add> 14 </add> </y>
      <alpha>    120 </alpha>
      <red> 0 </red>
      <green> 0 </green>
      <blue> 0 </blue>    
    </image>
  </rect>
"@
#import new node to XML file and insert it
$newNode = $xml.ImportNode($newNode.rect,$true)
$targetNode.ParentNode.InsertAfter($newNode,$targetNode) |out-null

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/height')
$targetNode.InnerText = '<copy src="topic_text" trait="height" />'

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/width')
$targetNode.InnerText = '<copy src="child(topic_text)" trait="width" /> <add> 50 </add>'

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/y')
$targetNode.InnerText = '<copy src="sibling()" trait="y" /> <add> <copy src="sibling()" trait="height" /> </add> <add> 15 </add> <onlyif> <copy src="me()" trait="listindex" /> <gt> 0 </gt> </onlyif> <add> 0 </add>'

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/xscroll')
$targetNode.InnerText = '<copy src="me" trait="height" /> <add> <copy src="me" trait="y" /> </add> <sub> 512 </sub> <div> 21 </div> <ceil> 0 </ceil><add> 1 </add>'

#node to be added to XML
$newNode = [xml]@"
<text name="topic_number">
    <clips> trueBool </clips>
    <string>
      <copy src="parent()" trait="listindex" />
      <add>1</add>
    </string>
    <height> 48 </height>
    <depth> 4 </depth>
    <font>
      <copy src="darnui_settings" trait="_tlfont" />
    </font>
    <red>
      <copy><copy src="parent()" trait="red" /></copy>
      <onlyif>
        <copy src="parent()" trait="mouseover" />
        <eq> 0 </eq>
      </onlyif>
      <add>0</add>
    </red>
    <green>
      <copy><copy src="parent()" trait="green" /></copy>
      <onlyif>
        <copy src="parent()" trait="mouseover" />
        <eq> 0 </eq>
      </onlyif>
      <add>0</add>
    </green>
    <blue>
      <copy><copy src="parent()" trait="blue" /></copy>
      <onlyif>
        <copy src="parent()" trait="mouseover" />
        <eq> 0 </eq>
      </onlyif>
      <add>0</add>
    </blue>
    <alpha> 255 </alpha>
    <wrapwidth> 550 </wrapwidth>
    <x> -17 </x>
    <y> 2 </y>
</text>
"@
#import new node to XML file and insert it
$newNode = $xml.ImportNode($newNode.text,$true)
$targetNode.ParentNode.InsertAfter($newNode,$targetNode) |out-null

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/text[@name="topic_number"]')

$newNode = [xml]@"
<text name="topic_number_period">
    <clips> trueBool </clips>
    <string>.</string>
    <height> 48 </height>
    <depth> 5 </depth>
    <font>
      <copy src="darnui_settings" trait="_tlfont" />
    </font>
    <red>
      <copy><copy src="parent()" trait="red" /></copy>
      <onlyif>
        <copy src="parent()" trait="mouseover" />
        <eq> 0 </eq>
      </onlyif>
      <add>0</add>
    </red>
    <green>
      <copy><copy src="parent()" trait="green" /></copy>
      <onlyif>
        <copy src="parent()" trait="mouseover" />
        <eq> 0 </eq>
      </onlyif>
      <add>0</add>
    </green>
    <blue>
      <copy><copy src="parent()" trait="green" /></copy>
      <onlyif>
        <copy src="parent()" trait="mouseover" />
        <eq> 0 </eq>
      </onlyif>
      <add>0</add>
    </blue>
    <alpha> 255 </alpha>
    <wrapwidth> 550 </wrapwidth>
    <x>
      <copy>-15</copy>
      <add>
        <copy src="topic_number" trait="width" />
      </add>
    </x>
    <y> 2 </y>
</text>
"@
#import new node to XML file and insert it
$newNode = $xml.ImportNode($newNode.text,$true)
$targetNode.ParentNode.InsertAfter($newNode,$targetNode) |out-null


$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/text[@name="topic_text"]/wrapwidth')
$targetNode.InnerText = ' 550 '

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/text[@name="topic_text"]/wraplines')
$targetNode.InnerText = ' 10 '

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/text[@name="topic_text"]/x/copy')
$targetNode.InnerText = ' 5 '

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/text[@name="topic_text_s"]/wrapwidth')
$targetNode.InnerText = ' 550 '

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/text[@name="topic_text_s"]/wraplines')
$targetNode.InnerText = ' 10 '

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/text[@name="topic_text_s"]/x/copy')
$targetNode.InnerText = ' 6 '

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/template[@name="topic_template"]/rect[@name="topic_text_layout"]/text[@name="topic_text_s"]')
$newNode = [xml]@"
  <image name="dialog_focus_other">
    <clips> trueBool </clips>
    <visible>
      <copy src="parent()" trait="mouseover" />
      <eq> 1 </eq>
    </visible>
    <zoom> -1 </zoom>
    <filename>Menus\Dialog\dialog_selection_full.dds</filename>
    <depth> -1 </depth>
    <width>
      <copy src="topic_text" trait="width" />
      <mul> 1.94 </mul>
      
      <add> 65 </add>
    </width>
    <height>
      <copy src="topic_text_s" trait="height" />
      <add>12</add>
    </height>
    <x>
      <copy src="topic_text" trait="x" />
      <sub> 25 </sub>
    </x>
    <y> 0 </y>
    <alpha>    255 </alpha>
  </image>
"@
#import new node to XML file and insert it
$newNode = $xml.ImportNode($newNode.image,$true)
$targetNode.ParentNode.InsertAfter($newNode,$targetNode) |out-null

$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/rect[@name="dialog_focus_box"]/image[@name="dialog_focus_left"]/height')
$targetNode.InnerText = '0'
$targetNode = $xml.SelectSingleNode('/menu[@name="DialogMenu"]/rect[@name="dialog_focus_box"]/image[@name="dialog_focus_right"]/height')
$targetNode.InnerText = '0'


#save file
$xml.Save($newFileName)



$content = Get-Content -Path $newFileName
$ampReplace = $content -replace '&', '&'
$ampReplace | Set-Content -Path $newFileName

$content = Get-Content -Path $newFileName
$headerReplace = $content -replace '<!DOCTYPE doctypeName\[', ''
$headerReplace | Set-Content -Path $newFileName

$content = Get-Content -Path $newFileName
$headerReplace = $content -replace '   <!ENTITY semi \";\">', ''
$headerReplace | Set-Content -Path $newFileName

$content = Get-Content -Path $newFileName
$headerReplace = $content -replace '   <!ENTITY amp \"&\">', ''
$headerReplace | Set-Content -Path $newFileName

$content = Get-Content -Path $newFileName
$headerReplace = $content -replace '\]\>', ''
$headerReplace | Set-Content -Path $newFileName

$content = Get-Content -Path $newFileName
$headerReplace = $content -replace '<', '<'
$headerReplace | Set-Content -Path $newFileName

$content = Get-Content -Path $newFileName
$headerReplace = $content -replace '>', '>'
$headerReplace | Set-Content -Path $newFileName

$content = Get-Content -Path $newFileName
$headerReplace = $content -replace 'trueBool', '&true;'
$headerReplace | Set-Content -Path $newFileName

$content = Get-Content -Path $newFileName
$headerReplace = $content -replace 'falseBool', '&false;'
$headerReplace | Set-Content -Path $newFileName

Remove-Item -Path $xmlFileName -Force

Read-Host -Prompt "Patching Complete. Press Enter to exit"