Announcement

Collapse
No announcement yet.

Close Scaleform Movie if alredy open & doesnt has a taret

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

    Close Scaleform Movie if alredy open & doesnt has a taret

    I got most of the stuff sorted up thanks to theflamingskunk

    But now what im triying to do is CLOSE the scaleform movie if its open(determinated by an bool variable) and if the Player Controller DOESNT have an current looking at target (determinated by an if statement)


    So well here is the code and ill point the parts where i initiate the movie etc etc

    SFHUDwrapper at post render event

    Code:
    	if(tfpPlayerController(PlayerOwner).LookAtTarget != None)  //tfpPlayerController(PlayerOwner).LookAtTarget != None
    	{  
    	    if(!bIsTooltipOpen)
    		{
    		ToggleTooltip();
    		bIsTooltipOpen = true;
    		bTest = true;
    		TooltipMovie.SetTargetLoc(Canvas.Project(tfpPlayerController(PlayerOwner).LookAtTarget.Location));
    		TooltipMovie.Update();
    		}
    		
    		
    	
    		
    		TooltipMovie.SetTargetLoc(Canvas.Project(tfpPlayerController(PlayerOwner).LookAtTarget.Location));
    		TooltipMovie.Update();
    		
    		
    		
    	}
    	
    
    
    	if(bIsTooltipOpen == true) // if our tooltip is open
    	{
    	if(tfpPlayerController(PlayerOwner).bFocused == false) // check if we have an target if we dont then close it  toggletooltip sets TooltipMovie.Close(false) whatever the movie is open
    	{
    	  ToggleTooltip();
    	  `log("if statement called");
    	}
    	}

    and now my player controller and the player tick event where i update the LookAtTarget actor to the pawn being viewed one

    Code:
          if(TraceHit.IsA('Actor')) // only show tooltip if we are looking at an item
              {
               LookAtTarget = TraceHit;  
               bFocused = true;		   
              }
    		  bFocused = false;

    thats pretty much it all i want to do is toggle the tooltipmovie off whatever the Trace inside tfpPlayerController result is none and the movie is being displayed becouse else right now once i get close to anything it shows well the tooltip but it never dissapears whatever my distance is

    #2
    Well i fixed the issue but now i have another one


    Basicly i have a function called ToggleTooltip() wich initiates the Tooltip the problem is that i only need to call this function only once whatever the player is looking at an actor


    And So i added a function in player tick with returns true whatever the player is looking at an trace the problem is that since it runs on tick my function gets initialised a LOT of times

    So i end up with +10 Tooltip Movies above the pawn so what im triying to do is just call the function Once


    anyway here is the code i am using


    player controller
    Code:
     event PlayerTick(float DeltaTime)
     {
      local vector StartLoc,EndLoc,HitLocation,HitNormal,StartTrace,EndTrace;
      local Actor TraceHit;
            
          if(bHasChar == true)
    	  {
    	          // do trace from eyes
    	       StartTrace = Pawn.Location;
    		   StartTrace.Z += Pawn.EyeHeight;
    		   EndTrace = StartTrace  * vector(Pawn.Rotation);
    		  TraceHit = Pawn.Trace(HitLocation, HitNormal, EndTrace, StartTrace, true, vect(0,0,0),, TRACEFLAG_Bullet);
    
    			
    				
    	       if(TraceHit.IsA('Actor')) // only show tooltip if we are looking at an item
              {
               LookAtTarget = TraceHit;
    		   bShowTooltip = true;
    		   ToggleTooltip();
    		       
              }
    code i used on my player controller to show the tooltip
    Code:
    function toggleTooltip()
    {
    if(bShowTooltip == true)
    {
    HUDClass.ToggleTooltip();
    }
    bShowTooltip = false;
    }
    now the code that creates the movie on my HUD wrapper

    Code:
    exec function  ShowTooltip()
    {
    if (TooltipMovie.bMovieIsOpen == true)
        {
    	 
    	   CloseTooltip();
    	   bIsMovieClosed = true;
    	   
    	}
    	else
    	{
    	
    	if( TooltipMovie == None)
    	 {
         TooltipMovie = new class'GFxTooltip'; //GFxUI_PauseMenu
    	 TooltipMovie.MovieInfo = SwfMovie'SurvivalGameFlash.Tooltip';		
    	 TooltipMovie.Start();
    	 TooltipMovie.SetTimingMode(TM_Real);
    	 TooltipMovie.Update();
    	 TooltipMovie.SetViewScaleMode(SM_ExactFit);
    	 TooltipMovie.SetAlignment(Align_Center);
    	 }
    	 
    	 if( bIsMovieClosed == true)
    	 {
    	   TooltipMovie = new class'GFxTooltip'; //GFxUI_PauseMenu
    	 TooltipMovie.MovieInfo = SwfMovie'SurvivalGameFlash.Tooltip';		
    	 TooltipMovie.Start();
    	 TooltipMovie.SetTimingMode(TM_Real);
    	 TooltipMovie.Update();
    	 TooltipMovie.SetViewScaleMode(SM_ExactFit);
    	 TooltipMovie.SetAlignment(Align_Center);
    	 }
    	
       } 
    }
    
    exec function CloseTooltip()
    {
    TooltipMovie.Close(true);
    
    }
    and finally my GFxTooltip class


    Code:
    class GFxTooltip extends GFxMoviePlayer;
    
    var Vector TargetScreenLoc;
    var tfpplayercontroller PC; 
    var GFxObject di2,ItemName,Description;
    var bool bShow;
    
    
    function bool Start(optional bool StartPaused = false)
    {
        super.Start();
    
    
      di2 = GetVariableObject("_root.TooltipMC");
      PC = tfpplayercontroller(GetPC());
      return true;
    }
    
    function Update()
    {
      local GFxObject.ASDisplayInfo DI;
    	  
    	 	
       
               di2 = GetVariableObject("_root.TooltipMC");
    	  
    		
    		
    		 
    		`log("X: " $TargetScreenLoc.X $" Y: " $TargetScreenLoc.Y);
    		 DI.hasX = true;
    		 DI.hasY = true;
    		 DI.X = TargetScreenLoc.X;
    		 DI.Y = TargetScreenLoc.Y;
    		 di2.SetDisplayInfo(DI);
    	 
    	
    		
    	
    	     
    	
    }
    
    
    
    function SetTargetLoc(vector loc)
    {
    	TargetScreenLoc = loc;
    }
    
    defaultproperties
    {
    bAutoPlay = false;on the render texture we created.
    }

    Any help is always appreciated

    Comment


      #3
      Updated the main post with my last problem

      Comment

      Working...
      X