Home   Help Search Login Register  

Author Topic: Basic destruction in A2  (Read 2357 times)

0 Members and 1 Guest are viewing this topic.

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Basic destruction in A2
« on: 22 Jul 2009, 18:54:36 »
 i have started to take a look at the destruction sysytem in arma2 , with the intention of working with mikebart and his buildings.
 i thought i would share my findings thus far incase anybody else would like to join me in my exploration, its been a lonely ride since ofp so i hope we can all share are feelings findings here and travel the road together.

 here is a basic config and model cfg for a very basic test model i made that was simply 4 cubes .
cfg.cpp
Code: [Select]
#define private 0
#define protected 1
#define public 2

#define true 1
#define false 0

class CfgPatches {
class dbo_shed {
units[] = {"Land_dbo_shed"};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {"CAData", "CABuildings", "CABuildings2"};
};
};

class CfgVehicles {
class HouseBase; // External class reference

class House : HouseBase {
class DestructionEffects; // External class reference
};
class Ruins; // External class reference

class Land_dbo_shed : House {
scope = 2;
armor = 1;
model = "\dbo_shed\dbo_shed";
vehicleclass ="objects";
displayname ="dbo_shed";
class DestructionEffects : DestructionEffects {
class Ruin1 {
simulation = "ruin";
type = "Land_dbo_shed_ruins";
position = "";
intensity = 1;
interval = 1;
lifeTime = 1;
};
};

class HitPoints {
class Hit1 {
armor = 0.025;
material = -1;
name = "dam 1";
visual = "damT1";
passThrough = false;
convexComponent = "dam 1";

class DestructionEffects {
class Dust {
simulation = "particles";
type = "HousePartDust";
position = "";
intensity = .01;
interval = 1;
lifeTime = 0.01;
};

class Dust2 : Dust {
type = "HousePartDustLong";
};

class Walls : Dust {
type = "HousePartWall";
};
};
};

class Hit2 {
armor = 0.025;
material = -1;
name = "dam 2";
visual = "damT2";
passThrough = false;
convexComponent = "dam 2";

class DestructionEffects {
class Dust {
simulation = "particles";
type = "HousePartDust";
position = "";
intensity = .01;
interval = 1;
lifeTime = 0.01;
};

class Dust2 : Dust {
type = "HousePartDustLong";
};

class Walls : Dust {
type = "HousePartWall";
};
};
};

class Hit3 {
armor = 0.025;
material = -1;
name = "dam 3";
visual = "damT3";
passThrough = false;
convexComponent = "dam 3";

class DestructionEffects {
class Dust {
simulation = "particles";
type = "HousePartDust";
position = "";
intensity = .01;
interval = 1;
lifeTime = 0.01;
};

class Dust2 : Dust {
type = "HousePartDustLong";
};

class Walls : Dust {
type = "HousePartWall";
};
};
};

class Hit4 {
armor = 0.025;
material = -1;
name = "dam 4";
visual = "damT4";
passThrough = false;
convexComponent = "dam 4";

class DestructionEffects {
class Dust {
simulation = "particles";
type = "HousePartDust";
position = "";
intensity = .01;
interval = 1;
lifeTime = 0.01;
};

class Dust2 : Dust {
type = "HousePartDustLong";
};

class Walls : Dust {
type = "HousePartWall";
};
};
};


};
class AnimationSources {
class Hit1 {
source = "Hit";
hitpoint = "Hit1";
raw = 1;
};

class Hit2 : Hit1 {
hitpoint = "Hit2";
};

class Hit3 : Hit1 {
hitpoint = "Hit3";
};

class Hit4 : Hit1 {
hitpoint = "Hit4";
};
};

class Land_dbo_shed_ruins : Ruins {
scope = protected;
vehicleClass = "Ruins";
model = "\dbo_shed\dbo_shed_ruins";
};


};
};

model.cfg

Code: [Select]
class cfgSkeletons
{
 class default;
 class dbo_shed : default
 {
  SkeletonBones[]=
  {
   "dam 1","",
   "dam 2","",
   "dam 3","",
   "dam 4",""


 };
};
};


class CfgModels
{
 class Default;
 class dbo_shed:default
 {
  
   sections[]=
   {
"dam 1",
   "dam 2","dam 3","dam 4"
   };
skeletonName="dbo_shed";
   class Animations
   {
    class Hit1
    {
     type=hide;
     selection="dam 1";
     source=Damage;
     minValue = 0;
     maxValue = 1;
     minPhase = 0;
     maxPhase = 1;
     SourceAddress = 0;
     hideValue = 0.1000000;
    };
    
    class Hit2
    {
     type=hide;
     selection="dam 2";
     source=damage;
 minValue = 0;
     maxValue = 1;
     minPhase = 0;
     maxPhase = 1;
     SourceAddress = 0;
     hideValue = 0.2000000;
    };
  
    class Hit3
    {
     type=hide;
     selection="dam 3";
     source=damage;
     minValue = 0;
     maxValue = 1;
     minPhase = 0;
     maxPhase = 1;
     SourceAddress = 0;
     hideValue =.300000;
    };
    
  
    class Hit4
    {
     type=hide;
     selection="dam 4";
     source=damage;
     minValue = 0;
     maxValue = 1;
     minPhase = 0;
     maxPhase = 1;
     SourceAddress = 0;
     hideValue = .400000;
    };

  };
 };
};
The effects in the cpp for destruction are very small to alter the damage feect it has on surrunding things alter the
intensity = .01;
this version is a test to see how bis hides sections of a Hitpoint and or a full building with several stages of destruction.

 hideValue = .400000; // this decides which part will dissapear by value of the number in the sequence.
 so if you had a full building with 4 stages of destruction , then your full building would be
 hideValue = .100000;

youe first stage destruction
 hideValue = .200000;

and so on until finally a ruin or not depending on what you want the final stage to be ,strategic for gameplay.
  you can also micro define this system so that hitpoints themselves can have multiple stages . i will post more on that when i find more out.
 the above is not definitive or gospel but it does work and is workable.
 If anyone has anything to add please do so it would be nice to try and start some dev here if we can.
 Edit
 In addition there is also  mybuilding setHit [part, damage] or["Hit1",1] in this case , maybe this is for continuation for campaigns and stuff but its a handy thing for creating alot of different areas with just a few buildings, . i e you can have fully blown up toens partial or a mixture of both.
 ty
DB
« Last Edit: 22 Jul 2009, 20:22:14 by DeanosBeano »
I love ofp

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: Basic destruction in A2
« Reply #1 on: 22 Jul 2009, 20:25:13 »
Thanks for sharing DB  :good:
Forwarded it to a couple of people.