Announcement

Collapse
No announcement yet.

ScaleForm HUD no crosshairs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ScaleForm HUD no crosshairs

    Hi,everyone.
    I created a scaleform HUD for my mod game,but the question is there are NO crosshairs..just like the image shows.


    and here's my code
    Code:
    class DepinalGFxHud extends  GFxMoviePlayer;
    
    
    var float LastHealthpc;
    var int LastAmmoCount;
    var int ExpBarPer;
    var UTWeapon LastWeapon;
    
    
    var GFxObject HealthMC, HealthBarMC, HealthTF;
    var GFxObject AmmoMC, AmmoBarMC, AmmoClipCount, AmmoMaxCount, AmmoName;
    var GFxObject LevelMC, LevelBarMC, LevelTF;
    var GFxObject CrossHair;
    
    
    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 int GetBulletInt( int Value, int MaxValue)
    {
    	return roundNum( ( float( Value ) / float( MaxValue ) ) * 15.0f);
    }
    
    function int GetExpInt( int Value, int MaxValue)
    {
    	return roundNum( ( float( Value ) / float( MaxValue ) ) * 10.0f);
    }
    
    function Init(optional LocalPlayer PC )
    {
    	Start();
    	Advance(0.f);
    	
    
    	HealthMC = GetVariableObject("_root.Health");
            HealthBarMC = GetVariableObject("_root.Health.Bar");
            HealthTF = GetVariableObject("_root.Health.Value");
            
            AmmoMC = GetVariableObject("_root.Ammo");
            AmmoBarMC = GetVariableObject("_root.Ammo.Bar");
            AmmoClipCount = GetVariableObject("_root.Ammo.ClipCount");
            AmmoMaxCount = GetVariableObject("_root.Ammo.AmmoCount");
            AmmoName = GetVariableObject("_root.Ammo.WeaponName");
    
            LevelMC = GetVariableObject("_root.LevelAndExp");
            LevelBarMC = GetVariableObject("_root.LevelAndExp.Bar");
            LevelTF = GetVariableObject("_root.LevelAndExp.Value");
    }
    
    
    function TickHUD() {
    	local UTPawn UTP;
    	local PlayerController PC;
    	PC = GetPC();
    
    	UTP = UTPawn(GetPC().Pawn);
    	if (UTP == None) {
    		return;
    	}
    	
    	HealthTF.SetString("text", (UTP.Health)$" / "$(UTP.HealthMax)$"");
    	LastHealthpc = GetPercentage(UTP.Health, UTP.HealthMax);
    	HealthBarMC.SetFloat("_xscale", (LastHealthpc > 100) ? 100.0f : LastHealthpc);
    	
    	AmmoName.SetString("text", DepinalWeapon(UTP.Weapon).dWeaponName);
    	AmmoClipCount.SetString("text", string(DepinalWeapon(UTP.Weapon).ClipCount));
    	AmmoMaxCount.SetString("text", string(DepinalWeapon(UTP.Weapon).AmmoCount));
    
    	LastAmmoCount = GetBulletInt(DepinalWeapon(UTP.Weapon).ClipCount, DepinalWeapon(UTP.Weapon).OrginClipCount);
    	AmmoBarMC.GotoAndStopI( ( LastAmmoCount > 15 ) ? 15 : LastAmmoCount );
    	
    	LevelTF.SetString("text", (DepinalGamePlayerController(PC).Level)$"");
    	ExpBarPer = GetExpInt((DepinalGamePlayerController(PC).XPGatheredForNextLevel), (DepinalGamePlayerController(PC).XPRequiredForNextLevel));
            LevelBarMC.GotoAndStopI( ( ExpBarPer > 10 ) ? 10 : ExpBarPer );
    
    
    
    
    }
    
    DefaultProperties
    {
    
    	bDisplayWithHudOff=false
    	MovieInfo=SwfMovie'GFxHUD.DepinalHudMain'
    	//bGammaCorrection = false
    }
    Code:
    class DepinalGameHudGFx extends UTHUDBase;
    
    var DepinalGFxHUD HudMovie;
    
    
    singular event Destroyed() 
    {
    	if (HudMovie != none) {
    
    		HudMovie.Close(true);
    		HudMovie = none;
    	}
    
    }
    
    
    simulated function PostBeginPlay()
    {
    	super.PostBeginPlay();
    
    	HudMovie = new class'DepinalGFxHUD';
    
    	HudMovie.SetTimingMode(TM_Real);
    
            HudMovie.Init(class'Engine'.static.GetEngine().GamePlayers[HudMovie.LocalPlayerOwnerIndex]);
    	HudMovie.SetViewScaleMode(SM_ExactFit);
            HudMovie.SetAlignment(Align_TopLeft);
            //HudMovie.ToggleCrosshair(true);
    }
    
    
    event PostRender() {
    	HudMovie.TickHUD();
    }
    
    DefaultProperties
    {
    }
    Any ideas would be much appreciated!
Working...
X