Home   Help Search Login Register  

Author Topic: Landing Gear Goes Up  (Read 3527 times)

0 Members and 1 Guest are viewing this topic.

Offline Pilot

  • Contributing Member
  • **
Landing Gear Goes Up
« on: 11 Jan 2005, 23:16:10 »
Ok, I know the Subject line seems a little strange, but I'll explain.  I have a custom gear animation for my plane.  The problem is, after the plane leaves the ground, the gear goes up without the user telling it to.  Normally this is ok, but on landing, when the plane bounces or goes over rough terrain, the gear still goes up.  Obviously, this is undesired.  I think the problem lies in the landing gear animation eventhandler, but I'm not sure.  Any suggestions?

The Eventhandler:
Code: [Select]
class EventHandlers
            {
                  gear = "if (_this Select 1) then {(_this Select 0) Animate [""LeftGear"", 0]; (_this Select 0) Animate [""RightGear"", 0]; (_this Select 0) Animate [""NoseGear"", 0]; (_this Select 0) Animate [""LeftStrut"", 0]; (_this Select 0) Animate [""RightStrut"", 0]} else {(_this Select 0) Animate [""LeftGear"", 1]; (_this Select 0) Animate [""RightGear"", 1]; (_this Select 0) Animate [""NoseGear"", 1]; (_this Select 0) Animate [""LeftStrut"", 1]; (_this Select 0) Animate [""RightStrut"", 1]}";
            };

Cataclyzm

  • Guest
Re:Landing Gear Goes Up
« Reply #1 on: 12 Jan 2005, 01:03:54 »
What I am wondering is if you have this animation start with an action option? ... It is a much safer that way.

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #2 on: 12 Jan 2005, 03:37:55 »
Yes, this animation starts when the player selects the Gear Up/Gear Down action from the action menu.  But for some reason, it also starts when the plane leaves the ground, and I can't figure out why.

Cataclyzm

  • Guest
Re:Landing Gear Goes Up
« Reply #3 on: 12 Jan 2005, 23:50:40 »
ok, I am not the best scripter ... as a matter of fact I am learning as I go myself.  But, as far as I am to understand the "gear" variable is a constant that is a boleen.  So I suppose that the script would confuse ofp.  I would think that it should generate an error, but I am not an expert.

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #4 on: 13 Jan 2005, 02:45:24 »
The gear animation isn't run in a script.  It is all taken care of in the config.

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #5 on: 13 Jan 2005, 17:49:07 »
Ok, I have found a plane that does not automatically raise the gear when it's off the ground.  Problem is, I can find nothing different in it's config from my config that controls the gear.

My Config:
Code: [Select]
//Commercial Airplanes

//Defines
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

#define private 0
#define protected 1
#define public 2

//CfgPatches//////////
class CfgPatches
{
   class Boeing757
   {
      units[] = {Boeing757};
      weapons[] = {};
      requiredVersion = 1.85
   };
};

//CfgModels//////////
class CfgModels
{
   class default{};
   class Vehicle: default{};
   class Boeing757: Vehicle
   {
      sectionsInherit = "Vehicle";
      sections[] = {"vrtule staticka", "vrtule blur"};
   };
};

//CfgVehicles//////////
class CfgVehicles
{
   class All {};
   class AllVehicles: All {};
   class Air: AllVehicles {};
   class Plane: Air {};
   class Boeing757: Plane
   {
      type=VAir;
      vehicleClass="Air";
      icon="a10";
      picture=\Boeing757\picture.jpg;
      displayName="Boeing 757";
      scope=public;
      nameSound="plane";
      side=TCivilian      
      model="\Boeing757\Boeing757.p3d";
      hasgunner=1;
      driveriscommander=1;
      cost=150000
      gearRetracting = true;
      ejectSpeed[]={0,0,0};
      soundEngine[]={"\Boeing757\757engine.wav",db20,1.0};
      maxspeed=800;
      armor=120;
      fov=0.7;   
      precision=1;   
      aileronsensitivity=2.0;
      elevatorsensitivity=9.0;
      nosedowncoef=9;
      brakedistance=400;
      landingSpeed = 210;
      landingAoa = 10*3.1415/180;
      transportsoldier=1;
      crew = "Civilian";
      driverAction=ManActCessnaPilot;
      cargoAction[]={"ManActCessnaCargo","ManActCessnaCargo"};
      gunnerAction = ManActCessnaPilot;
      irtarget=true;
      irscanrange=2000
      irscanground=false
      weapons[]={};
      magazines[]={};
      audible = 10;
      wheelSteeringSensitivity=15.0;
      threat[]={0.0, 0.5, 1.0};
      class Reflectors
      {
         class Left
         {
            color[] = {1.0, 1.0, 1.0, 1.0};
            ambient[] = {0.1, 0.1, 0.1, 1.0};
            position = "L svetlo";
            direction = "konec L svetla";
            hitpoint = "L svetlo";
            selection = "L svetlo";
            size = 0.8;
            brightness = 0.9;
         };
         class Right
         {
            color[] = {1.0, 1.0, 1.0, 1.0};
            ambient[] = {0.1, 0.1, 0.1, 1.0};
            position = "P svetlo";
            direction = "konec P svetla";
            hitpoint = "P svetlo";
            selection = "P svetlo";
            size = 0.8;
            brightness = 0.9;
         };
      };
      animated=1;
            class Animations
            {
                  class LeftGear
                  {
                        type="rotation";
                        animPeriod=5;
                        selection="left gear";
                        axis="axis gear left";
                        angle0=0
                        angle1=-1.55;
                  };
                  class RightGear
                  {
                        type="rotation";
                        animPeriod=5;
                        selection="right gear";
                        axis="axis gear right";
                        angle0=0
                        angle1=1.55;
                  };
                  class NoseGear
                  {
                        type="rotation";
                        animPeriod=5;
                        selection="nose gear";
                        axis="axis nose gear";
                        angle0=0
                        angle1=2.2;
                  };
         class LeftStrut
         {
            type="rotation";
                        animPeriod=5;
                        selection="left strut";
                        axis="axis left strut";
                        angle0=0
                        angle1=-0.09;
         };      
         class RightStrut
         {
            type="rotation";
                        animPeriod=5;
                        selection="right strut";
                        axis="axis right strut";
                        angle0=0
                        angle1=0.09;
         };      
            };
      class EventHandlers
            {
         init = "[_this select 0] exec ""\Boeing757\checkgear.sqs"" ";
                  gear="if (_this select 1) then {[_this select 0] exec""\Boeing757\geardown.sqs""} else {[_this select 0] exec ""\Boeing757\gearup.sqs""}";
            };
   };
};

The Beriev Be-32K config:
Code: [Select]
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

#define private 0
#define protected 1
#define public 2

class CfgPatches
{
   class FWA_Be32K
        {
      units[] = {FWA_Be32K, FWA_BE32KRus};
      weapons[] = {};
      requiredVersion = 1.9;   
   };
};

class CfgModels
{
   class Default {};
   class vehicle: default {};
   
   class FWA_Be32K: vehicle
   {
      sectionsInherit="Vehicle";
      sections[]={"vrtule staticka","vrtule blur","light"};
   };
   class FWA_Be32K2:FWA_Be32K{};
};
class CfgTextureToMaterial
{
  class FWA_Be32K
  {
     textures[]=
     {
   "FWA_Be32K\wheel.pac",
   "FWA_Be32K\eng2.pac",
   "FWA_Be32K\fuse2.pac",
   "FWA_Be32K\fuse2m.pac",
   "FWA_Be32K\wingb2.pac",
   "FWA_Be32K\wingt2.pac",
   "FWA_Be32K\tailb2.pac",
   "FWA_Be32K\tailt2.pac",

   "FWA_Be32K\Rustailb.pac",
   "FWA_Be32K\ruswingb.pac",
   "FWA_Be32K\Rustailt.pac",
   "FWA_Be32K\ruswingt.pac",
   "FWA_Be32K\Ruseng.pac",
   "FWA_Be32K\Rus.pac",
     };
     material="#FWA_Be32K";
  };
 
};

class CfgMaterials
{
  class FWA_Be32K
  {
   ambient[]={.8,.8,.9,1};
     diffuse[]={1,1,1,1};
     forcedDiffuse[]={0,0,0,0};
     specular[]={0.720000,0.700000,0.80000,0};
     specularPower=17;
     emmisive[]={0,0,0,0};

  };
};
class CfgVehicles
{
   class All {};
   class AllVehicles: All {};
   class Air: AllVehicles {};
   class Plane: Air {};
   class FWA_Be32K: Plane
   {
      scope=public;
           side=TCivilian;
      displayName="Beriev Be-32K (Nogova)";
      model="\FWA_Be32K\FWA_Be32K";
      
      accuracy=0.30;
      gearRetracting = true;
      nameSound="plane";

      soundEngine[]={"\FWA_Be32K\engine.wav",4,1.2};
      soundEnviron[]={"Objects\noise",db-60,1.0};         // Cessna sound
      soundServo[]={"Vehicles\gun_elevate",db-40,0.4};      // Cessna sound

      maneuvrability=30.0;
      maxSpeed=450;
      armor=50;
      ejectSpeed[]={0,0,0};
      flapsFrictionCoef = 0.5;
      cost=20000;
      
      type=VAir;
      threat[]={0.1, 1, 0.7};


      aileronSensitivity = 0.5; // relative aileron sensitivity
      elevatorSensitivity = 0.5; // relative elevator sensitivity
      noseDownCoef = 0.2; // how much goes nose down during turns

      landingAoa = 7*3.1415/180;
      brakeDistance=500; // vehicle movement precision
      steerAheadSimul=1.0;
      steerAheadPlan=2.0;
      hiddenSelections[]={"light"};

      transportSoldier = 16;
      crew = "Civilian2";
      driverAction=ManActCessnaPilot;
      cargoAction[]={ManActCessnaCoPilot,ManActCessnaCargo};
   
      extCameraPosition[]={0,3,-20};      // 0,5,-30 is standard Air class

      // Radar stuff
      irTarget=true;
      irScanRange = 2000;
      irScanGround = true;      
      
      // Weapon and ammo
      weapons[]={}; // none
      magazines[]={}; // none              
      animated =1;
      class Animations
      {
         class door
         {
            type ="rotation";
            animPeriod =3;
            selection ="Door";
            axis ="osa Door";
            angle0 =0;
            angle1 =-1.574387;

         };
         class gear
         {
            type ="rotation";
            animPeriod =3;
            selection ="gear";
            axis ="osa gear";
            angle0 =0;
            angle1 =1.574387;

         };
         class ngear
         {
            type ="rotation";
            animPeriod =3;
            selection ="ngear";
            axis ="osa ngear";
            angle0 =0;
            angle1 =1.574387;

         };


      };
      class EventHandlers
      {
            init = "[_this select 0] exec ""\FWA_Be32K\checkgear.sqs""";
   gear="if (_this select 1) then {[_this select 0] exec""\FWA_Be32K\geardown.sqs""} else {[_this select 0] exec ""\FWA_Be32K\gearup.sqs""}";
         };
   
class UserActions
   {

class opendoor
   
{
   displayName="Open Door";
   position="osa Door";
   radius=4;
   condition= "this animationphase ""Door"" < 0.5";
   statement = "[this] exec ""\FWA_Be32K\Rampdown.sqs""";
   };

class closedoor
   {

   displayName="Close Door";
   position="doorarea";
   radius=5;
   condition= "this animationphase ""Door"" > 0.5";
   statement = "[this] exec ""\FWA_Be32K\Rampclose.sqs""";
           };
                 
    };
   };   
   class FWA_Be32KRus: FWA_Be32K
   {
      model="\FWA_Be32K\FWA_Be32K2";
      displayName="Russian Beriev Be-32K";
      side=TEast;
      transportSoldier = 25;
      crew = "SoldierEPilot";
      driverAction=ManActCessnaPilot;
      cargoAction[]={ManActCessnaCoPilot, ManActCargo};
   };

};

(Sorry for the long post)

Can anyone find anything that will fix my problem?

Cataclyzm

  • Guest
Re:Landing Gear Goes Up
« Reply #6 on: 14 Jan 2005, 04:13:24 »
One thing I do notice different about both configs is the fact that they both have scripts that are called in the eventhandler.  there may be something in that, that would answer your problem.  All aircraft I have seen do have scripts that are called.

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #7 on: 15 Jan 2005, 01:55:46 »
Yeah, I just added the scripts not to long ago, hoping they would help the problem, they didn't.  Anyway, here is my script:
Code: [Select]
_plane = _this select 0
_plane animate ["LeftWheel", 1]
_plane animate ["RightWheel", 1]
_plane animate ["NoseWheel", 1]
_plane animate ["LeftStrut", 1]
_plane animate ["RightStrut", 1]
exit

Here is the script for the Beriev:
Code: [Select]
_plane = _this select 0
_plane animate ["gear", 1]
_plane animate ["ngear", 1]
_plane setObjectTexture [0, ""]
exit

Unnamed

  • Guest
Re:Landing Gear Goes Up
« Reply #8 on: 16 Jan 2005, 11:36:47 »
I'm sure it's the code in CheckGear.sqs thats causing the problems.

The Beriev Be-32K:

Code: [Select]
_plane = _this select 0
?(not alive _plane): goto "Exit"
_plane setObjectTexture [0, "\FWA_Be32k\seatbelts2.pac"]
?(speed _plane >100 && isengineon _plane): [_this select 0] exec "\FWA_Be32K\gearup.sqs"

#Exit
exit

Try changing the maximum speed to something above your landing speed and perhaps but a condition to check the altitude.

Code: [Select]
If ((speed _plane >220) And (isengineon _plane) And (((GetPos _Plane) Select 2)>30)) Then {[_this select 0] exec "\FWA_Be32K\gearup.sqs"}

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #9 on: 16 Jan 2005, 15:16:36 »
No, it doesn't work :'(

I don't even think checkgear.sqs is being called!  When I start my plane out flying, the gear stay down, I have to manually put the gear up, which means chechgear.sqs either isn't being called, or it isn't properly calling gearup.sqs

Here is chechgear.sqs:
Code: [Select]
_plane = _this select 0
?(not alive _plane): goto "Exit"
If ((speed _plane >220) And (isengineon _plane) And (((GetPos _Plane) Select 2)>30)) Then {[_this select 0] exec "\Boeing757\gearup.sqs"}

#Exit
exit

Thank you for helping me! :)

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #10 on: 16 Jan 2005, 15:47:28 »
WTF?!

I just followed Sefe's tutorial on custom gear animations in the editors depot.  I modified KEG's Hawk exactly as he did it, and the gear work properly on the Hawk!  They don't go up by themselves!  I followed Sefe's instruction's on my plane, and the gear don't work properly!  What is going on? ???
« Last Edit: 16 Jan 2005, 16:46:26 by Student Pilot »

Unnamed

  • Guest
Re:Landing Gear Goes Up
« Reply #11 on: 16 Jan 2005, 16:51:24 »
Try removing each of the three condition in the If statement, one at a time until you remove the IF statement all together. For example if you have a roadway LOD defined (i.e you can walk around the aircraft) the GetPos command wont work properly. Or just add some hints to see where it's failing or show the results of the three conditions.

Code: [Select]
Hint Format ["Speed %1 Engine %2 Height %3",(speed _plane>220),(isengineon _plane),(((GetPos _Plane) Select 2)>30)]
You should see all three displayed as True.

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #12 on: 16 Jan 2005, 16:59:34 »
Ok, I added the hint.  It said:
Speed False
Engine true
Height true

Why would speed be false, the plane was going over 500?!

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #13 on: 16 Jan 2005, 18:32:39 »
Ok, I think I have fixed the checkgear script.

I added a short delay, and now it seems to work, here it is:
Code: [Select]
_plane = _this select 0
?(not alive _plane): goto "Exit"
~.01
If ((speed _plane >200) And (isengineon _plane)) Then {[_this select 0] exec "\Boeing757\gearup.sqs"}

#Exit
exit

However, the landing gear still don't work properly.  I'm not sure what is wrong at this point, I have adjusted the config and played with selections on the 3d model, to no avail.

Unnamed

  • Guest
Re:Landing Gear Goes Up
« Reply #14 on: 16 Jan 2005, 18:55:21 »
Cant help you there, I've never set custom landing gear up from scratch. I've just messed around with other peoples aircraft. Have you checked out some of the other aircraft like Hawks C130 and C5 Galaxy, to see if they do anything different?
« Last Edit: 16 Jan 2005, 18:55:45 by Unnamed »

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #15 on: 16 Jan 2005, 19:08:57 »
I've looked at the Bereiv, RKT Skyraider, and the Antonov 124.  All three have custom landing gear, but the Antonov does the same thing as my aircraft.  I will download the C130 or the C5 Galaxy (depending on which file is smaller, we're still on dial-up in this part of Indiana) ::)

Thanks for your continued help!

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #16 on: 17 Jan 2005, 20:44:12 »
Ok, I have discovered two more things..
1)It appears, that when I have the landing autopilot turned on, the gear work properly.

2)The gear also go up by themselves when the AI use the plane

Don't know if this means anything, just thought I would mention it.


EDIT
After a little experimenting, I confirmed #1:
When the landing autopilot is on, the gear behave properly, when it's off, they don't
« Last Edit: 17 Jan 2005, 20:52:00 by Student Pilot »

FW200

  • Guest
Re:Landing Gear Goes Up
« Reply #17 on: 19 Jan 2005, 23:30:35 »
If you still need help, drop me a message  ;)

Don't mind the crappy Be-32K though  ;D

Offline Pilot

  • Contributing Member
  • **
Re:Landing Gear Goes Up
« Reply #18 on: 08 Feb 2005, 01:02:38 »
Ok, it's working now! :D  I turned out to be a problem with the memory lod.  I had two axis for the landing gear struts way above the aircraft.  Operation Flashpoint does not like this, and it screwed up my plane.  I moved the memory points close to the plane, and now the landing gear work great!  Many thanks to Footmunch for his help! :thumbsup:

Topic Solved!