Jump to content

Display image on HUD


Recommended Posts

I'm trying to recreate the light gem from Thief by having a script display images on the HUD based on ambient light.

 

In the script, I am using MenuQue functions like this:

if (initialize == 0)
     ShowGenericMenu "ABtaff.xml"
     let initialize := 1
endif

set lightlvl to player.GetActorLightAmount
if lightlvl < 7
     tile_SetFloat "menu_background\gem_0\visible", 1004, 2 ; 2: on, 1: off
; etc

My xml file looks like this (based on AB's Menu Tester):

<menu name="TextTestMenu">
    <class> &HUDMain; </class>
    <stackingtype> &no_click_past; </stackingtype>
    <locus> &true; </locus>
    <explorefade> 0.25 </explorefade>

    <user2>OK</user2>        <!-- Close button -->
    
    <xbuttona> <ref src="ok_button" trait="clicked"/> </xbuttona>

    <rect name="menu_background">
        <visible> &true; </visible>
        <depth> 50 </depth>
        <locus> &true; </locus>
        <x>
            <copy src="screen()" trait="width"/>
            <div>2</div>
        </x>
        <y>
            <copy src="screen()" trait="height"/>
            <div>2</div>
        </y>
        
        <image name="gem0">
            <visible> &false; </visible>
            <filename> Textures\Bugsby\Taffers_Eye_0.dds </filename>
            <x> 0 </x>
            <y> 0 </y>
            <height> 800 </height>
            <width> 1000 </width>
            <alpha> 255 </alpha>
            <zoom> 100 </zoom>
            <depth> 3 </depth>
        </image> 

I'm using ShowGenericMenu because it's the only way I've found to get the xml file to display, even though the console objects. If there is a better way, it would be good to know.

 

The main problem is that tile_SetFloat doesn't appear to change the "visible" field. I can't get it to change any other fields either, so I expect I'm using it wrong but I'm not sure how. Looking at existing code hasn't given me any revelations.

 

The above code is a bit messy because it's based off a template and I wanted to get this part working before cleaning it up, but the image displays fine if the visible field is set to true in the xml file.

Edited by BugsbyBearkeley
Link to comment
Share on other sites

  • 2 weeks later...

showgenericmenu is the command to show a menu outside of the hud like an options menu.

 

what you need to do to add an element to the hud is to InsertXML

this will add a custom section of self created xml to ANY xml created for a menu or hud

 

InsertXML "folder/filename.xml" 1004

 

place your xml file in a 'folder' in

oblivion install directory/Data/Menus/Prefab

then place your xml file(s) in there

 

So if you had a folder named GemHud

and your xml file was called DarkGem.xml

 

then in your quest script, you add the command....

InsertXML "GemHud/DarkGem.xml" 1004

 

now to your XML,

you are not trying to create a new options menu, so delete the <menu> </menu> stuff

and keep the stuff in your <rect></rect>

 

<rect name="menu_background">
<visible> &true; </visible>
<depth> 50 </depth>
<locus> &true; </locus>
<x>
<copy src="screen()" trait="width"/>
<div>2</div>
</x>
<y>
<copy src="screen()" trait="height"/>
<div>2</div>
</y>

<image name="gem0">
<visible> &false; </visible>
<filename> Textures\Bugsby\Taffers_Eye_0.dds </filename>
<x> 0 </x>
<y> 0 </y>
<height> 800 </height>
<width> 1000 </width>
<alpha> 255 </alpha>
<zoom> 100 </zoom>
<depth> 3 </depth>
</image>

</rect>

 

 

Heres a link to a really really good tutorial on xml used in oblivion.

just be warned, its a forum geared toward adults.

https://www.loverslab.com/topic/53411-reading-ui-hud-xml-files/

 

 

gotta go to work.

when I have more time, I'll show you a trick where you can show a

different image based on the amount of light

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...