PDA

View Full Version : Tutorial ScaleForm HUD Tutorial (Updated August Scripts)



3dcamel
08-21-2010, 03:08 PM
Hey guys i was working hard with Wizzard~Of~Ozz on this one :).

http://3dtuts.co.cc/2010/08/adding-your-own-custom-scaleform-hud-via-inrealscript-august-version/

:) Hope you like it :) and can understand it


Thanks :)

KY2K
08-21-2010, 04:39 PM
i think a big credit would goto Grosie for creating the original tutorial aswell (TheCodedMonkey Youtube channel)

alvarofer0020
08-21-2010, 04:44 PM
i cant get my hud text moving i have alredy changed all you text things to my hud txt instance name also my hud bar works but the text doesnt

also here is my action script thing


import gfx.motion.Tween;
_global.gfxExtensions = true;
var angle:Number;
function init() {
healthbar_mc._yrotation = -10;
angle = 80;


// All others below are just extra’s you can add , the main 1 is the one above.
healthbar_mc._yrotation = -10;
angle = 0;

healthtxt._yrotation = -10;
angle = 0;

}
init();
//if you have the text above your healthbar you can make it go back and forth in the z axis to create a 3d effect .
_root.onEnterFrame = function() {
angle += 0.10;
var sined:Number = Math.sin(angle) + 2;
sined /= 2;
healthbar_mc._z = -50 * sined;
healthtxt._z = -100 * sined;
}

KY2K
08-21-2010, 04:57 PM
_global.gfxExtensions = true;

var angle:Number;

function init() {
HealthBar_MC._yrotation = -30;
angle = 0;
}

init();

_root.onEnterFrame = function() {
angle += 0.1;
var sined:Number = Math.sin(angle) + 2;
sined /= 2;

HealthBar_MC.Bar_mc._z = -600 * sined;
HealthBar_MC.Health_txt._z = -400 * sined;
//PDA._z = -200 * sined;
}

well this is my code it looks simaliar however in flash have you named all instances in the properties window?

alvarofer0020
08-21-2010, 05:19 PM
yes i have named all the instances my healthbar is named healthbar_mc and the text health_txt

also i just try with you code and still with out work and i changed the instance names to my instance names

alvarofer0020
08-21-2010, 05:26 PM
nvm i fixed it

3dcamel
08-22-2010, 10:26 AM
good goood :)

3dcamel
08-23-2010, 09:42 AM
btw guys i will be dooing a series of tuts very soon so keepp an eye on my site if you want :P :)

alvarofer0020
08-23-2010, 11:09 AM
i compile and give me this errors

C:\UDK\UDK-2010-08\Development\Src\MyMod\Classes\SensitivityGFx.uc (47) : Error, Bad or missing expression in Call to 'SetFloat', parameter 1
C:\UDK\UDK-2010-08\Development\Src\MyMod\Classes\SensitivityGFx.uc (30) : Error, Bad or missing expression in Call to 'GetVariableObject', parameter 1
C:\UDK\UDK-2010-08\Development\Src\MyMod\Classes\SensitivityHUD.uc (17) : Error, 'new': Class 'SensitivityHUD' is an Actor subclass, use 'Spawn' instead

Wizzard~Of~Ozz
08-23-2010, 01:10 PM
I've never been a fan of "follow along" tutorials. There are just too many slight variations that can't be accounted for. Sometimes it's best to understand why something is what it is not just accept that it is.

var GFxObject MyObjectInSWF, MyChildObject;

Now, there are 2 ways to populate those variables ( within my GFxMovie subclass ). First I can call

MyObjectInSWF= GetVariableObject( "_root.MyObjectInSWFName" );
MyChildObject = GetVariableObject( "_root.MyObjectInSWFName.MyChildObject" );

Or, instead of the second line we can simply call

MyChildObject = MyObjectInSWF.GetObject( "MyChildObject" );

For those not familiar with SWF, The general way things are built is ( using above )
_root <- This is the main movie
MyObjectInSWFName <- Is the instance name of a symbol directly placed into the main movie
MyChildObject <- Is the instance name of a symbol placed within the symbol above.

This is quite similar to a directory structure.
C:\ <- _root
C:\Program Files <- Child Object of root
C:\Program Files\UDK <- UDK is a child object of Program files which is a child object of C:\

Now we get into what those symbols are, If MyChildObject above is a text field, then you can read the text by calling
`Log( MyChildObject.GetString( "text" ) );
or set it with
MyChildObject.SetString( "text", "Hello World" );

Section removed, apparently following a variable is not optimal.

Sorry for such a long post and it being potentially pretty basic stuff. Figure once you understand how to Set/Get variables, Tell MovieClips to GotoAndPlay then you'll find things move along a lot faster than troubleshooting what could be a simple typo ( not that those don't happen anyway )
Hopefully this helps get people started with UScript/Scaleform interaction.

corbinsupak
11-19-2010, 03:05 PM
WoO, unsure of your recommendation.
I was following TheCodedMonkey's tutorial, and made adjustments for August as mentioned above (I switched MyGameInfo to extend UTDeathmatch rather than UTGame like 3dcamel has). I compile cleanly but when launching the game, I have no HUD at all. The log gives errors every Tick - can't access my child symbols in the swf.

Also, when I have MyGameInfo extend UTGame, I don't get the errors in the log, but I still have no HUD at all. The last line in the log is "NO VALID MINIMAP INFO in MAPINFO!"

Any ideas?

corbinsupak
11-19-2010, 03:30 PM
Also, I'm confused by 3dcamel's variables, do you keep CodedMonkey's var declarations, and add a declaration using the instance name, or just use the instance names, not new variables? If the instances are nested in others, how would the var GFxObject declaration look like?

corbinsupak
11-22-2010, 12:08 PM
I'm good now. Found the other long thread where this was all hashed out. Mine still didn't work until I had MyGameInfo extend UTDeathmatch (as in original tutorial) rather than UTGame (as 3dcamel had it). The other problem I had that wasn't addressed in any of the threads was how to get the .swf into the Content Browser. UDK (august) requires my .swf files to be specifically in UTGame/Flash/MyProject/MyProject.swf in order to import them. This is not the path needed by the code in MyGfxHud.uc (MyAssets.HUD.HudSwf), and I tried a bunch of re-naming, re-organizing, changing the path in this line of code, etc. but couldn't get things right. Finally, I kept the orginal code from the tutorial, placed the .swf where UDK wants it just to get it in, and then right-clicked on the .swf in the content manager and was able to change it's path to match my code, which I couldn't do on import.
Thanks everyone!