Let's follow a few simple steps:
<UIElement>
tag. Let's start with the <functions>
tag:<functions> <function name="SetWeapon" desc="" funcname="setCurrentWeapon"><param name="WeaponName" desc="" type="string"/> <param name="AmmoName" desc="" type="string" /> </function> <function name="SetAmmo" desc="" funcname="setAmmo"> <param name="CurrAmmo" desc="" type="int"/> <param name="MaxAmmo" desc="" type="int" /> </function> </functions>
bool
: True or false.int
: Integer number.float
: Floating point value.string
: A string.any
: Default if you don't define the type. It can be any input.The types will define the port type of the Flownode. If you use the any
type, the value will be converted to the best matching type (bool
| int
| float
| string
).
Defining a type will also increase performance, because no autoconversion is needed. Besides that, it is not possible to type in the value directly into the Flownode if you choose the any
type.
<MovieClips> <MovieClip name="HealthBar" desc=""instancename="healthMC" /> </MovieClips>
<Variables> <Variable name="HealthValue" desc=""varname="healthMC.currHealth.text" /> </Variables>
The final XML should look like this:
<UIElements name="HUD"> <UIElement name="NewHUD" render_lockless="1">render_lockless="1"> <GFx file="NewHUD.swf" layer="1"> <Constraints><Align mode="dynamic" valign="center" halign="center" scale="1" max="0" /></Constraints> </GFx> <functions> <function name="SetWeapon" desc="" funcname="setCurrentWeapon"><param name="WeaponName" desc="" type="string"/> <param name="AmmoName" desc="" type="string" /> </function> <function name="SetAmmo" desc="" funcname="setAmmo"> <param name="CurrAmmo" desc="" type="int"/> <param name="MaxAmmo" desc="" type="int" /> </function> </functions> <MovieClips> <MovieClip name="HealthBar" desc="" instancename="healthMC" /> </MovieClips> <Variables> <Variable name="HealthValue" desc="" varname="healthMC.currHealth.text" /> </Variables> </UIElement> </UIElements>
NewHUD.swf
file into <engine root>GameLibsUINewHUD.swf
.NewHUD.fla
file into <engine root>GameLibsUINewHUD.fla
. This allows you to publish your SWF file into the correct folder, and you can reload your changes in Sandbox without coping the SWF file because it was published in the correct folder.With your NewHUD.xml
, the engine now knows your new UIElement. You will now be able to display the new HUD, call functions, and manipulate your movieclips/variables within Sandbox Flow Graph. First, we defined the UIElement and the associated SWF file. Then, we added the movieclips and textfields to the XML file to make them accessible in CryENGINE. Finally, we also added our ActionScript function in the XML file to be able to call this function easily from Flow Graph.
The next part will show you how to use the UI Emulator to test your asset. Then we will create a simple UI Action in the Flow Graph to feed the data, and call our ActionScript function of the new HUD.
52.15.63.145