fLUnKnhaXYU Posted July 30, 2019 Posted July 30, 2019 T3D version 3.9Ive just encountered this situation could someone explain What is happening here ? When in 3rd person POV , the turret gun seems to be firing in the reverse direction .1st person , player not mounted , but turret is the control object . 3rd person , turret is the control objectplayer mounted to turret , 1st personplayer mounted 3rd person Quote
Jason Campbell Posted July 30, 2019 Posted July 30, 2019 That is pretty cool. Off and on, I've been trying to get turrets working in general. When you say reverse, in which way is it reverse? I'm at work now but would like to see this working. Any chance you can post the code? I could check it out tonight. Quote
fLUnKnhaXYU Posted July 31, 2019 Author Posted July 31, 2019 Jason , If you're willing to look through this then , thank you and , certainly , have at it . Its mostly cut/copy/paste whichaccounts for any resemblance to any sort of professionalism . Id like to add that , for the models , I closely followed thedeploy-able turret example to get a working AI turret , which I showed-off in the show-off forum recently , and from that , thisexample . If you'd like , Ill put together a couple pictures of the modelling process and hierarchy tree . I'm still working onit to see what it does and doesn't need in order to work . //-------------------------------------------------------------------------------------------------------------------------- datablock ItemData(Panther_mainGun) { // Mission editor category category = "Weapon"; // Hook into Item Weapon class hierarchy. The weapon namespace // provides common weapon handling functions in addition to hooks // into the inventory system. className = "Weapon"; // Basic Item properties shapeFile = "art/shapes/weapons/panther_mainGun/panther_MainGun.DAE"; mass = 1; elasticity = 0.2; friction = 0.6; emap = true; // Dynamic properties defined by the scripts pickUpName = "pantherTankMainGun"; description = "player tank Turret"; image = panther_mainGunImage; reticle = "crossHair"; }; //====================================================================== //==============================================================WEAPON IMAGE WHICH WILL BE MOUNTED datablock ShapeBaseImageData(Panther_mainGunImage) { // Basic Item properties shapeFile = "art/shapes/weapons/panther_mainGun/panther_mainGun.DAE"; emap = true; // Specify mount point & offset for 3rd person, and eye offset // for first person rendering. mountPoint = 1;//============================================IF I RECALL CORRECTLY , iM HAVING AN ISSUE WITH THIS , MY NODE ON //==============================================================THE TURRET IS WEAPONMOUNT0 YET IF THIS PROPRTY IS SET TO 0 THE //==============================================================WEAPON MOUNTS TO THE TURRET ORIGIN AND , SET TO 1 , IS MOUNTING TO //==============================================================WEAPONMOUNT 0 , SO ??? firstPerson = true; // When firing from a point offset from the eye, muzzle correction // will adjust the muzzle vector to point to the eye LOS point. // Since this weapon doesn't actually fire from the muzzle point, // we need to turn this off. correctMuzzleVector = false; // Add the WeaponImage namespace as a parent, WeaponImage namespace // provides some hooks into the inventory system. className = "WeaponImage"; class = "WeaponImage"; // Projectile and Ammo ammo = BulletAmmo; projectile = TurretProjectile; projectileType = Projectile; projectileSpread = "0.01"; // Weapon lights up while firing lightColor = "0.992126 0.968504 0.708661 1"; lightRadius = "4"; lightDuration = "100"; lightType = "WeaponFireLight"; lightBrightness = 2; // Shake camera while firing. shakeCamera = false; // Images have a state system which controls how the animations // are run, which sounds are played, script callbacks, etc. This // state system is downloaded to the client so that clients can // predict state changes and animate accordingly. The following // system supports basic ready->fire->reload transitions as // well as a no-ammo->dryfire idle state. useRemainderDT = true; // Initial start up state stateName[0] = "Preactivate"; stateTransitionOnLoaded[0] = "Activate"; stateTransitionOnNoAmmo[0] = "NoAmmo"; // Activating the gun. Called when the weapon is first // mounted and there is ammo. stateName[1] = "Activate"; stateTransitionOnTimeout[1] = "Ready"; stateTimeoutValue[1] = 0.5; stateSequence[1] = "Activate"; // Ready to fire, just waiting for the trigger stateName[2] = "Ready"; stateTransitionOnNoAmmo[2] = "NoAmmo"; stateTransitionOnTriggerDown[2] = "Fire"; // Fire the weapon. Calls the fire script which does // the actual work. stateName[3] = "Fire"; stateTransitionOnTimeout[3] = "Reload"; stateTimeoutValue[3] = 0.1; stateFire[3] = true; stateRecoil[3] = ""; stateAllowImageChange[3] = false; stateSequence[3] = "Fire"; stateSequenceRandomFlash[3] = true; // use muzzle flash sequence stateScript[3] = "onFire"; stateSound[3] = CheetahTurretFireSound; stateEmitter[3] = TurretFireSmokeEmitter; stateEmitterTime[3] = 0.025; // Play the reload animation, and transition into stateName[4] = "Reload"; stateTransitionOnNoAmmo[4] = "NoAmmo"; stateWaitForTimeout[4] = "0"; stateTransitionOnTimeout[4] = "Ready"; stateTimeoutValue[4] = 1.2; stateAllowImageChange[4] = false; stateSequence[4] = "Reload"; //stateEjectShell[4] = true; // No ammo in the weapon, just idle until something // shows up. Play the dry fire sound if the trigger is // pulled. stateName[5] = "NoAmmo"; stateTransitionOnAmmo[5] = "Reload"; stateSequence[5] = "NoAmmo"; stateTransitionOnTriggerDown[5] = "DryFire"; // No ammo dry fire stateName[6] = "DryFire"; stateTimeoutValue[6] = 1.0; stateTransitionOnTimeout[6] = "NoAmmo"; stateScript[6] = "onDryFire"; }; //----------------------------------------------------------------------------- datablock TurretShapeData(panther_Turret) { category = "Turrets"; // shapeFile = "art/shapes/cheetah/cheetah_Turret.DAE";` shapeFile = "art/shapes/weapons/panther_Turret/panther_Turret_a2.DAE"; rotationZ = "0 0 0 0"; maxDamage = 70; destroyedLevel = 70; explosion = GrenadeExplosion; simpleServerCollision = false; //scanNode = "scanPoint"; //aimNode = "aimPoint"; zRotOnly = false; // Rotation settings minPitch = 15; maxPitch = 45; maxHeading = 360; headingRate = -1; pitchRate = -1; // Scan settings //maxScanPitch = 90; //minscanpitch = 75; //maxScanHeading = 315; //maxScanDistance = 450; //trackLostTargetTime = 2; //maxWeaponRange = 350; weaponLeadVelocity = 0.0; accufire = 0; // Weapon mounting numWeaponMountPoints = 1; weapon[0] = panther_mainGun; weaponAmmo[0] = AITurretAmmo; maxammo[bulletAmmo] = 100; weaponAmmoAmount[0] = 10000; maxInv[turret] = 1; maxInv[panther_mainGun] = 1; maxInv[AITurretAmmo] = 10000; //MOUNTING mountPose[0] = "sitting"; //=========================================i JUST COPIED THE AI TURRET SCRIPT AND THESE STATES ARE FROM IT //=========================================LEFT LIKE THIS SEEMS TO HAVE NO BAD EFFECT . ALL OF THEM CUT OUT //=========================================IS GOOD , INCLUDING THE DESTROYED STATE (7). i DESTROYED THE TURRET //=========================================AND IT SEEMED TO BEHAVE NORMALLY AND FADED OUT . DONT KNOW IF THERES //=========================================ANY USE FOR ANY OF THESE FOR THE TURRETSHAPE . // Initial start up state stateName[0] = "Preactivate"; stateTransitionOnAtRest[0] = "Scanning"; stateTransitionOnNotAtRest[0] = "Thrown"; // Scan for targets stateName[1] = "Scanning"; stateScan[1] = true; stateTransitionOnTarget[1] = "Target"; stateSequence[1] = "scan"; stateScript[1] = "OnScanning"; // Have a target stateName[2] = "Target"; stateTransitionOnNoTarget[2] = "NoTarget"; stateTransitionOnTimeout[2] = "Firing"; stateTimeoutValue[2] = 2.0; stateScript[2] = "OnTarget"; // Fire at target stateName[3] = "Firing"; stateFire[3] = true; stateTransitionOnNoTarget[3] = "NoTarget"; stateScript[3] = "OnFiring"; // Lost target stateName[4] = "NoTarget"; stateTransitionOnTimeout[4] = "Scanning"; stateTimeoutValue[4] = 2.0; stateScript[4] = "OnNoTarget"; // Player thrown turret stateName[5] = "Thrown"; stateTransitionOnAtRest[5] = "Deploy"; stateSequence[5] = "throw"; stateScript[5] = "OnThrown"; // Player thrown turret is deploying stateName[6] = "Deploy"; stateTransitionOnTimeout[6] = "Scanning"; stateTimeoutValue[6] = 2.5; stateSequence[6] = "deploy"; stateScaleAnimation[6] = true; stateScript[6] = "OnDeploy"; // Special state that is set when the turret is destroyed. // This state is set in the onDestroyed() callback. stateName[7] = "Destroyed"; stateSequence[7] = "destroyed"; }; //----------------------------------------------------------------------------- //==================================================================THE VEHICLE ///****************** datablock wheeledVehicleData(BGGerman_tank) { category = "vehiclesTracked"; className = "TANK"; shapefile = "art/shapes/mywhatever/battleground/tank/german/panther.dae"; emap = true; maxDamage = 1000.0; destroyedLevel = 0.85; maxSteeringAngle = 0.5;// Maximum steering angle tireEmitter = tankTireEmitter;// All the tires use the same dust emitter //mountPose[0] = "sitting"; numMountPoints = 2; //TurretObj = turret_t2; TURRETObjNode = 5;//=========================================WHICH NODE TO MOUNT THE TURRET TO //===================================IN THE ONADD FUNCTION THE TURRET IS MOUNTED TO THIS NODE //-----CAMERA canObserve = true; cameraDefaultFov = 90.0; cameraMinFov = 5.0; cameraMaxFov = 120.0; cameraMaxDist = 2; observeParameters = "0.5 4.5 4.5"; //3rd person camera settings cameraRoll = false;// Roll the camera with the vehicle cameraMaxDist = 10.0;// 4 Far distance from vehicle 20 cameraOffset = 0.0;// 4 Vertical offset from camera mount point 10 cameraLag = 1;// Velocity lag of camera cameraDecay = 1;// Decay per sec. rate of velocity lag shapeName = "Tank"; //Rigid Body mass = 550.0;//40 massCenter = "0.0 0.0 -0.5";// Center of mass for rigid body// 0 0 1 massBox = "3.0 9.0 4.0";// Size of box used for moment of inertia, // if zero it defaults to object bounding box drag = 0.6;// Drag coefficient bodyFriction = 0.03;//0.6 0.2 bodyRestitution = 0.04;//0.2 minImpactSpeed = 10.0;// Impacts over this invoke the script callback softImpactSpeed = 2.0;// Play SoftImpact Sound hardImpactSpeed = 15.0;// Play HardImpact Sound integration = 4;// Physics integration: TickSec/Rate collisionTol = 0.1;// Collision distance tolerance contactTol = 0.1;// Contact velocity tolerance speedDamageScale = 1.0; //Engine engineTorque = 1000.0;// Engine power 60 engineBrake = 500.0;// Braking when throttle is 0 350 20 brakeTorque = 750.0;// When brakes are applied 100 maxWheelSpeed = 21.0;// Engine scale by current speed / max speed //Energy directDamage = 1000.0; radiusDamage = 10.0; damageRadius = 10.0; impulse = 600.0; pushforce = 80.0; pushEnergyDrain = 0.0; maxEnergy = 30.0; jetForce = 8000.0; minJetEnergy = 5.0; jetEnergyDrain = 1.0; //Sounds jetSound = t2tankThrustSound; engineSound = t2tankEngineSound;//CarEngineSound squealSound = t2tankSquealSound; softImpactSound = t2tankSoftImpactSound; hardImpactSound = t2tankHardImpactSound; wheelImpactSound = t2tankWheelImpactSound; //MOUNTING mountPose[0] = "sitting"; mountPose[1] = "sitting"; // mountPose[2]= "sitting"; //mountPose[3] = "sitting"; // mountPose[4]= "sitting"; //mountPose[5] = "sitting"; // mountPose[6]= "sitting"; //mountPose[7] = "sitting"; numMountPoints = 1; isProtectedMountPoint[0] = FALSE; //values to pass to player on mount mountGui = "mountvehiclet2ctrl"; keymap = "vehiclekeymap1"; // vehmountnodedatablock[0] = "G1_Veh_Ob_Tnk_2Hv_PDr"; //ANIMATIONS //anim[0] = "trkfwdlow"; //anim[1] = ""; //anim[2] = ""; //anim[3] = ""; }; //============================================================================================================== // ONADD FUNCTION function BGGerman_TANK::onAdd(%this, %obj) { Parent::onAdd(%this, %obj); %obj.setWheelTire(0,bg_tank_Tire); %obj.setWheelTire(1,bg_tank_Tire); %obj.setWheelTire(2,bg_tank_Tire); %obj.setWheelTire(3,bg_tank_Tire); // Setup the car with some tires & springs for (%i = %obj.getWheelCount() - 1; %i >= 0; %i--) { %obj.setWheelPowered(%i, true); %obj.setWheelSpring(%i, bg_tank_Spring); } // Steer with the front tires %obj.setWheelSteering(0, 1); %obj.setWheelSteering(1, 1); //========================================================================CREATE AND ATTACH THE TURRET TO THE OBJECT echo("\c4TURRET OBJECT BEING MADE IN PANTHER SERVER SCRIPTS"); %obj.turretObj = new TurretShape()//==================================CREATE THE TURRET { respawn = "0"; static = "0";//1 rotate = "1"; isAIControlled = "0";//0 dataBlock = "panther_turret";//======================================which turret to use // position = "-795.576 -691.737 251.621"; Rotation = "1 0 0 0"; scale = "1 1 1"; canSave = "1"; canSaveDynamicFields = "1"; entranceThread = "-1"; invAITurretAmmo = "10000";//=====================================add ammo to the inventory invTurret = "1"; MOUNTABLE = "1";//===============================================allow the player to mount onto the turret }; echo("\c2GERMAN TANK TURRET OBJ = " @ %obj.turretobj);//==========this verifies to me that the object has been //========================================================================created successfully %obj.mountobject(%obj.turretobj, %this.turretObjNode);//========MOUNT THE NEW TURRET TO THE OBJECT %obj.turretobj.setimageammo(0,1);//============================load the weapon image mounted at //========================================================================weaponmount0 , loaded = 1(true) //========================================================================***MIGHT BE WORTH NOTING THAT I HAD TO NAME //========================================================================THIS MOUNT "WEAPONMOUNT0" , "WEAPONMOUNT_0" //========================================================================DID NOT WORK , } Quote
Jason Campbell Posted July 31, 2019 Posted July 31, 2019 Thanks, this should be enough to check. I don't think I need any models. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.