Home   Help Search Login Register  

Author Topic: config.cpp and model.cfg  (Read 5246 times)

0 Members and 1 Guest are viewing this topic.

Offline MikePhoeniX

  • Members
  • *
config.cpp and model.cfg
« on: 20 May 2013, 13:35:36 »
Hi im new to creating addons for Arma 2, Iv built a model of a boat and am looking for some template config.cpp and model.cfg files for my boat, anyone have any or know where I could find some?

Offline Gnat

  • Addons Depot
  • Moderator
  • *****
  • I Bite!
    • Gnats
Re: config.cpp and model.cfg
« Reply #1 on: 22 May 2013, 15:11:25 »
Good luck Mike
Quote
class CfgSkeletons
{
   class default
   {
      isDiscrete = 1;
      skeletonInherit = "";
      skeletonBones[] = {};
   };
   class GNT_FSFBones: default
   {
      isDiscrete=1;
      skeletonInherit = "";
      skeletonBones[]=
   {
      "ZL1","",
      "ZL2","",
      "CL1","",
      "CL2",""
   };
    };
};
class CfgModels
{
   class Default
   {
      sectionsInherit="";
      sections[] = {};
      skeletonName = "";
   };
   class allvehicle : Default
   {
      sectionsInherit="";
      sections[] = {};
      skeletonName = "";
   };
   class Ship : allvehicle
          {
              sectionsInherit="";
              sections[] = {"otocvez","otochlaven","radar","kompas","fuel","hodinova","minutova","mph","rpm","rpm2","main1turret","main1gun"};
              skeletonName = "";
          };
   class GNTFSF : Ship
   {
      skeletonName = "GNT_FSFBones";
      sectionsInherit = "Ship";
      sections[] = {"ZL1","ZL2","CL1","CL2","skin"};
      class Animations
      {
         class ZL1
         {
            type="rotation";
            initPhase=0;
            source = "FUser1";
            animPeriod=0.1;
            sourceAddress = "clamp";
            selection="ZL1";
            axis="axis_swt";
            minValue = 0;
            maxValue = 1;
            angle0=0;
            angle1="rad -70";
         };
         class ZL2
         {
            type="rotation";
            initPhase=0;
            source = "FUser2";
            animPeriod=0.1;
            sourceAddress = "clamp";
            selection="ZL2";
            axis="axis_swt";
            minValue = 0;
            maxValue = 1;
            angle0=0;
            angle1="rad -70";
         };
         class CL1
         {
            type="rotation";
            initPhase=0;
            source = "FUser3";
            animPeriod=0.1;
            sourceAddress = "clamp";
            selection="CL1";
            axis="axis_swt";
            minValue = 0;
            maxValue = 1;
            angle0=0;
            angle1="rad -70";
         };
         class CL2
         {
            type="rotation";
            initPhase=0;
            source = "FUser4";
            animPeriod=0.1;
            sourceAddress = "clamp";
            selection="CL2";
            axis="axis_swt";
            minValue = 0;
            maxValue = 1;
            angle0=0;
            angle1="rad -70";
         };
         
      };
      
   };

};

Quote
// -----------------------------------------------
// Gnat's FSF for ArmAII
// March 2010
// (c) p3d models and code
// permission required before using code or models
// Not for commercial or military use
// See readme for more detail
// -----------------------------------------------


#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

// type scope
#define private 0
#define protected 1
#define public 2

#define WeaponNoSlot 0// dummy weapons
#define WeaponSlotPrimary 1// primary weapons
#define WeaponSlotSecondary 16// secondary weapons
#define WeaponSlotItem 256// items
#define WeaponSlotBinocular 4096// binocular
#define WeaponHardMounted 65536


#define CanSeeRadar 1
#define CanSeeRye 2
#define CanSeeOptics 4
#define CanSeeEar 8
#define CanSeeCompass 16
#define CanSeeAll 31


class CfgPatches
{
   class GNTFSF
        {
         units[] = {GNTFSF,FSF_Ladder};
         weapons[] = {};
         requiredAddons[] = {};      
        };

};

class CfgCloudlets
{   
   class Default;
   class RightWater1;   // External class reference
   class LeftWater1;
   class LeftEng1;   // External class reference
   class RightEng1;
   class GNTRWaterFrig1FSF  : RightWater1 {
      position[] = {"positionX - 8.5","positionY","positionZ + 31.6" };
   };

   class GNTLWaterFrig1FSF  : LeftWater1 {
      position[] = {"positionX + 8.5","positionY","positionZ + 31.6" };
   };
   class GNTLeftEng1FSF  : LeftEng1 {
      lifeTime = 5.500000;
      moveVelocity[] = {"speedX","speedY + 2","speedZ" };
      position[] = {"positionX - 8.5","positionY","positionZ - 31" };
      positionVar[] = {0,0,0 };
      MoveVelocityVar[] = {0.500000,1,0.500000 };
      weight = 1.450000;      
   };
   class GNTRightEng1FSF  : RightEng1 {
      lifeTime = 5.500000;
      moveVelocity[] = {"speedX","speedY + 2","speedZ" };
      position[] = {"positionX + 8.5","positionY","positionZ - 31" };
      positionVar[] = {0,0,0 };
      MoveVelocityVar[] = {0.500000,1,0.500000 };
      weight = 1.450000;      
   };   
};
class GNTREngEffects1FSF  {

   class GNTRightEng  {
      simulation = "particles";
      type = "GNTRightEng1FSF";
   };
};

class GNTLEngEffects1FSF  {

   class GNTLeftEng  {
      simulation = "particles";
      type = "GNTLeftEng1FSF";
   };
};

class GNTRWaterFSF1Effects  {

   class GNTRightWater  {
      simulation = "particles";
      type = "GNTRWaterFrig1FSF";
   };
};

class GNTLWaterFSF1Effects  {

   class GNTLeftWater {
      simulation = "particles";
      type = "GNTLWaterFrig1FSF";
   };
};
   
class CfgAmmo
{   
};

class CfgMagazines
{
};

class cfgWeapons
{
};

class CfgVehicles
{
   class Ship;
   class StaticShip;
   class Land_ladder_half;
   class FSF_Ladder : Land_ladder_half
   {
      scope = 2;
      displayName = "Ladder (FSF)";
      model = "\GNT_FSF\ladder_h.p3d";
      mapSize = 0.01;
      icon = "";
      armor = 150;
      ladders[] =
      {
         {
            "start",
            "end"
         }
      };
      vehicleClass = "Misc";
   };   
   class GNTFSF: Ship
   {
      scope=public;
      displayName="FSF SeaFighter";
      crew = "USMC_Soldier_Pilot";
      faction = "USMC";
      side=TWest;
      picture="\GNT_FSF\FSFPic.paa";
      icon="\GNT_FSF\FSFIcon.paa";
      hiddenSelections[] = {"skin"};
      hiddenSelectionsTextures[] = {"\gnt_fsf\afs_s2.paa"};
      mapSize=60;
//      hiddenselections[] ={"num1","num2","zodx1","zodx2","zodx3","zodx4","zodx5","zodx6","zodx7","zodx8"};

      model="\GNT_FSF\GNTFSF.p3d";

//      accuracy=0.50;
      unloadInCombat = false;
      leftWaterEffect = "GNTLWaterFSF1Effects";
      rightWaterEffect = "GNTRWaterFSF1Effects";
      leftEngineEffect = "GNTLEngEffects1FSF";
      rightEngineEffect = "GNTREngEffects1FSF";
      armorHull=1;
      armorTurret=0.800000;
      armorGun=0.600000;
      armorEngine=0.800000;
      armorLights=0.400000;
      armorTracks=0.600000;

      weapons[]={};
      magazines[]={};
      castDriverShadow = 0;
      castCargoShadow = 0;
      castGunnerShadow = 0;

      hasdriver = true;
      hasCommander = 0;
      hasGunner=0;
      driverisCommander=1;
      gunneriscommander = 0;
      getInRadius=80;
      driverCanSee = 31+32;
      gunnerCanSee = 2+4+8+16+1;
      memoryPointDriverOptics[] =
      {
         "driverview",
         "pilot"
      };
      memoryPointsGetInDriver = "pos driver";
      memoryPointsGetInDriverDir = "pos driver dir";

      hideWeaponsGunner=true;
      hideWeaponsCommander=true;
      hideWeaponsDriver = true;
      hideWeaponsCargo = true;
      hideProxyInCombat = false;
      ejectDeadGunner=1;
      ejectDeadDriver=1;
      ejectDeadCargo=0;
      
      insideSoundCoef = 0.3;
      soundEngineOnInt[] = {"ca\sounds\vehicles\water\rhib\ext-boat-start-01",0.1,1.0};
      soundEngineOnExt[] = {"ca\sounds\vehicles\water\rhib\ext-boat-start-01",1.0,0.8,100};
      soundEngineOffInt[] = {"ca\sounds\vehicles\water\rhib\ext-boat-stop-01",0.1,1.0};
      soundEngineOffExt[] = {"ca\sounds\vehicles\water\rhib\ext-boat-stop-01",1.0,0.8,100};
      class Sounds
      {
       class Engine
       {
          sound[] = {"ca\sounds\vehicles\water\rhib\ext-boat-engine-low-01",1.0,0.9,300};
         frequency = "(randomizer*0.05+0.95)*rpm";
         volume = "engineOn*(rpm factor[0.5, 0.1])";
       };
       class EngineHighOut
       {
         sound[] = {"ca\sounds\vehicles\water\rhib\ext-boat-engine-high-01",1.0,0.8,300};
         frequency = "(randomizer*0.05+0.95)*rpm";
         volume = "engineOn*(rpm factor[0.4, 1.3])";
       };
       class IdleOut
       {
         sound[] = {"ca\sounds\vehicles\water\rhib\ext-boat-engine-idle-03",0.562341,1.0,150};
         frequency = "1";
         volume = "engineOn*(rpm factor[0.5, 0])";
       };
       class WaternoiseOutW0
       {
         sound[] = {"ca\sounds\vehicles\water\water_sfx\ext-water-noise-nospeed",0.398107,1.0,100};
         frequency = "1";
         volume = "(speed factor[7, 0])";
       };
       class WaternoiseOutW1
       {
         sound[] = {"ca\sounds\vehicles\water\water_sfx\ext-boat-lospd-noise-02",0.398107,1.0,100};
         frequency = "1";
         volume = "((speed factor[2, 12]) min (speed factor[12, 2]))";
       };
       class WaternoiseOutW2
       {
         sound[] = {"ca\sounds\vehicles\water\water_sfx\ext-boat-hispd-noise-02",0.398107,1.0,100};
         frequency = "1";
         volume = "(speed factor[9, 18.7])";
       };
      };
      
      irTarget=true;
      irScanRangeMin=500;
      irScanRangeMax=4000;
      irScanToEyeFactor=7;
      irScanGround= false;
//      laserTarget=0;
//      laserScanner=0;
      nightVision = true;
      threat[] = {0.8,1,0.8};
      type = 1;


      secondaryExplosion = -1;
         precision=220;

      brakeDistance = 120;
         steerAheadSimul=6.0;
         steerAheadPlan=3.0;
         predictTurnSimul=1.0;
         predictTurnPlan=1.0;
/*
      brakeDistance = 120;
         steerAheadSimul=6.0;
         steerAheadPlan=3.0;
         predictTurnSimul=1.0;
         predictTurnPlan=1.0;      
*/
//      simulation = "Ship";
//      namesound = "Ship";

      maxSpeed=70;
      fuelCapacity=10000;

      transportSoldier=17;
      typicalCargo[] = {"USMC_Soldier","USMC_Soldier_AT"};
      cargoAction[] = {"searchlight_Gunner","searchlight_Gunner"};
         getInAction="AH1Z_Gunner";
      driverAction = "AH1Z_Gunner";
      gunnerAction = "AH1Z_Gunner";

      class TransportMagazines {};
      
      transportAmmo = 10000;
      accuracy = 1.25;
      transportVehiclesCount = 0;
      enableGPS = 1;

      cost=2000000;
      armor=2500;
      armorStructural=40.0;

      extCameraPosition[] = {0, 8.0, -65.0};      

      animated=1;
      memoryPointCommonDamage = "zamerny";
      memoryPointCameraTarget = "pilot";
      memoryPointcommanderOptics = "pilot";
      commanderOpticsModel = "\ca\wheeled\optika_BRDM";
      
      
      memoryPointMissile[] = {"spicerakety", "ustihlavne2"};
      memoryPointMissileDir[] = {"konecrakety", "konechlavne2"};
//      memoryPointMissile[] = {"spicerakety"};
//      memoryPointMissileDir[] = {"konecrakety"};

//      class Turrets : Turrets {

      class Turrets
      {
      };
      class AnimationSources
      {
         class  FUser1
         {
            source = "user";
            animPeriod = 0.1;
            initPhase=0;
         };
         class  FUser2
         {
            source = "user";
            animPeriod = 0.1;
            initPhase=0;
         };
         class  FUser3
         {
            source = "user";
            animPeriod = 0.1;
            initPhase=0;
         };
         class  FUser4
         {
            source = "user";
            animPeriod = 0.1;
            initPhase=0;
         };
      };
      class UserActions
      {
         class Zodiac2
         {
            displayName="Dock Left";
            position="BBay";
            onlyforplayer=0;
            radius=13;
            condition="(vehicle player isKindOf ""Boat"") and (this animationPhase ""ZL1"" == 0)";
            statement= "this animate [""ZL1"",1];[this, vehicle player] execVM ""\GNT_FSF\scr\FSFZodiacDock1.sqf""";
         };
         class Zodiac3
         {
            displayName="Dock Right";
            position="BBay";
            onlyforplayer=0;
            radius=13;
            condition="(vehicle player isKindOf ""Boat"") and (this animationPhase ""ZL2"" == 0)";
            statement= "this animate [""ZL2"",1];[this, vehicle player] execVM ""\GNT_FSF\scr\FSFZodiacDock2.sqf""";
         };
         class Zodiac4
         {
            displayName="Release Left";
            position="BBay";
            onlyforplayer=0;
            radius=13;
            condition="(this animationPhase ""ZL1"" == 1)";
            statement= "this animate [""ZL1"",0];";
         };
         class Zodiac5
         {
            displayName="Release Right";
            position="BBay";
            onlyforplayer=0;
            radius=13;
            condition="(this animationPhase ""ZL2"" == 1)";
            statement= "this animate [""ZL2"",0];";
         };         
         class LChopper1
         {
            displayName="Lash Chopper";
            position="CBay";
            onlyforplayer=0;
            radius=20;
            condition="(vehicle player isKindOf ""Air"")";
            statement= "[this, vehicle player] execVM ""\GNT_FSF\scr\FSFHeliLand.sqf""";
         };
      };
      
   class EventHandlers
         {
       init = "[_this select 0] execVM ""\GNT_FSF\scr\FSFInit.sqf""; ";
   };

   };
};

class CfgNonAIVehicles
{

};


Offline MikePhoeniX

  • Members
  • *
Re: config.cpp and model.cfg
« Reply #2 on: 23 May 2013, 14:47:04 »
Thank you very much Gnat, I post how I get on with these!!!!

MPX

Offline MikePhoeniX

  • Members
  • *
Re: config.cpp and model.cfg
« Reply #3 on: 06 Jun 2013, 14:50:51 »
Gnat,

Having an issue with my config.cpp wihen trying to add animation. I have a simple door that opens vertically, and when I compile my pbo i get the following error in the log

Quote
File p:\yacht\config.cpp, line 32: /CfgVehicles/Yacht.AnimationSources: Undefined base class 'AnimationSources'
Config : some input after EndOfFile.
Error 3 while parsing
Error in config p:\yacht\config.cpp
w:\C_branch\Poseidon\Arrowhead\El\ParamFile\paramFile.cpp(753) : Class destroyed, but still locked

Just wondered if you could help me spot the error, below are my config.cpp and model.cfg  for refrence.

Quote

Config.cpp

class CfgPatches
{
   class Yacht
   {
      units[] = {Yacht};
      weapons[] = {};
      requiredVersion = 1.0;
   };
};
class CfgAmmo {
};
class CfgVehicles
 {
   class Fishing_Boat; // extend & copy existing definition
   class  Yacht: Fishing_Boat
      {   
         displayName = "Mikes Yacht";
         side = 3;
         mapSize = 60;
         model = "\Yacht\Yacht.p3d";
         extCameraPosition[] = {0,5,-30}; // x y z
         driverAction = "Datsun_Driver";
         faction = "CIV";
         Icon = "\Ca\water2\Data\UI\icon_fishboat_ca.paa";
         ejectDeadCargo = 1;
         ejectDeadDriver = 1;
         hideWeaponsCargo = 1;
         maxSpeed = 25;
         transportSoldier = 7;
         cost = 10000;
         armor = 10;
         damageResistance = 0.003180;
         class AnimationSources:AnimationSources
         {
            class AnimateBackDoor
            {
               source = "user";
               animPeriod = 20;
               initPhase=0;
            };
         class UserActions :UserActions
  {
   class OpenBackDoor// ensure no possibilty of a clash with base names (if any)
   {
    displayName = "Open Back door";
    onlyforplayer = "true";
    position = "ACTION_BackDoor";// THE axis declared in the model
    radius = 8;
    condition = "this animationPhase ""AnimateBackDoor"" == 0)";
    statement="this animate [""AnimateBackDoor"",1];";
   };
    class CloseBackDoorR
   {
    displayName="Close Back Door";
    position="ACTION_BackDoor";
    onlyforplayer=0;
    radius=8;
    condition="(this animationPhase ""AnimateBackDoor"" == 1)";
    statement="this animate [""AnimateBackDoor"",0];";
   };
  };
 };

Quote
Model.cfg

class CfgSkeletons
{
class Fishing_Boat;
class YachtBones: Fishing_Boat
      {
         isDiscrete=1;
         skeletonInherit = "";
         skeletonBones[]=
         {
            "BackDoor","",
         };
      };
};
class CfgModels
{
   class Fishing_Boat;
    class Yacht: Fishing_Boat
   {
      sectionsInherit="";
      skeletonName = "YachtBones";
      sections[] = {};
      class animations
      {
         class AnimateBackDoor
         {
            type="rotation";
            source="UserBackDoor";
            sourceAddress="clamp";
            selection="BackDoor";
            axis="AXIS_BackDoor";
            memory=1;
            angle0="rad 0";
            angle1="rad 90";
            minValue=0.000;
            maxValue=1.000;
         };
         
      };
   };
};


Offline Gnat

  • Addons Depot
  • Moderator
  • *****
  • I Bite!
    • Gnats
Re: config.cpp and model.cfg
« Reply #4 on: 07 Jun 2013, 12:11:50 »
Try

Code: [Select]
...
...
class CfgVehicles
 {
   class Ship;
   class Fishing_Boat: Ship
   {
class AnimationSources;
   };
   class  Yacht: Fishing_Boat
      {   
         displayName = "Mikes Yacht";
...
...

Offline MikePhoeniX

  • Members
  • *
Re: config.cpp and model.cfg
« Reply #5 on: 18 Jun 2013, 11:54:07 »
Thanks Gnat, finally got my animations working thanks for your help, please could you help my with another stumbling block im having!! Iv made my boat so you can walk around on it, the problem is that when im walking around the boat and i look out the window the sea is missing and I can see the sea bed (see pictures below), this does not happen when sitting in the driver seat as the sea is visible. Your help will be much appreciated!

View through window when inside



View when stood outside not looking through window



View from driver seat




Mike
« Last Edit: 18 Jun 2013, 11:55:52 by MikePhoeniX »

Offline Gnat

  • Addons Depot
  • Moderator
  • *****
  • I Bite!
    • Gnats
Re: config.cpp and model.cfg
« Reply #6 on: 23 Jun 2013, 12:08:36 »
Hi
I assume you are looking through a window texture or through some texture.
In O2 you need to select that texture faces in question then;
FACES -> MOVE TOP