Restless Souls/Wishlist: Difference between revisions

at long last, beginning to craft a better health bar ... and freaking out on those online tuts ^_^ (i guess for documentation whis will require itself a video)
(playing an animation based on keystroke and transition rule.)
(at long last, beginning to craft a better health bar ... and freaking out on those online tuts ^_^ (i guess for documentation whis will require itself a video))
Line 481: Line 481:
'''Health bar recreation'''
'''Health bar recreation'''


There are basically two options. We use either a dynamic material (computed texture) or real textures for the health bar.
There are two options to create a mask: a computed texture (vector) or a real texture designed in a image editor.


For color changes we would need a dynamic material in any case.
In the following sub section there are the required steps to achieve a health display meter.
(WIP, atm, this just create a color changing image, todo: integration of shape and animation)
=====Texture=====
Basically the mask (shape) of the health display meter.
This will be used as a node inside the material.
[...]
=====Material=====
Create Material Blueprint, Set output node to Material Domain: User interface (!), create a constant 4 Vector, right-click to turn it into a Parameter and name it Color, connect to output node
=====Widget=====
* Right-click in assets folder to create a new widget (User Interface > Widget Blueprint).
* Place an image into your Designer. This is going to be the health display meter.
* Under Appearance choose your Material.
Turning the Material in a dynamic one and setting initial color... Create variable of type "Material Instance Dynamic", create 2 vector variables (rgb red, rgb green, use 0 to 1 range). Then in In your widget goto Graph and add these nodes to your Construct and Custom event...
* Construct event -> Get HealthImage, Get Dynamic Material, set Dynamic Material variable, Get Player Character, Cast to ThirdPersonCharacter, Target MaxHealth, Set Progress (call function)
* Custom event -> Set Progress (with a float input), Get Dynamic Material, Set Vector Parameter Value (Parameter name ("Color") from your material), add lerp(linearColor) to SVPV node, add vector color variables to lerp node (here we can add more logic to recreate [[XML:ONGS#detailed_explanation_of_the_health_display_meter|ONGS' <Color> tags]])
Displaying the widget to screen and creating a reference ...
* In your Character BP create or add these to the BeginPlay event node:
** Get Player Controller, Create Widget (your health bar widget), Add to Viewport, set output Create Widget to a public variable (object) (use search to find widget)
Setting progress on the HUD... In Character PB ...
* event ..., get widget object variable, Set Progress (Target: var, Input: Health Percentage)




8,018

edits