Results 1 to 3 of 3
  1. #1

    Default Custom members in the pawn class?

    Hey, first off, I'll admit I'm new to UDK, so this is probably a very simple question.

    Anyways, I'm trying to make a game in which players have an energy variable they need to maintain along with health. This is the code that I have in my pawn class, and when I use Kismet's Get Property, with either energyMax, or energy, I can get a value for the custom property.

    Code:
    class HGPawn extends UTPawn;
    
    var int energy;
    var int energyMax;
    
    simulated event PostBeginPlay()
    {
        super.PostBeginPlay();
        energyMax=100;
        energy=100;
    }
    However when I try to use these variables in my HUD, I get the error "Error, Unrecognized member 'Energy' in class 'Pawn' Below is the line of code from my HUD that tries to use the energy variable.

    Code:
    Canvas.DrawTextCentered(PlayerOwner.Pawn.Energy);
    If anyone has any advice, it would be greatly appreciated. Thanks in advance.

  2. #2
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    You need to cast it to a HGPawn .. HGPawn(PlayerOwner.Pawn).Energy
    http://www.ericbla.de http://www.dungeondefenders.com http://en.wikipedia.org/wiki/Warm_Gun http://www.rekoil.com http://www.groundbranch.com

    - Please don't send me private messages asking programming questions, those would be better asked on the Programming forum here. Thanks

  3. #3

    Default

    Thank you


 

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.