Results 1 to 2 of 2
  1. #1
    MSgt. Shooter Person
    Join Date
    Apr 2010
    Posts
    134

    Default how to lock link beam on to pawns?

    The link gun alt fire locks on to vehicles and nodes, but not pawns. I'm trying to make it lock on to pawns too. Which function controls the beam lock?

  2. #2
    Palace Guard
    Join Date
    Jan 2010
    Location
    Germany
    Posts
    3,940

    Default

    UTWeap_LinkGun.uc: line 566 (at least in the UT3 source code)

    Code:
    /**
     * This function looks at how the beam is hitting and determines if this person is linkable
     */
    function AttemptLinkTo(Actor Who, PrimitiveComponent HitComponent)
    {
    	local UTVehicle UTV;
    	local UTOnslaughtObjective UTO;
    	local Vector 		StartTrace, EndTrace, V, HitLocation, HitNormal;
    	local Actor			HitActor;
    
    	// redirect to vehicle if owned by a vehicle and the vehicle allows it
    	if( Who != none )
    	{
    		UTV = UTVehicle(Who.Owner);
    		if (UTV != None && UTV.AllowLinkThroughOwnedActor(Who))
    		{
    			Who = UTV;
    		}
    	}
    
    	// Check for linking to pawns
    	UTV = UTVehicle(Who);
    	if (UTV != None && UTV.bValidLinkTarget)
    	{
    		// Check teams to make sure they are on the same side or empty
    		if ( WorldInfo.Game.GameReplicationInfo.OnSameTeam(UTV,Instigator) || (!UTV.bTeamLocked && UTV.CanEnterVehicle(Instigator)) )
    		{
    			if ( !WorldInfo.Game.GameReplicationInfo.OnSameTeam(UTV,Instigator)
    				&& (Instigator.GetTeamNum() != 255) )
    			{
    				UTV.SetTeamNum( Instigator.GetTeamNum() );
    			}
    			LinkedComponent = HitComponent;
    			if ( LinkedTo != UTV )
    			{
    				UnLink();
    				LinkedTo = UTV;
    				UTV.IncrementLinkedToCount();
    			}
    		}
    		else
    		{
    			// Enemy got in the way, break any links
    			UnLink();
    		}
    	}
    	else
    	{
    		UTO = UTOnslaughtObjective(Who);
    		if ( (UTO != none) && WorldInfo.Game.GameReplicationInfo.OnSameTeam(UTO,Instigator) )
    		{
    			if ( UTO.LinkHealMult > 0 )
    			{
    				if(LinkedTo != Who)
    				{
    					Unlink();
    				}
    				LinkedTo = UTO;
    				LinkedComponent = HitComponent;
    			}
    			else
    			{
    				UTO.FailedLinkHeal(Instigator.Controller);
    				UnLink();
    			}
    		}
    		else if (Who != None && !Who.bStatic)
    		{
    			UnLink();
    		}
    	}
    
    	if (LinkedTo != None)
    	{
    		// Determine if the link has been broken for another reason
    		if (LinkedTo.bDeleteMe || (Pawn(LinkedTo) != None && Pawn(LinkedTo).Health <= 0))
    		{
    			UnLink();
    			return;
    		}
    
    		// if we were passed in LinkedTo, we know we hit it straight on already, so skip the rest
    		if (LinkedTo != Who)
    		{
    			StartTrace = Instigator.GetWeaponStartTraceLocation();
    			EndTrace = GetLinkedtoLocation();
    
    			// First, check to see if we have skewed too much, or if the LinkedTo pawn has died and
    			// we didn't get cleaned up.
    			V = Normal(EndTrace - StartTrace);
    			if ( V dot vector(Instigator.GetViewRotation()) < LinkFlexibility || VSize(EndTrace - StartTrace) > 1.5 * WeaponRange )
    			{
    				UnLink();
    				return;
    			}
    
    			//  If something is blocking us and the actor, drop the link
    			HitActor = Trace(HitLocation, HitNormal, EndTrace, StartTrace, true);
    			if (HitActor != none && HitActor != LinkedTo)
    			{
    				UnLink(true);		// In this case, use a delayed UnLink
    			}
    		}
    	}
    
    	// if we are linked, make sure the proper flash location is set
    	if (LinkedTo != None)
    	{
    		SetFlashLocation(GetLinkedtoLocation());
    	}
    }


 

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.