Results 1 to 13 of 13
  1. #1
    MSgt. Shooter Person
    Join Date
    Jul 2008
    Posts
    88

    Default Exec Function help

    Hello. I am trying to log when an exec function is called, but I don't think I am doing it right. here's the code:

    Code:
    exec function SwitchToBestWeapon (optional bool bForceNewWeapon)
    {
    
    		`log("***************************SWITCH HAS BEEN CALLED");
    
    }
    very primitive and probably incorrect, but I believe it worked in 2k4. Can someone point me in the right direction?

  2. #2
    MSgt. Shooter Person
    Join Date
    Jun 2009
    Posts
    400

    Default

    http://udn.epicgames.com/Three/ExecFunctions.html

    Where did you add this functions?

  3. #3
    MSgt. Shooter Person
    Join Date
    Jul 2008
    Posts
    88

    Default

    Thank you for the reply. I added it at the bottom of a vehicle function, but right above the default properties. What confuses be is that i also tried this with vehicle horn, and it still didn't write to the log. I will have to check the link you gave me to see what im doing wrong. I am testing with Unreal Ed, after compiling.

  4. #4
    MSgt. Shooter Person
    Join Date
    Jun 2009
    Posts
    400

    Default

    So what class?
    There are limitations. You can check the page i posted on my previous post. It's a updated version (UDK compatible) so the valid classes where to put exec functions into might be different.

    Quote Originally Posted by UDN
    Classes that are scanned for exec functions are (including all subclasses):
    • Input
    • Controller
    • Pawn
    • InventoryManager
    • Weapon
    • HUD
    • GameInfo
    • CheatManager
    • GameViewportClient
    • Interaction - Interactions placed into a PlayerController's Interactions array will be executed, but will not show up in the console command completion
    What are you trying to achieve, what do you want to do?

  5. #5
    MSgt. Shooter Person
    Join Date
    Jul 2008
    Posts
    88

    Default

    I have this:

    http://imageshack.us/gal.php?id=qp2m...1t7W0OWU1unLpA

    I want to make them fly like the UT space fighter. I was able to get some Z axis movement by this
    Code:
    bAllowZThrust=true
    but The other issue is that the roll of the craft causes the stay upright parameter to adjust too much, and sometimes spin out.

    The Exec Function: When Finished, I would like for it to ask the player if they want to Stop in mid-air, (which I know requires menu elements, I'm going to work on that) and does so, setting the rotation to the upright position.

    I saw your post in the Forum about the fury controls regarding the UT space fighter. I tried making a new vehicle class, extending UT vehicle, but I encountered several problems: It doesn't move, and any input I give it has no response. Should this:
    Code:
    Auto State Flying
    {
    
    
    simulated	function FaceRotation(rotator NewRotation, float DeltaTime)
    //Simulated function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
    {
    
    Begin:
    
    	local vector	X,Y,Z;
    	local float		CurrentSpeed;
    	local float		EngineAccel;
    	local float		RotationSmoothFactor;
    	local float		RollChange;
    	//local Rotator	NewRotation;
    	SetPhysics(PHYS_Flying);
    	if ( !bPostNetCalled || Controller == None )
    		return;
    
    	if ( !bInitialized  )
    	{
    		// Laurent -- Velocity Override
    		// When Player Spawns with the spaceship as Pawn, velocity is reset at start match
    		// since Rotation is overwritten later by Rotator(Velocity), it gets reset to Rotation(0,0,0)
    		// And therefore not using the one set in PlayerStart.Rotation
    		Acceleration = EngineMinVelocity * Vector(Rotation);
    		SpaceFighterRotation = QuatFromRotator( Rotation );
    		bInitialized = true;
    	}
    
    	// Only allow space fighter to change gear once landing gear is up.
    	// (small hack for fins animations)
    	if ( bGearUp == true )
    		DesiredVelocity	= FClamp( DesiredVelocity+PlayerController(Controller).PlayerInput.aForward*DeltaTime/15.f,
    								EngineMinVelocity, 1000.f);
    	else
    		DesiredVelocity	= EngineMinVelocity;
    
    	CurrentSpeed	= FClamp( (Velocity Dot Vector(Rotation)) * 1000.f / AirSpeed, 1.f, 1000.f);
    	EngineAccel		= (DesiredVelocity - CurrentSpeed) * 100.f;
    
    	RotationSmoothFactor = FClamp(1.f - RotationInertia * DeltaTime, 0.f, 1.f);
    
    	if ( PlayerController(Controller).PlayerInput.bDuck > 0 && Abs(Rotation.Roll) > 500 )
    	{
    		// Auto Correct Roll
    		if ( Rotation.Roll < 0 )
    			RollChange = RollAutoCorrectSpeed;
    		else
    			RollChange = -RollAutoCorrectSpeed;
    	}
      	else if ( PlayerController(Controller).PlayerInput.aUp > 0 ) // Rolling
      		RollChange = PlayerController(Controller).PlayerInput.aStrafe * 0.66;
    
    	// Rotation Acceleration
    	YawAccel	= RotationSmoothFactor*YawAccel   + DeltaTime*VehicleRotationSpeed*PlayerController(Controller).PlayerInput.aTurn*-1;
    	PitchAccel	= RotationSmoothFactor*PitchAccel + DeltaTime*VehicleRotationSpeed*PlayerController(Controller).PlayerInput.aLookUp*-1;
    	RollAccel	= RotationSmoothFactor*RollAccel  + DeltaTime*VehicleRotationSpeed*RollChange;
    
    	YawAccel	= FClamp( YawAccel, -1, 1 );
    	PitchAccel	= FClamp( PitchAccel, -1, 1 );
    	RollAccel	= FClamp( RollAccel, -1, 1 );
    
    	// Perform new rotation
    	GetAxes( QuatToRotator(SpaceFighterRotation), X, Y, Z );
    	SpaceFighterRotation = QuatProduct(SpaceFighterRotation,
    								QuatProduct(QuatFromAxisAndAngle(Y, DeltaTime*PitchAccel),
    								QuatProduct(QuatFromAxisAndAngle(Z, -1.0 * DeltaTime * YawAccel),
    								QuatFromAxisAndAngle(X, DeltaTime * RollAccel))));
    
    	NewRotation = QuatToRotator( SpaceFighterRotation );
    
    	// If autoadjusting roll, clamp to 0
    	if ( PlayerController(Controller).PlayerInput.bDuck > 0 && ((NewRotation.Roll < 0 && Rotation.Roll > 0) || (NewRotation.Roll > 0 && Rotation.Roll < 0)) )
    	{
    		NewRotation.Roll = 0;
    		RollAccel = 0;
    	}
    
    	Acceleration = Vector(NewRotation) * DesiredVelocity;
    
    	// strafing
    	StrafeAccel	= RotationSmoothFactor*StrafeAccel;
    	if ( PlayerController(Controller).PlayerInput.aUp == 0 )
    		StrafeAccel	+= DeltaTime*StrafeAccelRate*PlayerController(Controller).PlayerInput.aStrafe;
    	StrafeAccel = FClamp( StrafeAccel, -MaxStrafe, MaxStrafe);
    	GetAxes( NewRotation, X, Y, Z );
    	Acceleration += StrafeAccel * Y;
    
    	// Adjust Rolling based on Stafing
    	NewRotation.Roll += StrafeAccel * 100;
    	DelayedDebugString = "NewRotation.Roll:" @ NewRotation.Roll @ "StrafeAccel:" @ StrafeAccel;
    	
    	// Adjust Rolling based on Yaw
    	NewRotation.Roll += YawAccel * 100;
    	DelayedDebugString = "NewRotation.Roll:" @ NewRotation.Roll @ "StrafeAccel:" @ StrafeAccel;
    	
    
    	// Take complete control on Rotation
    	bRotateToDesired	= true;
    	bRollToDesired		= true;
    	DesiredRotation		= NewRotation;
    	SetRotation( NewRotation );
    
    
    
    	
    		//WorldInfo.Game.Broadcast(self,"New Rotation is:" @NewRotation);		
    			WorldInfo.Game.Broadcast(self,"***Velocity is" @Velocity);
    			WorldInfo.Game.Broadcast(self,"***AirSpeed is" @AirSpeed);
    						WorldInfo.Game.Broadcast(self,"***Accel is" @Acceleration);
    	WorldInfo.Game.Broadcast(self,"***CurrentSpeed is" @CurrentSpeed);
    		WorldInfo.Game.Broadcast(self,"This Thing That Is controlling it all is Rotation:" @Rotation);
    }
    	event BeginState(Name PreviousStateName)
    	{
    	WorldInfo.Game.Broadcast(self,"***IT HAS BEGUN");
    
    	}
    	event EndState(Name NextStateName)
    	{
    		setPhysics(Phys_Falling);
    		WorldInfo.Game.Broadcast(PlayerController(Controller),"***IT HAS DIED.");
    		  TakeDamage(Health*2, PlayerController(Controller), Location, vect(0,0,0), None);
    	}
    goto 'Begin';
    }
    
    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
    {
    	if ( Role == Role_Authority )
    	{
    		if ( !bPostNetCalled )
    			return;
    
    		//UpdateAutoTargetting();
    
    		// Hack when spacefighter gets stuck... kill!!
    		if ( VSize(Velocity) < 100 )
    		//	TakeDamage(Health*2, Self, Location, vect(0,0,0), None);
    			WorldInfo.Game.Broadcast(PlayerController(Controller),"***I AM SUPPOSSED TO BE DEAD");
    	}
    }
    
    //event TakeDamage(int Damage, Controller InstigatedBy, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    simulated function rotator GetViewRotation()
    {
    	if ( IsLocallyControlled() && Health > 0 )
    		return QuatToRotator(SpaceFighterRotation);	// true rotation
    	else
    		return Rotation;
    }
    }
    Code:
     simulated function bool DriverEnter(Pawn P)
    {
    	super.DriverEnter( P );
    	 `log("******DriverEntered" );
     //GotoState('Flying');
     SetPhysics(PHYS_Flying);
    	// Don't start at full speed
    	Velocity = EngineMinVelocity * Vector(Rotation);
        Acceleration = Velocity;
    	`log("*******Velocity:" @ Velocity);
    	AntiGravity(P);
    	return true;
    }


    New Update: Able to get the redeemer method to work (somewhat). It rolls, but It isn't Moving (no airspeed). I don't know what the problem is, but I am looking at it.

    EDIT: ABLE to get the spacefighter Rotation to work, although it is kinda jumpy. I am unable to get it to move, however. The current movement code is at top.
    Last edited by 1Lt Coagulator; 07-31-2012 at 05:36 PM.

  6. #6

    Default

    This might be releveant, for both this thread and the other one about the fury.


    - Some weeks ago i took the 'Skaarj SpaceFighter' from 'Unreal' and i used the Cicada for the code.

    - The cicada is very easy to tweak and change; but i cannot comment on the Fury.
    -maybe trying the cicada code will be easier, or maybe it does not have the stuff you want... but i thought i would pitch in anyway

    - i had problems with new projectiles though

  7. #7
    MSgt. Shooter Person
    Join Date
    Jul 2008
    Posts
    88

    Default

    Thanks for the reply, but This code is from the UT2k4 AsVehicle_Spacefighter.UC (unless you were pointing that to me in the first place ). The issue is that for some reason, I can't link the Pawn's velocity with the forward velocity. I am looking into it, but I really do appreciate it!

  8. #8
    MSgt. Shooter Person
    Join Date
    Jun 2009
    Posts
    400

    Default

    Do you use the UTVehicle class as base? In that case, you need to implement the rotation code into the VehicleWeapon code.

  9. #9
    MSgt. Shooter Person
    Join Date
    Jul 2008
    Posts
    88

    Default

    Big Edit: Able to get craft to move using an addimpulse, but now it doesn't even turn.
    In the Autostate, If I had
    Code:
    SetPhysics(PHYSNone)
    Then It wouldn't move, but turn.

    If it was
    Code:
    SetPhysics(PHYS_Flying)
    Then it wouldn't Turn, but fly in the direction the camera is pointing...

    Why is this happening?

    I also made another vehicle, kept the simobject, and just added impulse without quaternions, and stuff. It actually flew, and turned, and adjusted to where you turn. How Can I keep it from Spinning from trying to remain with the top facing a positive Direction on the Z-Axis? If I can get this to work, It'll help alot.
    Last edited by 1Lt Coagulator; 08-02-2012 at 06:09 AM.

  10. #10
    MSgt. Shooter Person
    Join Date
    Jul 2008
    Posts
    88

    Default

    I am not sure if Anyone knows, But it seems that the SetRotation() function doesn't really work in this case, or this is what is causing the problem. It doesn't work if Physics are set to Phys_Flying under faceRotation(). I'm going to try it under a tick function.


    Also, I'm having a Problem with A configureable mutator. I've followed this http://www.moddb.com/games/unreal-to...rable-mutators to the letter, and read all the posts. I tried everything that there was on the page, couldn't find a solution. I'm using mapmixer, but it says it's unable to find the UIScene (even though it's in the background), the menu background ceases panning, and then both UIScenes (yes, the one I created and Mapmixer's mutator list) are visible on the screen. I've spent 5 hours trying to solve it, perhaps I just need sleep, but advice is appreciated. I'll post whether or not I solve it.

    Edit: Problem Still Unsolved, Still reviewing for errors, as well as the Phys_Flying issue.
    Last edited by 1Lt Coagulator; 08-06-2012 at 01:57 PM.

  11. #11
    MSgt. Shooter Person
    Join Date
    Jul 2008
    Posts
    88

    Default

    Big Edit: Ut3 3d Flight has been Achieved, although primitive. If anyone is following and would like to know how, let it be known.

  12. #12
    MSgt. Shooter Person
    Join Date
    Jun 2009
    Posts
    400

    Default

    I'm interested. Please, post it here so anyone can read it.

  13. #13
    MSgt. Shooter Person
    Join Date
    Jul 2008
    Posts
    88

    Default

    [QUOTE=1Lt Coagulator;30621304]I have this:

    http://imageshack.us/gal.php?id=qp2m...1t7W0OWU1unLpA

    I want to make them fly like the UT space fighter. I was able to get some Z axis movement by this
    Code:
    bAllowZThrust=true
    but The other issue is that the roll of the craft causes the stay upright parameter to adjust too much, and sometimes spin out.

    The Exec Function: When Finished, I would like for it to ask the player if they want to Stop in mid-air, (which I know requires menu elements, I'm going to work on that) and does so, setting the rotation to the upright position.

    I saw your post in the Forum about the fury controls regarding the UT space fighter. I tried making a new vehicle class, extending UT vehicle, but I encountered several problems: It doesn't move, and any input I give it has no response. Should this:
    Code:
    Auto State Flying
    {
    
    
    simulated	function FaceRotation(rotator NewRotation, float DeltaTime)
    //Simulated function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
    {
    
    Begin:
    
    	local vector	X,Y,Z;
    	local float		CurrentSpeed;
    	local float		EngineAccel;
    	local float		RotationSmoothFactor;
    	local float		RollChange;
    	//local Rotator	NewRotation;
    	SetPhysics(PHYS_Flying);
    	if ( !bPostNetCalled || Controller == None )
    		return;
    
    	if ( !bInitialized  )
    	{
    		// Laurent -- Velocity Override
    		// When Player Spawns with the spaceship as Pawn, velocity is reset at start match
    		// since Rotation is overwritten later by Rotator(Velocity), it gets reset to Rotation(0,0,0)
    		// And therefore not using the one set in PlayerStart.Rotation
    		Acceleration = EngineMinVelocity * Vector(Rotation);
    		SpaceFighterRotation = QuatFromRotator( Rotation );
    		bInitialized = true;
    	}
    
    	// Only allow space fighter to change gear once landing gear is up.
    	// (small hack for fins animations)
    	if ( bGearUp == true )
    		DesiredVelocity	= FClamp( DesiredVelocity+PlayerController(Controller).PlayerInput.aForward*DeltaTime/15.f,
    								EngineMinVelocity, 1000.f);
    	else
    		DesiredVelocity	= EngineMinVelocity;
    
    	CurrentSpeed	= FClamp( (Velocity Dot Vector(Rotation)) * 1000.f / AirSpeed, 1.f, 1000.f);
    	EngineAccel		= (DesiredVelocity - CurrentSpeed) * 100.f;
    
    	RotationSmoothFactor = FClamp(1.f - RotationInertia * DeltaTime, 0.f, 1.f);
    
    	if ( PlayerController(Controller).PlayerInput.bDuck > 0 && Abs(Rotation.Roll) > 500 )
    	{
    		// Auto Correct Roll
    		if ( Rotation.Roll < 0 )
    			RollChange = RollAutoCorrectSpeed;
    		else
    			RollChange = -RollAutoCorrectSpeed;
    	}
      	else if ( PlayerController(Controller).PlayerInput.aUp > 0 ) // Rolling
      		RollChange = PlayerController(Controller).PlayerInput.aStrafe * 0.66;
    
    	// Rotation Acceleration
    	YawAccel	= RotationSmoothFactor*YawAccel   + DeltaTime*VehicleRotationSpeed*PlayerController(Controller).PlayerInput.aTurn*-1;
    	PitchAccel	= RotationSmoothFactor*PitchAccel + DeltaTime*VehicleRotationSpeed*PlayerController(Controller).PlayerInput.aLookUp*-1;
    	RollAccel	= RotationSmoothFactor*RollAccel  + DeltaTime*VehicleRotationSpeed*RollChange;
    
    	YawAccel	= FClamp( YawAccel, -1, 1 );
    	PitchAccel	= FClamp( PitchAccel, -1, 1 );
    	RollAccel	= FClamp( RollAccel, -1, 1 );
    
    	// Perform new rotation
    	GetAxes( QuatToRotator(SpaceFighterRotation), X, Y, Z );
    	SpaceFighterRotation = QuatProduct(SpaceFighterRotation,
    								QuatProduct(QuatFromAxisAndAngle(Y, DeltaTime*PitchAccel),
    								QuatProduct(QuatFromAxisAndAngle(Z, -1.0 * DeltaTime * YawAccel),
    								QuatFromAxisAndAngle(X, DeltaTime * RollAccel))));
    
    	NewRotation = QuatToRotator( SpaceFighterRotation );
    
    	// If autoadjusting roll, clamp to 0
    	if ( PlayerController(Controller).PlayerInput.bDuck > 0 && ((NewRotation.Roll < 0 && Rotation.Roll > 0) || (NewRotation.Roll > 0 && Rotation.Roll < 0)) )
    	{
    		NewRotation.Roll = 0;
    		RollAccel = 0;
    	}
    
    	Acceleration = Vector(NewRotation) * DesiredVelocity;
    
    	// strafing
    	StrafeAccel	= RotationSmoothFactor*StrafeAccel;
    	if ( PlayerController(Controller).PlayerInput.aUp == 0 )
    		StrafeAccel	+= DeltaTime*StrafeAccelRate*PlayerController(Controller).PlayerInput.aStrafe;
    	StrafeAccel = FClamp( StrafeAccel, -MaxStrafe, MaxStrafe);
    	GetAxes( NewRotation, X, Y, Z );
    	Acceleration += StrafeAccel * Y;
    
    	// Adjust Rolling based on Stafing
    	NewRotation.Roll += StrafeAccel * 100;
    	DelayedDebugString = "NewRotation.Roll:" @ NewRotation.Roll @ "StrafeAccel:" @ StrafeAccel;
    	
    	// Adjust Rolling based on Yaw
    	NewRotation.Roll += YawAccel * 100;
    	DelayedDebugString = "NewRotation.Roll:" @ NewRotation.Roll @ "StrafeAccel:" @ StrafeAccel;
    	
    
    	// Take complete control on Rotation
    	bRotateToDesired	= true;
    	bRollToDesired		= true;
    	DesiredRotation		= NewRotation;
    	SetRotation( NewRotation );THIS IS WHAT THE ISSUE IS. LOOK AT POST TO SEE WHY
    
    
    
    	
    		//WorldInfo.Game.Broadcast(self,"New Rotation is:" @NewRotation);		
    			WorldInfo.Game.Broadcast(self,"***Velocity is" @Velocity);
    			WorldInfo.Game.Broadcast(self,"***AirSpeed is" @AirSpeed);
    						WorldInfo.Game.Broadcast(self,"***Accel is" @Acceleration);
    	WorldInfo.Game.Broadcast(self,"***CurrentSpeed is" @CurrentSpeed);
    		WorldInfo.Game.Broadcast(self,"This Thing That Is controlling it all is Rotation:" @Rotation);
    }
    	event BeginState(Name PreviousStateName)
    	{
    	WorldInfo.Game.Broadcast(self,"***IT HAS BEGUN");
    
    	}
    	event EndState(Name NextStateName)
    	{
    		setPhysics(Phys_Falling);
    		WorldInfo.Game.Broadcast(PlayerController(Controller),"***IT HAS DIED.");
    		  TakeDamage(Health*2, PlayerController(Controller), Location, vect(0,0,0), None);
    	}
    goto 'Begin';
    }
    
    function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
    {
    	if ( Role == Role_Authority )
    	{
    		if ( !bPostNetCalled )
    			return;
    
    		//UpdateAutoTargetting();
    
    		// Hack when spacefighter gets stuck... kill!!
    		if ( VSize(Velocity) < 100 )
    		//	TakeDamage(Health*2, Self, Location, vect(0,0,0), None);
    			WorldInfo.Game.Broadcast(PlayerController(Controller),"***I AM SUPPOSSED TO BE DEAD");
    	}
    }
    
    //event TakeDamage(int Damage, Controller InstigatedBy, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    simulated function rotator GetViewRotation()
    {
    	if ( IsLocallyControlled() && Health > 0 )
    		return QuatToRotator(SpaceFighterRotation);	// true rotation
    	else
    		return Rotation;
    }
    }
    Code:
     simulated function bool DriverEnter(Pawn P)
    {
    	super.DriverEnter( P );
    	 `log("******DriverEntered" );
     //GotoState('Flying');
     SetPhysics(PHYS_Flying);
    	// Don't start at full speed
    	Velocity = EngineMinVelocity * Vector(Rotation);
        Acceleration = Velocity;
    	`log("*******Velocity:" @ Velocity);
    	AntiGravity(P);
    	return true;
    }

    Where the red text is is the sole problem that Gets the ship to point in the right Direction. What it needs to be replaced with:
    Code:
    SetRBRotation(NewRotation);
    The reason or explanation: Through trial and error, I have seen that when the physics is set to PHYS_NONE, it rotates to the desired location, but doesn't move because
    Code:
    Mesh.AddImpulse(Impulse,,,true);
    Only effects a body with physics that allows for forces (in this case a velocity, as denoted by TRUE) to effect it. When the physics is set to Phys_Flying for example, It is now able to be pushed, so to speak. However, it does not rotate; changing the
    Code:
    SetRotation(NewRotation) <---Change to ---> SetRBRotation(NewRotation);
    should turn it in that direction, although I'm currently trying to remake what I had previously.

    I got a hint from this thread: http://forums.epicgames.com/threads/...highlight=spin
    Even though this code is from UT2004, I was able to change it and allow (somewhat) usable space flight. I really dont know why it acts the way it does, I really dont understand the quaternions (I even took calculus 3), but I'm going to try and replicate flight from an MMORPG called Ace Online.

    My ONLY problem is that with what I have now, It rotates as FAST AS THE USER CAN MOVE THE MOUSE. I don't know how to change this, But I will be looking into it. The flight is primitive, and unstable, but I'll keep in touch.


 

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.