Announcement

Collapse
No announcement yet.

ScaleForm to display Ammo Count

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

    ScaleForm to display Ammo Count

    So here after hours searching online to figure out how to change the HUD, I've attempted to create HUD on displaying a customize Ammo Counter (no health).

    There have been a handful of different tutorials that handle "Health" displays, but I just want to focus on showing the ammo of a the player's weapon (just one weapon, so I don't need a fancy HUD).

    I've been using ScaleForm to create a .Swf and linked the flash code variables and movieclips into UnrealScript. All these was learning from http://www.alexander-fisher.com/?cat=7 , http://forecourse.com/unreal-tutorials/ (I sort of followed the logic behind this tutorial, but it uses Texture2D's instead of a flash movie clip) , http://udn.epicgames.com/Three/Scaleform.html.

    I drew heavily on the tutorial from http://noexp.wordpress.com/scaleform-hud-tutorial/, but I can't figure out how to call weapon variables instead of Pawn.uc variables. (I want to get things from UTweapon_myOwnGun - AmmoCount, MaxAmmoCount). I already have the flash code up in actionscript, and my scaleform is set up, and the .swf file is placed in the content file in the Unreal Editor.

    Any one have an idea where to begin?
    I'll post some code if needed. Also I am using a August 2010 build, so its fairly recent.

    #2
    I don't know how it works with scaleform, but i'm using
    Code:
    UTWeap(PlayerOwner.Pawn.Weapon).AmmoCount

    Comment


      #3
      Found this gem:
      http://lucas-williams.com/2011/02/udk-scaleform-hud-1/

      And with Dambob posted, I think I can replace:
      Code:
      Taken from No Experience Necessary and Lucas-Williams.com
      UTP = UTPawn(PlayerOwner.Pawn);
      
      and replace it like 
      
      UTW = UTWeapon(PlayerOwner.Pawn.Weapon);
      Another approach, should I instead...
      UTW = UTWeapon_MyCustomWeapon(PlayerOwner.Pawn.Weapon);
      Any feed back would be great.

      Comment


        #4
        heres the code im using



        var int i;
        var int i2;
        var int i3;
        var float LastAmmoCount;
        var SVWeapon LastWeapon;
        reemplase SVWeapon with your main weapon class example UTWeapon
        Weapon = SVWeapon(UTP.Weapon);
        if (Weapon != none)
        {
        if (Weapon != LastWeapon)
        {
        if (Weapon.AmmoDisplayType == EAWDS_None)
        ammotxt.SetText("");
        reserveammotxt.SetText("");

        i = (Weapon.ClipCount > 50 ? 50 : Weapon.AmmoCount);
        i2 = (Weapon.AmmoCount > 50 ? 50 : Weapon.AmmoCount);

        LastWeapon = Weapon;
        }
        i = Weapon.GetClipCount();
        i2 = Weapon.GetAmmoCount();
        if (i != LastAmmoCount)
        {
        LastAmmoCount = i;
        ammotxt.SetText(i);
        if (i > 50)
        i = 50;

        }
        if (i2 != LastAmmoCount)
        {
        LastAmmoCount = i2;
        reserveammotxt.SetText(i2);
        if (i2 > 50)
        i2 = 50;

        }

        }


        }

        Comment

        Working...
        X