A Fallout 3 and New Vegas mod that greatly improves the user interface without compromising the original style.

Forum Thread
  Posts  
How to implement the Doctor’s Bag look and feel in FO3 (solved) (Games : Fallout: New Vegas : Mods : Vanilla UI Plus : Forum : Support & Feedback : How to implement the Doctor’s Bag look and feel in FO3 (solved)) Post Reply
Thread Options
May 13 2024 Anchor

Hello, it's me again. I'm currently trying to implement a Doctor's Bag button into the Status Menu (VUI+) of the Pip-Boy in Fallout 3. Unfortunately, all my attempts keep failing. Scripting in GECK is not an issue, but creating the necessary XML markup is proving to be a challenge. Here's what the button looks like so far:

<hotrect name="stats_drbag_button">
<id> 49 </id>
<include src="text_box.xml" />
<visible> <copy src="sibling(stats_player_head)" trait="visible" /> </visible>
<_x> <copy src="sibling" trait="_x" /> </_x>
<_y> <copy src="sibling" trait="_y" /> <add src="sibling" trait="height" /> </_y>
<justify> &right; </justify>
<string> <copy src="io" trait="_DoctorBagCount" /> </string>
<_xbox_button> &xbuttony; </_xbox_button>
<_PCButtonText> <copy src="io" trait="_stats_drbag_button" /> </_PCButtonText>
<listindex> 2 </listindex>
</hotrect>

I have no idea how to prepare the markup so that it ends up displaying "(%_DoctorBagCount%) Doctor’s Bag."

If anyone has any suggestions, I would be very grateful!

May 13 2024 Anchor

Scripting on FO3 is difficult. You need to prepare the string. Vicious Wastes does that, so I'd ask Slippy Guy about it.

May 13 2024 Anchor

Vicious Wastes for Fallout 3 doesn’t add a Doctor’s Bag button unfortunately so I don’t know if Slippy Guy found a way to do it.

May 14 2024 Anchor

It does, "Limbs can only be healed with Doctor's Bags or through healing services" but probably through an item and not a shortcut at the Condition panel.

Personally I think a consumable Doctor's Bag makes more sense than a keyboard shortcut.

May 14 2024 Anchor

You mis using it. ID Traits are Engine Specific stuff do not ever use them for your own purpose.

using Script you have to do this properly by using SetUIString


SetUIString "Path" "%g Doctor Bag" iCount 


May 14 2024 Anchor

Axonis: He has a script on the Doctor’s Bag item that opens a message where you choose which limb you want to heal. This is not very responsive in my opinion or at least not very comfortable for the player.

Anro19: I wish this would work but it doesn’t match the syntax SetUIString traitName:string newValue:string. And I can’t set string variables in scripts as far as I know.


Edit: Okay, I was able to recreate the button along with the item count display. This is how i did it:

<hotrect name="stats_drbag_button">
	<id> 49 </id>
	<listindex> 2 </listindex>
	<include src="text_box.xml" />
	<visible> <copy src="sibling(stats_player_head)" trait="visible" /> </visible>
	<_pressed> <ref src="me" trait="clicked" /> <add> 0.5 </add> </_pressed>
	<_x> <copy src="sibling(stats_stimpak_button)" trait="_x" /> </_x>
	<_y>
		<copy src="sibling(stats_stimpak_button)" trait="_y" />
		<add src="sibling(stats_stimpak_button)" trait="height" />
	</_y>
	<width>
		<copy src="me" trait="width"/>
		<add src="child(stats_drbag_count)" trait="width"/>
		<add src="child(stats_drbag_bracket_open)" trait="width"/>
		<add src="child(stats_drbag_bracket_close)" trait="width" />
	</width>

	<justify> &right; </justify>
	<string> Doctor&rsquo;s Bag </string>
	<_PCButtonText> <copy src="io" trait="_stats_drbag_button" /> </_PCButtonText>
	<_xbox_button> &xbuttony; </_xbox_button>

	<!-- Open Bracket -->

	<text name="stats_drbag_bracket_open">
		<visible> <not src="stats_effects_container" trait="visible"/> </visible>
		<x>
			<copy src="sibling(stats_drbag_count)" trait="x"/>
			<sub src="sibling(stats_drbag_count)" trait="width"/>
		</x>
		<y>
			<copy src="sibling" trait="_VUI+TextY"/>
			<add src="sibling" trait="height"/>
			<sub> <copy src="parent" trait="_verbuf" /> <div> 2 </div> </sub>
		</y>
		<font> <copy src="io" trait="font" /> </font>
		<justify> &right; </justify>
		<string> ( </string>
	</text>

	<!-- Count -->

	<text name="stats_drbag_count">
		<visible> <not src="stats_effects_container" trait="visible"/> </visible>
		<x>
			<copy src="sibling(stats_drbag_bracket_close)" trait="x"/>
			<sub src="sibling(stats_drbag_bracket_close)" trait="width"/>
		</x>
		<y>
			<copy src="sibling" trait="_VUI+TextY"/>
			<add src="sibling" trait="height"/>
			<sub> <copy src="parent" trait="_verbuf" /> <div> 2 </div> </sub>
		</y>
		<justify> &right; </justify>
		<_value> <copy src="io" trait="_DoctorBagCount"/> <max> 0.1 </max> </_value>
		<string> <copy src="me" trait="_value" /> </string>
		<font> <copy src="io" trait="font" /> </font>
	</text>

	<!-- Close Bracket -->

	<text name="stats_drbag_bracket_close">
		<visible> <not src="stats_effects_container" trait="visible"/> </visible>
		<x>
			<copy src="parent" trait="width" />
			<sub src="stats_drbag_button" trait="width" />
			<add src="stats_drbag_bracket_open" trait="width" />
			<add src="stats_drbag_count" trait="width" />
			<add src="stats_drbag_bracket_close" trait="width" />
			<add> <copy src="parent" trait="_horbuf" /> <div> 2 </div> </add>
		</x>
		<y>
			<copy src="sibling" trait="_VUI+TextY"/>
			<add src="sibling" trait="height" />
			<sub> <copy src="parent" trait="_verbuf" /> <div> 2 </div> </sub>
		</y>
		<justify> &right; </justify>
		<string> ) </string>
		<font> <copy src="io" trait="font" /> </font>
	</text>

</hotrect>

As you can see I had to use three text elements to sort of fake the item count display.

There’s only one problem left and I really hope you, Axonis, can help me with it since it concerns how you have designed the text_box.xml. When I hover over the hotrect it highlights the string a little bit (or maybe it just darkens my text elements a little bit?). Unfortunately my additional text elements look a little bit off that way when they’re hovered (even though it’s barely noticable). Here’s a screenshot:

The (16) is not as bright as the Doctor’s Bag (Arzttasche) string besides it.

What do I have to do to make the text elements brighter, too? I hope you can help me!

Edited by: borisbaer

May 17 2024 Anchor

stats_drbag_bracket_open, stats_drbag_count, stats_drbag_bracket_close should inherit brightness and alpha from the nested button_text.

So you need to copy the following lines to those blocks:

<brightness> <copy src="sibling(button_text)" trait="brightness" /> </brightness>
<alpha> <copy src="sibling(button_text)" trait="alpha" /> </alpha>

You can read the code in text_box.xml to better understand why. Anro could help you too, he's grown immensely in understanding XML.

May 17 2024 Anchor

I have copied the lines but it didn’t change anything for me. 🤷🏻‍♂️ Is the src really a sibling?

May 17 2024 Anchor

You need to copy them inside:

<text name="stats_drbag_bracket_open">
...here
</text>

<text name="stats_drbag_count">
...here
</text>

<text name="stats_drbag_bracket_close">
...and here
</text>

And yes, button_text is a sibling node to those text blocks you've added since it's nested in the same hotrect name="stats_drbag_button" block.

May 17 2024 Anchor

I did that before and I was wrong: It does reduce the darkening effect. The reason I thought it wouldn’t is that the color is still a tiny little bit muted when the button is hovered. I assume that there might be another effect being applied to the hovered text but I can’t really figure out which one that could be. It’s not _line_alpha, is it?

Edited by: borisbaer

May 17 2024 Anchor

Copy depth too, in addition to brightness and alpha.

<depth> <copy src="sibling(button_text)" trait="depth" /> </depth>

_line_alpha won't do anything, it's already taken into account in calculating alpha.

Theoretically, red, green, blue, _VUI+OutlineIntensity and _VUI+ShadowOffset could have an effect, but not in your case. The last two would require adding an extra <include src="VUI+∖outline.xml"/> under your new text blocks, but only if you wanted to add a shadow or outline effect.

Edited by: Axonis

May 17 2024 Anchor

You’re right, thanks a lot! The button looks like it should now.
It also works now to use the button to heal all limbs for a very small amount (same as it does in New Vegas):

set iDoctorBagCount to Player.GetItemCount DoctorBag
SetUIFloat "StatsMenu\_DoctorBagCount" iDoctorBagCount

set iDoctorBagButtonPressed to GetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_drbag_button\_pressed"

if ( iDoctorBagButtonPressed == 1 )

	set bDoctorBagButtonPressed to 1

elseif ( ( iDoctorBagButtonPressed > bDoctorBagButtonPressed ) || IsKeyPressed 18 )

	if ( iDoctorBagButtonPressed > bDoctorBagButtonPressed )
		set bDoctorBagButtonPressed to iDoctorBagButtonPressed
	endif

	if ( bKeyDown == 1 || iDoctorBagCount == 0 )
		return
	endif

	if ( Player.GetItemCount DoctorBag > 0 )
		Player.RemoveItem DoctorBag 1 1
	endif

	set iMedicineSkill to Player.GetActorValue Medicine

	if ( iMedicineSkill >= 100 )
		set iLimbsHealingValue to 3
	elseif ( iMedicineSkill >= 50 )
		set iLimbsHealingValue to 2
	else
		set iLimbsHealingValue to 1
	endif

	Player.RestoreActorValue PerceptionCondition	iLimbsHealingValue; Head
	Player.RestoreActorValue EnduranceCondition	iLimbsHealingValue; Torso
	Player.RestoreActorValue LeftAttackCondition	iLimbsHealingValue; Left Arm
	Player.RestoreActorValue RightAttackCondition	iLimbsHealingValue; Right Arm
	Player.RestoreActorValue LeftMobilityCondition	iLimbsHealingValue; Left Leg
	Player.RestoreActorValue RightMobilityCondition	iLimbsHealingValue; Right Leg

	PrintToConsole "Healed all limbs for %g point(s)." iLimbsHealingValue

	PlaySound UIMenuFocus 1 ; Use the same sound as Fallout: New Vegas.

	set bKeyDown to 1

else

	set bKeyDown to 0

endif

I feel bad for asking since you’ve already helped me so much, but there’s only one thing left to do for me to make the Doctor’s Bag work like it does in New Vegas. Vicious Wastes simply disabled limb healing by clicking on the corresponding body parts, but I find that feature so important that I really want to find a way to make it possible in Fallout 3, either.

The problem is not that I can’t write a script that heals the clicked body part with a Doctor’s Bag. The problem is that body part healing is natively linked to the Stimpaks you have in your inventory. I can counter the usage of a Stimpak when clicking on a body part by simply adding a new one. However, when the player has zero Stimpaks in their inventory, limb healing is disabled for good. Do you have an idea how to bypass this mechanism?


Edit: I have finally managed to recreate the Doctor’s Bag functionality of New Vegas for the Stats menu:

As you can see, Stimpaks are grayed out but the limbs still blink and are able to be restored through the usage of Doctor’s Bags (Arzttasche in German). It took me two days to find a way and this is how I accomplished it: I have created a dummy paperdoll consisting of hotrects that are invisible, yet they overlay the default paperdoll so the user can’t actually click the real paperdoll. The challenge was to apply the feedback of the default paperdoll limbs like blinking and playing a sound when hovered. Just to give you an example how I made the blinking work for the head:

if ( ( bHasMouseoverHead || bHasMouseoverFace ) && ( Player.GetActorValue PerceptionCondition != 100 ) && ( Player.GetItemCount DoctorBag > 0 ) )
	if ( bSoundPlayed != 1 )
		PlaySound UIPipBoyHighlight 1
		set bSoundPlayed to 1
	endif
	if ( iFlashStageHead < iFadeSteps )
		set fAlphaValue to 255 - ( iFlashStageHead * fAlphaChange )
		SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\alpha" fAlphaValue
		SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_face\alpha" fAlphaValue
		SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_head_pct\alpha" fAlphaValue
		SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_head_pct\stats_player_head_pct_meter\alpha" fAlphaValue
		set iFlashStageHead to iFlashStageHead + 1
	elseif ( iFlashStageHead >= iFadeSteps && iFlashStageHead < ( iFadeSteps * 2 ) )
		set fAlphaValue to ( ( iFlashStageHead - iFadeSteps ) * fAlphaChange )
		SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\alpha" fAlphaValue
		SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_face\alpha" fAlphaValue
		SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_head_pct\alpha" fAlphaValue
		SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_head_pct\stats_player_head_pct_meter\alpha" fAlphaValue
		set iFlashStageHead to iFlashStageHead + 1
	else
		set iFlashStageHead to 0
	endif
elseif ( iFlashStageHead != 0 )
	SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\alpha" 255
	SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_face\alpha" 255
	SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_head_pct\alpha" 255
	SetUIFloat "StatsMenu\GLOW_BRANCH\stats_status_container\stats_player_head\stats_player_head_pct\stats_player_head_pct_meter\alpha" 255
	set iFlashStageHead to 0
	set bSoundPlayed to 0
endif

This way it blinks exactly same way the default paperdoll does. I found out that you need 12 steps for the fade-out and 12 steps for the fade-in effect to have the same animation speed as the default paperdoll limb.

I think it was worth it even though I have no clue right now how to also tackle the limb healing mode for controllers to also work with this.

For me Fallout 3 feels like it really has a native Hardcore Mode now. 🙂

Edited by: borisbaer

May 24 2024 Anchor

An excellent implementation, bravo!

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.