Jump to content
Sgt. Epic

Can't see door's user action in game

Recommended Posts

So i've been trying to make an interactable door for my basic house. that is what i got so far:

I have made couple of doors, made memory points that include axis and action point, as you can see in the picture:

http://prntscr.com/nae4q3

I seen quite a few tutorials and followed the sample files, and that is the code I used for the doors:

CONFIG.CPP:

class CfgPatches
{
    class A3_MyAddon
    {
        units[]=
        {
            "MySoldier"
        };
        weapons[]=
        {
            "MyUniform", "MyVest", "MyHeadgear"
        };
        requiredVersion=0.1;
        requiredAddons[]={"A3_Characters_F"};
    };
};
class CfgVehicles
{
	class House;
	class isoc_house_01 : House
	{
		scope = 2;
		model = "isrproject_houses\objects\isoc_house_01.p3d";
		placement = vertical;
		mapSize = 20;
		displayName = "Shoval's House";
		
		cost = 0;
		armor = 5000;
	};
		class UserActions
		{
			class OpenDoor_01
			{
				displayName = "Open Door"; // Label of the action used in the action menu itself.
				position = door_01_action; // Point in Memory lod in p3d around which the action is available.
				priority = 0.4; // Priority coefficient used for sorting action in the action menu.
				radius = 1.5; // Range around the above defined point in which you need to be to access the action.
				onlyForPlayer = false; // Defines if the action is available only to players or AI as well.
				condition = ((this animationPhase 'Door_1_rot') < 0.5); // Condition for showing the action in action menu. In this case it checks if the door is closed and if the part of the house in which the door is located hasn't been destroyed yet).
				statement = ([this, 'Door_01_rot'] call BIS_fnc_DoorNoHandleOpen); // Action taken when this action is selected in the action menu. In this case it calls a function that opens the door.
			};
			class CloseDoor_01: OpenDoor_01
			{
				displayName = "Close Door";
				priority = 0.2;
				condition = ((this animationPhase 'door_01_rot') >= 0.5); // Checks if the door is currently open and not destroyed.
				statement = ([this, 'door_01_rot'] call BIS_fnc_DoorNoHandleClose);
			};
			class OpenDoor_02: OpenDoor_01
			{
				position = door_02_action;
				condition = ((this animationPhase 'door_02_rot') < 0.5);
				statement = ([this, 'door_2_rot'] call BIS_fnc_DoorNoHandleOpen);
			};
			class CloseDoor_02: CloseDoor_01
			{
				position = door_2_action;
				condition = ((this animationPhase 'door_02_rot') < 0.5);
				statement = ([this, 'door_02_rot'] call BIS_fnc_DoorNoHandleClose);
			};
			class OpenDoor_03: OpenDoor_01
			{
				position = door_02_action;
				condition = ((this animationPhase 'door_02_rot') < 0.5);
				statement = ([this, 'door_2_rot'] call BIS_fnc_DoorNoHandleOpen);
			};
			class CloseDoor_03: CloseDoor_01
			{
				position = door_03_action;
				condition = ((this animationPhase 'door_03_rot') < 0.5);
				statement = ([this, 'door_03_rot'] call BIS_fnc_DoorNoHandleClose);
			};			
		};
		actionBegin1 = OpenDoor_01;
		actionEnd1 = OpenDoor_01;
		actionBegin2 = OpenDoor_02;
		actionEnd2 = OpenDoor_02;
		actionBegin3 = OpenDoor_03;
		actionEnd3 = OpenDoor_03;
		numberOfDoors = 3;
		
		class AnimationSources
		{
			// Animation sources for doors
			class Door_1_source
			{
		 		source = user; // "user" = custom source = not controlled by some engine value
				initPhase = 0; // Initial value of animations based on this source
				animPeriod = 1; // Coefficient for duration of change of this animation
				sound = "GenericDoorsSound"; /// Selects sound class from CfgAnimationSourceSounds that is going to be used for sounds of doors
			};
			class Door_2_source: Door_1_source {};
			class Door_3_source: Door_1_source {};
		};
};

MODEL.CFG:

class CfgSkeletons
{
	class Default
	{
		isDiscrete = 1;
		skeletonInherit = "";
		skeletonBones[] = {};
	};

	// Skeleton of undamaged variant of the house, containing doors and windows. Note that glass #3 is not a window but the glass pane of glass door (door #1). Therefore
	// (similar to door handles) it's bones need to be appropriately linked to bones of the door so that it moves along with it when the door is opened/closed.
	class isoc_house_01_Skeleton: Default
	{
		skeletonInherit = "Default";
		skeletonBones[] =
		{
			// Pairs: 1st is newly defined bone, second is it`s "parent" in the skeleton (bone hierarchy).
			"Door_1",				"",
			"Door_2",				"",
			"Door_2",				""			
		};
	};
};
class CfgModels
{
	class Default
	{
		sectionsInherit = "";
		sections[] = {};
		skeletonName = "";
	};
	class Animations
	{
		// Animation for rotating door #1 (without a door handle)
		class Door_01_rot
		{
			type			= rotation;
			source			= Door_01_source; // Controler defined in class AnimationSources in config.cpp.
			selection		= Door_01; // Selection from p3d that also has to be defined as a bone in this model`s skeleton.
			axis			= Door_01_axis; // Axis of the rotation.
			memory			= 1;
			minValue		= 0; // Value of the controller at which the rotation will be angle0
			maxValue		= 1; // Value of the controller at which the rotation will be angle1
			angle0			= 0;
			angle1			= (rad 110); // "rad" converts from degrees to radians
		};
		class Door_02_rot: Door_01_rot
		{
			source			= Door_02_source;
			selection		= Door_02;
			axis			= Door_02_axis;
		};
		class Door_03_rot: Door_01_rot
		{
			source			= Door_03_source;
			selection		= Door_03;
			axis			= Door_03_axis;
		};
	};
};

I know I used one extra }; in the model.cfg file, because if I don't use it, the mikero's pboProject can't pack my file and gives the next error:

 9:56:09: Extensions:
"</texheaders>" 
rapify x64UnicodeVersion 1.79, Dll 7.16 "config.cpp"
<rebuilding units[]= and friends>
No Error(s)
Output is to p:\temp\isrproject_houses\config.bin

P:\temp\isrproject_houses\config.bin
1 File(s) copied
rapify x64UnicodeVersion 1.79, Dll 7.16 "model.cfg"
In File \isrproject_houses\model.cfg: circa Line 59 EOF encountered

rerun with -noisy option to see decode

"model.cfgs for this pbo have errors" 

the doors exist in game and look good, but I can't interact with them at all. any guesses as to what's wrong?

 

 

Share this post


Link to post
Share on other sites

Try this

pastebin.com/HDxZpwVp

 

also note in the main config if you want the model to animate when binarized to a terrain you must add Land_ to the front of the class name

 

and if the doors open in the opposite direction flip the angle values...so move angle0 to angle1 and visa versa 

Share this post


Link to post
Share on other sites
3 hours ago, m1lkm8n said:

Try this

pastebin.com/HDxZpwVp

 

also note in the main config if you want the model to animate when binarized to a terrain you must add Land_ to the front of the class name

 

and if the doors open in the opposite direction flip the angle values...so move angle0 to angle1 and visa versa 

 

So i've been looking for a difference between the code you gave me and the one I had, and I figured out the I missed a } at the end(I edited the code I gave in the thread above).

The problem I have NOW is that when I open up the editor in game, it says this:

http://prntscr.com/nalj6a

Share this post


Link to post
Share on other sites

Your main config is a little messy. I can't do it now because I'm mobile but if no one has responded later today I will sent an updated config 

Share this post


Link to post
Share on other sites

Ok so after some help at the discord channel i've made this:

Model.cfg:

https://pastebin.com/uV7zjgj8

Config.cpp:

https://pastebin.com/LrpawpH6

 

the code looks much better, and now I think I understand it more clearly, I see the doors' user actions now, but still it doesn't seem to animate the door in game.

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

×