Results 1 to 10 of 10
  1. #1

    Default Unexcpected XPBar?

    Im getting this error everytime i define a new GFxObbject in my hud script

    here is the script if anyone can try to help me


    class SGFxHud extends GFxMoviePlayer;

    var GFxObject XPBar;

    var GFxObject level;



    XPBar = GetVariableObject("_root.XPBar_mc");
    level = GetVariableObject("_root.XPBar_leveltxt");

    XPBar.SetText(XP);
    TotalAmmoDisplay.SetText(Level);



    function TickHud()
    {
    local ParkourController PC;
    local SoldierPawn UTP;



    UTP = SoldierPawn(PC.Pawn);

    if(UTP == None) {
    return;
    } else {

    if(UTP.HeadVolume != None && UTP.HeadVolume.bWaterVolume) {

    } else {
    UTP.BreathTime = UTP.UnderWaterTime;
    }



    }


    DefaultProperties
    {
    bDisplayWithHudOff=True
    MovieInfo=SwfMovie'SensitivityFLASH.XPTest'
    bEnableGammaCorrection=false
    bDrawWeaponCrosshairs=false
    bAutoPlay=true;

    bAllowInput=false;
    bAllowFocus=false;
    }

  2. #2

    Default

    well i fixed this but now i keep getting Bad or missing expression for token MyPlayerController , in =

    Seriously this problem is getting me crazy i use the same method for getting xp killing bots and it works fine

    but when i try to use it in the HUD file it gives me the error

    here is the code

    class SGFxHud extends GFxMoviePlayer;

    var GFxObject XPBar_mc, xptxt_mc;
    var float LastHealthpc, Lastxppc;


    var WorldInfo ThisWorld;

    function Init(optional LocalPlayer player)
    {







    super.Init(player);

    lastxppc = -1337;



    LastHealthpc = -1337;
    LastOxygen = -1337;
    Breaths = 20;


    XPBar_mc = GetVariableObject("_root.XPBar_mc");
    xptxt_mc = GetVariableObject("_root.XPBar_mc.leveltxt");





    xptxt_mc.SetText("PC.Level");

    }


    function int roundNum(float NumIn)
    {
    local int iNum;
    local float fNum;

    fNum = NumIn;
    iNum = int( fNum );
    fNum -= iNum;
    if ( fNum >= 0.5f )
    return ( iNum + 1 );
    else
    return iNum;
    }

    function int GetPercentage( int Value, int MaxValue )
    {
    return roundNum( ( float( Value ) / float( MaxValue ) ) * 100.0f);
    }

    function TickHud()
    {
    local MyPlayerController PC;
    PC = MyPlayerController(PlayerOwner);








    if(lastxppc != GetPercentage( PC.Level, PC.MAX_LEVEL ))
    {

    lastxppc = GetPercentage( PC.Level, PC.MAX_LEVEL );

    XPBar_mc.SetFloat( "_xscale", (lastxppc > 100) ? 100.0f : lastxppc );

    }


    if (LastHealthpc != GetPercentage( UTP.Health, UTP.HealthMax ))
    {
    LastHealthpc = GetPercentage( UTP.Health, UTP.HealthMax );


    }
    }


    DefaultProperties
    {
    bDisplayWithHudOff=false
    MovieInfo=SwfMovie'SensitivityFLASH.XPTest'
    bEnableGammaCorrection=false
    bDrawWeaponCrosshairs=false
    bAutoPlay=true;

    bAllowInput=false;
    bAllowFocus=false;
    }

  3. #3

    Default

    Use GetPC()

  4. #4

    Default

    now it perfectly compile but my textfield instead of showing the player level show a empty square

  5. #5

    Default

    Thats a missing font issue. Please see the Scaleform video tutorial on using fonts in UDK.

  6. #6

    Default

    thanks matt doyle but now i noticed that instead of only showing the player level it also adds this %

    so in the hud instead of showing Level 1

    it shows Level1%

    maybe becouse i used the GetPercentage function to get the level information?

    if i try ti use xptxt.SetText("PC.Level"); instead of showing player level it shows the text that i putted on the setext function

    please help!

  7. #7

    Default

    You're passing a string value. Remove the double quotes around PC.Level

  8. #8

    Default

    thanks matt there is only one more thing that i havent figure out example i got a int value called AmmoCount inside my custom weapon system how i can get that reference to my scaleform hud? i know i can get the reference of the pawn and player controller but i havent figure out how to get values from oter classes apart from those two

    i looked at GFxMinimapUI in the part that says Weapon = UTWeapon(UTP.Weapon)

    then i tryed to use that on my hud script with this

    Weapon = FFWeapon(UTP.Weapon) and when i tried to compile it it just sayd missing variable name

    thanks for all the help if you could help me with this our whole hud would be done

    thanks in advice

  9. #9

    Default

    I'm not entirely sure off the top of my head, as I don't know how your weapon class is set up, but I would say much of the logic you need to review is in the TickHud function of GFxMinimapHud.uc. Here is the important code to review. I've copied and pasted only what you need to review:

    Code:
    var UTWeapon      LastWeapon;
    
    function TickHud(float DeltaTime)
    {
        local UTPawn UTP;
        local UTWeapon Weapon;
        local int i;
        local PlayerController PC;
    
        PC = GetPC();
    
        UTP = UTPawn(PC.Pawn);
    
        Weapon = UTWeapon(UTP.Weapon);
        if (Weapon != none)
        {
            if (Weapon != LastWeapon)
    	{
    	    if (Weapon.AmmoDisplayType == EAWDS_None)
    	        AmmoCountTF.SetText("");
    	    i = (Weapon.MaxAmmoCount > 50 ? 50 : Weapon.MaxAmmoCount);
    	    MaxAmmoMC.GotoAndStopI(51 - i);
    	    WeaponMC.SetVisible(true);
    	    WeaponMC.GotoAndStopI(Weapon.InventoryGroup);
    	    LastWeapon = Weapon;
    	}
    	i = Weapon.GetAmmoCount();
    	if (i != LastAmmoCount)
    	{
                LastAmmoCount = i;
    	    AmmoCountTF.SetText(i);
    	    if (i > 50)
    	        i = 50;
    	    AmmoBarMC.GotoAndStopI(51 - i);
    	    AmmoBarMC.SetVisible(true);
            }
        }
    }

  10. #10

    Default

    thanks a lot matt i copied some things to also show the reserve ammo and its working awesome!


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.