Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Accessing Variables

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

  • Accessing Variables

    i need to know how i can access the varaible in the class myVehicle from class TempHud

    Code:
    class myVehicle extends Pawn
        config(User);
    
    //Basic Vehicle Controls--
    var float  Steering;       // between -1 and 1
    var float  TurnRate;      // How many units it can turn in one second.
    var float  Throttle;        // between -1 and 1
    var float  RateOfAccel; // The Acceleration until reaches Throttle Position
    
    
    defaultproperties
    {
    	TurnRate = 1.0;
    	Steering = 0;
    	Throttle = 0;
    	RateOfAccel = 10;
    }
    Code:
    class HudTemp extends HudBase;
    
    simulated function DrawHud(canvas c)
    {
    	local float vehThrottle;
    
    	super.DrawHud(c);
    	
    	if (PawnOwner.IsA('myVehicle'))
    	{
    		c.Drawtext("In A Vehicle");
    		vehThrottle = myVehicle(PawnOwner).Throttle;  //Hmmmmmm Should work??
    		c.Drawtext(vehThrottle);
    	}
    }
    Few things i have tried, but my lack of UTscripting knowledge hinders me. Any suggestions / tips

  • #2
    Maybe the text is written offscreen.
    Try a "c.setpos(x,y)" before the drawtexts so that you are sure its written on screen.

    Comment


    • #3
      No the text is not the problem

      Problem is not being able to compile.

      Comment


      • #4
        I know UCC compilation errors sometimes aren't much help, but please provide it anyway. Your code, as shown, seems like it should compile fine.

        Comment

        Working...
        X