Announcement

Collapse
No announcement yet.

Unattached weapon pawn.

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

    Unattached weapon pawn.

    My weapon pawn that should be attached to my vehicle is just hanging in the air and when i fly away with my vehicle it just stays on the same place doing nothing.
    U can use it but it won't move an inch.
    Can anyone help me here.

    cause I really wanna use my turret.

    #2
    You will need to attach your weapon pawn to a skeletal bone on the vehicle so it moves with the vehicle, and I'm sure you will also need make sure you have bHardAttach=True in the default properties.

    Check out some of the ONS weapon pawns and see how it's done. EG: ONSWeapon and ONSWeaponPawn.

    Code:
    function AttachToVehicle(ONSVehicle VehiclePawn, name WeaponBone){ .... }

    Comment


      #3
      Thx,i'll let you know if it worked

      Comment


        #4
        Thx it worked

        Comment


          #5
          mhhh, now i got another problem, when my caracter enters the minigun turret his caracter mesh get's drawn in the 2de controll chair.
          but if the vehicle moves he doesn't move

          ok... now what.
          for now i've made the caracter inviseble, but how do I fix this ?

          2de my minigun turret needs animation.
          the anim secuence is called FIRE, where and what do i have to type to get my minigun spin as soon as you start to fire.

          thx,
          Hyperforce

          Comment


            #6
            Not sure if this will help, but it fixed my pawns from doing the same thing. I think the problem lies in the vehicle code not supporting extrended xPawns. My pawns actually fell out of the vehicle and died, or just stayed in one place. If this don't fix that, then I'm not sure.

            Code:
            simulated event StartDriving(Vehicle V){
            	local int i;
            	local vector AttachPos;
            
            	bIgnoreForces = true;
            	DrivenVehicle = V;
            	NetUpdateTime = Level.TimeSeconds - 1;
            	StopWeaponFiring();
            	bCanTeleport = false;
            	ShouldCrouch(false);
            	AmbientSound = None;
            
            	bBaseForPawn=True;
            	if( PlayerShadow != None ) PlayerShadow.bShadowActive = false;
            	if ( WeaponAttachment != None ) WeaponAttachment.Hide(true);
            	for (i = 0; i < Attached.Length; i++) if (Projectile(Attached[i]) != None) Attached[i].SetBase(None);
            
            	if ( !V.bRemoteControlled || V.bHideRemoteDriver ){
            		SetCollision( False, False, False);
            		bCollideWorld = false;
            		// V.AttachDriver( Self );
            		// Hack Fix For not supprting Extended Pawn in vehicles.
            		// -----------------------------------------------------
            			bHardAttach = true;
            			AttachPos = V.Location + (V.DrivePos >> V.Rotation);
            			SetLocation( AttachPos );
            			SetPhysics( PHYS_Falling );			
            			SetBase( V );
            			SetPhysics(PHYS_None);
            			if (Base != V) SetBase( V );
            			SetRelativeRotation( V.DriveRot );
            		// -----------------------------------------------------
            		if ( V.bDrawDriverinTP ) CullDistance = 5000;
            		else bHidden = true;
            	}
            	if ( !V.bHideRemoteDriver && V.bDrawDriverinTP ){
            		if ( HasAnim(DrivenVehicle.DriveAnim) ) LoopAnim(DrivenVehicle.DriveAnim);
            		else LoopAnim('Vehicle_Driving');
            		SetAnimFrame(0.5);
            		SmoothViewYaw = Rotation.Yaw;
            		SetTwistLook(0,0);
            		}
            	}
            
            simulated event StopDriving(Vehicle V){
            	if ( (Role == ROLE_Authority) && (PlayerController(Controller) != None) ) V.PlayerStartTime = Level.TimeSeconds + 12;
            	CullDistance = Default.CullDistance;
            	NetUpdateTime = Level.TimeSeconds - 1;
            	if (V != None && V.Weapon != None ) V.Weapon.ImmediateStopFire();
            	if ( Physics == PHYS_Karma ) return;
            	DrivenVehicle	= None;
            	bIgnoreForces	= false;
            	bHardAttach	= false;
            	bWaitForAnim	= false;
            	bBaseForPawn	= default.bBaseForPawn;
            	bCanTeleport	= true;
            	bCollideWorld	= true;
            	AccelRate	= default.AccelRate;
            	PlayWaiting();
            	PrePivot = vect(0,0,0);
            	if ( V != None ) V.DetachDriver( Self );
            	bPhysicsAnimUpdate = Default.bPhysicsAnimUpdate;
            	SetCollision(True, True);
            	if ( (Role == ROLE_Authority) && (Health > 0) ){
            	    	if ( !V.bRemoteControlled || V.bHideRemoteDriver ){
            			if ( !PhysicsVolume.bWaterVolume ) SetPhysics(PHYS_Falling);
            			else SetPhysics(PHYS_Swimming);
            			if (IsHumanControlled() && !Level.Game.IsInState('MatchOver') ) PlayerController(Controller).ClientSetBehindView(false);
            			SetCollision(true,true,true);
            			bFrozenBody=False;
            			JumpZ=Default.JumpZ;
            			Acceleration = vect(0, 0, 24000);
            			SetPhysics(PHYS_Falling);
            			SetBase(None);
            			bHidden = false;
                    		}
            		}
            	bOwnerNoSee = default.bOwnerNoSee;
            	if ( Weapon != None ){
            		PendingWeapon = None;
            		Weapon.BringUp();
            		}
            	if( PlayerShadow != None ) PlayerShadow.bShadowActive = !bInvis;
            	if ( WeaponAttachment != None ) WeaponAttachment.Hide(false);
            }
            Animation is called via the PlayAnim( .... ); function, and is usually called by a function that controls then FX for the anim, like simulated function SpawnHitEffects( ... ); in the ONSManualGun code.
            PlayAnim('FIRE'); is what you need, and it's up to you where and when you call it.

            Keep in mind that the weapon has two anims, one in the Attachment class and one in the weapon. These are used for 1st and 3rd person views. If you only execute the PlayAnim() in the weapon code, other clients or 3rd person viewers such as spectators, will not see the anim.

            Suggest you check the Minigun code for this one. It should help with getting both 3rd and 1st person anims working.

            Comment


              #7
              thx, i'll try it,

              btw, i was refering to a vehicle minigun turret, not a player weapon

              Comment


                #8
                Could you plz send me the entire code:
                cause I can't get it to work.
                it says error: bad command or expression.

                :s

                my e-mail is hyperforce99@hotmail.com.

                Comment

                Working...
                X