No announcement yet.

Unattached weapon pawn.

  • 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.

    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.

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


      Thx,i'll let you know if it worked


        Thx it worked


          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.



            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.

            simulated event StartDriving(Vehicle V){
            	local int i;
            	local vector AttachPos;
            	bIgnoreForces = true;
            	DrivenVehicle = V;
            	NetUpdateTime = Level.TimeSeconds - 1;
            	bCanTeleport = false;
            	AmbientSound = None;
            	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 );
            			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');
            		SmoothViewYaw = Rotation.Yaw;
            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;
            	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);
            			Acceleration = vect(0, 0, 24000);
            			bHidden = false;
            	bOwnerNoSee = default.bOwnerNoSee;
            	if ( Weapon != None ){
            		PendingWeapon = None;
            	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.


              thx, i'll try it,

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


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


                my e-mail is