Jump to content
Sign in to follow this  
mike44

sliding door or a building

Recommended Posts

Hi All,

I'm pretty new to this and need some help making a sliding door on a building. The building has 8 regular rotating doors which I have working fine, but I can't get the sliding one to work. Can someone tell me what I need to do to my conifigs to get it to work? The door has a named selection barndoor in 1.0 LOD, Geometry LOD and Memory LOD. Also in memory LOD is barndoor_axis and barndoor_ap. My configs are pasted below. Thanks for your help!

model.cfg

class CfgSkeletons											// Delare super class.
{
class Default;											// Declare the parent class to inherit from on the next line .
class barndoor_slide : Default							// Add a new classname and specify a parent class to inherit from.
{
	skeletonInherit = "Default";							// Repeat the parent class from above, inherit the parent class skeleton.
	skeletonBones[] =									// Define new bones here.
	{
		"barndoor",""									// New bone, pattern is "child","parent",
	};
};
};

class CfgModels
{
class Building_9D;
class dos_UB_Bldg_25and26: Building_9D {};  //place your .p3D model name (without extension) in place of bia_watertank
{
	skeletonName="barndoor_slide";						// Which skeleton to use, as defined in the super class CfgSkeletons. 
	class Animations									// Define new animations within this class.
	{
		class barndoor_open								// The class name of the animation.
		{
			type="translation";
			source="barndoor_open";						//animation type translation -- it uses the distance/vector between two memory points
			selection="barndoor";			//named selection in model, and bone in skeleton
			axis="barndoor_axis";			//two memory points in memory LOD, the distance between should match the desired translation distance
			memory=1;							//look in the memory LOD for the axis points, should always be 1
			minValue="0";							//this animation starts when the source is at 0
			maxValue="1";							//this animation ends when the source is at 1
			offset0=0;							//this animation starts relative to the position of the first memory point
			offset1=1;							//this animation ends relative to the position of the second memory point (if the mem points are 1m apart, the animation moves 1m)
		};
	};
};
};

--------------------------------------------------------------

config.cpp

//always include the defines common to all configs at the top of the file
#include "\vbs2\customer\defines.hpp"

//--------------------------------------------------------------------

//always change this to be the path (without drive) to the directory you are working in!
#define __CurrentDir__ \vbs2\customer\structures\dos_hohenfels\dos_UB_Bldg_25and26

//put the name of the folder you are working in here (no path, just foldername)
FOLDER_NAME(dos_UB_Bldg_25and26);

//--------------------------------------------------------------------

//tell simulation we are creating categories for the listing of objects in the editor
class CfgVehicleClasses
{
class Terrasim                           //this classname is used below
{
	displayname = "Hohenfels";             //display name for this category that shows up in editor
};
};

//--------------------------------------------------------------------

class VBS2_Ruins_Generic; //this declares a class that already exists in VBS2 and we will use it below for Destruction Effects

//tells the simulation we are configuring objects/vehicles/people
class CfgVehicles
{
class Building_9D_AP_Closed;                                    //replace 3D with the number of doors in the building!
class BUILD_NAME(dos_UB_Bldg_25and26) : Building_9D_AP_Closed  //replace 3D. Also place the name of your .p3D model (without extension) inside the parethesis next to BUILD_NAME!
{
	scope =        public;                            //makes this class available in the simulator
	DisplayName =  "dos_UB_Bldg_25and26";       //displayed name of building in editor
	vehicleClass = TerraSIM;              //name of editor class this object resides in, created in CfgVehicleClasses
	model =        __CurrentDir__\dos_UB_Bldg_25and26; //replace last part with the name of your .p3D model
	armor =        500;                               //how much damage the building can take before being destroyed; it is not in any specific units, and is also influenced by the size of the model
	destrType =    DestructBuilding;                  //what happens when this structure is destroyed; see bottom of config for options
	ladders[]=                                        //list the pairs of starting/ending memory points for ladders in this structure
	{
		//{"start1","end1"}//,                          //use a comma to separate each pair
		//{"start2","end2"},
		//{"start4","end4"}                           //(commented out examples of more ladders)
	};

	class AnimationSources						// Declares an animation source.
	{
		class barndoor_open 	 					// This classname must match the name defined in the "source" parameter, located in the aniamtion definitions of the model.cfg
		{
		animPeriod = 5;							// Duration in time when animated in game.
		};							
	};

	class UserActions															// Within this class are contained the definitions for the ingame side action menu options, avaliable to a player to use an animations.
	{
		class Openbarndoor															// User defined classname.
		{
			displayNameDefault = $STR_ACTIONS_VBS2_Barndoor_OPEN;					
			displayName        = $STR_ACTIONS_VBS2_Barndoor_OPEN;					// The text that appears in the side action menu.
			position           = barndoor_ap;								// The named selection of the memory point in the memory lod of the model, which defines the position the player needs to be near for the side action menu to be come avaliable.
			radius             = 4;												// The minimum distance the player needs to be from the memory point for option to become avaliable in the side action menu.
			onlyForPlayer      = true;											// Can AI subordinates be ordered to use this animation, if yes then use the "false" parameter.

			// Condition is the code used to detirmined if the option to use this animation should be avaliable.
			// The animation classname from the model.cfg needs to be defined here, in this case "reardoor_right_anim".
			// The next parameter states that if the animation phase is "less than to 0.5" then the option to open the doors will be avaliable. 0 = closed, 1 = open.				
			condition          = "this animationPhase ""gate_open"" < 0.5";
			statement          = "this animate [""gate_open"", 1]";				// Once the condition is met this is what will happen.
		};

		class Closebarndoor
		{
			displayNameDefault = $STR_ACTIONS_VBS2_Barndoor_CLOSE;
			displayName        = $STR_ACTIONS_VBS2_Barndoor_CLOSE;
			position           = barndoor_ap;
			radius             = 4;
			onlyForPlayer      = true;
			condition          = "this animationPhase ""gate_open"" >= 0.5";
			statement          = "this animate [""gate_open"", 0]";
		};
	};
};


	class DestructionEffects: VBS2_Ruins_Generic {};
	=	"\vbs2\plugins\IWV\Data\close_door.paa";

};
};

//--------------------------------------------------------------------

/*

Possible values for destrType:

DestructNo - no visual destruction effect

DestructBuilding - object sinks into the ground and ruins remain; class destructioneffects must also be configured

DestructEngine - object explodes

DestructTree - object falls over; pivoting around the Z axis

DestructTent - object folds inwards on itself

*/

Edited by mike44
made the code show between code tags

Share this post


Link to post
Share on other sites

It looks like you are working in VBS2 not ArmA2. You might have more success over on the BISim forums - https://forums.bisimulations.com

If you are trying to get it working in ArmA2 - then the fact you are inheriting from the VBS base classes that dont exist in ArmA2 isnt going to help.

Share this post


Link to post
Share on other sites

I am working with VBS2 but I can't get any to help over there so I thought I would try over here

Share this post


Link to post
Share on other sites
class barndoor_open >>>>>>>// The class name of the animation.

{

your animating wrong class in cpp i think

statement = "this animate [""gate_open"", 1]";

try change all your gate_open reference in config.cpp to barndoor_open

or vice versal to Model,cfg, i think also you may need to define sources but as other say, with VBS2 you pay so much for support i think with license so this is really a place for Game Only advice :) or way me ask for a Pay Pal Button ;)

Share this post


Link to post
Share on other sites

You have to animate the bone, not the class name.

Bone = barndoor as defined in the cfgSkeletons

Classname = barndoor_open will do nothing Nor will animating an animation source. eg "source="barndoor_open";"

So the correct statement in your user action would be:

statement = "this animate [""barndoor"", 1]";

Share this post


Link to post
Share on other sites

thanks guys! I'll give that a shot and let you know how it turns out.

Share this post


Link to post
Share on other sites

I tried making those changes and its still not working. If anyone has any ideas please let me know, I really need to get this figured out.

model.cfg

class CfgSkeletons // Delare super class.

{

class Default; // Declare the parent class to inherit from on the next line .

class barndoor_slide : Default // Add a new classname and specify a parent class to inherit from.

{

skeletonInherit = "Default"; // Repeat the parent class from above, inherit the parent class skeleton.

skeletonBones[] = // Define new bones here.

{

"main_elev","" // New bone, pattern is "child","parent",

};

};

};

class CfgModels

{

class Building_8D_AP_Closed;

class dos_UB_Bldg_25and26: Building_8D_AP_Closed {}; //place your .p3D model name (without extension) in place of bia_watertank

skeletonName="barndoor_slide"; // Which skeleton to use, as defined in the super class CfgSkeletons.

class Animations // Define new animations within this class.

{

class barndoor_go // The class name of the animation.

{

type="translation";

source="barndoor_go"; //animation type translation -- it uses the distance/vector between two memory points

selection="barndoor"; //named selection in model, and bone in skeleton

axis="barndoor_axis"; //two memory points in memory LOD, the distance between should match the desired translation distance

memory="true"; //look in the memory LOD for the axis points, should always be 1

minValue="0"; //this animation starts when the source is at 0

maxValue="1"; //this animation ends when the source is at 1

offset0=0; //this animation starts relative to the position of the first memory point

offset1=1; //this animation ends relative to the position of the second memory point (if the mem points are 1m apart, the animation moves 1m)

};

};

};

};

-------------------------------------

config.cpp

//always include the defines common to all configs at the top of the file

#include "\vbs2\customer\defines.hpp"

//--------------------------------------------------------------------

//always change this to be the path (without drive) to the directory you are working in!

#define __CurrentDir__ \vbs2\customer\structures\dos_hohenfels\dos_UB_Bldg_25and26

//put the name of the folder you are working in here (no path, just foldername)

FOLDER_NAME(dos_UB_Bldg_25and26);

//--------------------------------------------------------------------

//tell simulation we are creating categories for the listing of objects in the editor

class CfgVehicleClasses

{

class TerraSIM //this classname is used below

{

displayname = "Hohenfels"; //display name for this category that shows up in editor

};

};

//--------------------------------------------------------------------

class VBS2_Ruins_Generic; //this declares a class that already exists in VBS2 and we will use it below for Destruction Effects

//tells the simulation we are configuring objects/vehicles/people

class CfgVehicles

{

class Building_8D_AP_Closed; //replace 3D with the number of doors in the building!

class BUILD_NAME(dos_UB_Bldg_25and26) : Building_8D_AP_Closed //replace 3D. Also place the name of your .p3D model (without extension) inside the parethesis next to BUILD_NAME!

{

scope = public; //makes this class available in the simulator

DisplayName = "dos_UB_Bldg_25and26"; //displayed name of building in editor

vehicleClass = TerraSIM; //name of editor class this object resides in, created in CfgVehicleClasses

model = __CurrentDir__\dos_UB_Bldg_25and26; //replace last part with the name of your .p3D model

armor = 500; //how much damage the building can take before being destroyed; it is not in any specific units, and is also influenced by the size of the model

destrType = DestructBuilding; //what happens when this structure is destroyed; see bottom of config for options

ladders[]= //list the pairs of starting/ending memory points for ladders in this structure

{

//{"start1","end1"}//, //use a comma to separate each pair

//{"start2","end2"},

//{"start4","end4"} //(commented out examples of more ladders)

};

class AnimationSources // Declares an animation source.

{

class barndoor_go // This classname must match the name defined in the "source" parameter, located in the aniamtion definitions of the model.cfg

{

source = "user";

animPeriod = 5; // Duration in time when animated in game.

};

};

class UserActions // Within this class are contained the definitions for the ingame side action menu options, avaliable to a player to use an animations.

{

class Openbarndoor // User defined classname.

{

displayName = "Open Barn Door"; // The text that appears in the side action menu. position = barndoor_ap; // The named selection of the memory point in the memory lod of the model, which defines the position the player needs to be near for the side action menu to be come avaliable.

position = "barndoor_ap";

radius = 4; // The minimum distance the player needs to be from the memory point for option to become avaliable in the side action menu.

onlyForPlayer = false; // Can AI subordinates be ordered to use this animation, if yes then use the "false" parameter.

// Condition is the code used to detirmined if the option to use this animation should be avaliable.

// The animation classname from the model.cfg needs to be defined here, in this case "reardoor_right_anim".

// The next parameter states that if the animation phase is "less than to 0.5" then the option to open the doors will be avaliable. 0 = closed, 1 = open.

condition = "this animationPhase ""barndoor_go"" == 0";

statement = "this animate [""barndoor_go"", 1]"; // Once the condition is met this is what will happen.

};

class Closebarndoor: Openbarndoor

{

displayName = "Close Barn Door";

position = "barndoor_ap";

radius = 4;

onlyForPlayer = false;

condition = "this animationPhase ""barndoor_go"" == 1";

statement = "this animate [""barndoor_go"", 1]";

};

};

};

};

//--------------------------------------------------------------------

/*

Possible values for destrType:

DestructNo - no visual destruction effect

DestructBuilding - object sinks into the ground and ruins remain; class destructioneffects must also be configured

DestructEngine - object explodes

DestructTree - object falls over; pivoting around the Z axis

DestructTent - object folds inwards on itself

*/

Share this post


Link to post
Share on other sites

Use this forums PHP tag for posting code.

model.cfg

Closed your class early.

class dos_UB_Bldg_25and26: Building_8D_AP_Closed {};

Correct

class dos_UB_Bldg_25and26: Building_8D_AP_Closed {

Config.cpp

Both actions are animating "1"

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×