Jump to content
JSD

animation not working properly // User action to open fence gate not showing

Recommended Posts

Hi, after learning how to get simple models into arma I wanted to learn how to animate parts of my objects, though I am now running into a problem where the action to open a fence gate (simple model I made to try and learn this) doesn't show up in game.

In the models memory LOD I have:

"Fence_Button" (Place where the button is meant to be, so the action should be here too)

"SlidingFence_axis" (axis for the fence to slide)

my config.cpp

#include "EditorCategories.hpp"class CfgPatches{	class JSD_Fence	{		units[] =		{			"JSD_Fence_01_Gate";		};		weapons[] = {};		requiredVersion = 0.1;		requiredAddons[] = {};	}; // JSD_Fence}; // cfgPatchesclass CfgVehicles{	class Wall;	class JSD_Fence_01_Gate : Wall	{		scope = 2;		model = "\JSD_Fence\JSD_Fence_01_Gate.p3d";		displayName = "JSD Fence 01 Gate";		vehicleClass = "JSD_VehicleClass_Objects";		editorCategory = "JSD_EdCat_Fences";		editorSubcategory = "JSD_EdSubcat_Fences";		class AnimationSources		{			class Fence_Source			{				source = user;				initPhase = 0;				animPeriod = 3;				sound = "";			}; // Fence_Source		}; // AnimationSources		class UserActions		{			class JSD_OpenFence			{				displayNameDefault = "Open Fence";				displayName = "Open Fence";				position = Fence_Button;				priority = 0.4;				radius = 2;				onlyForPlayer = false;				condition = "";				statement = "(this animate [FenceGate_Slide, 1])";			}; // JSD_OpenFence			class JSD_CloseFence: JSD_OpenFence			{			displayName = "Close Fence";			condition = "(this animationPhase 'FenceGate_Slide') = 1)";			statement = "(this animate [FenceGate_Slide, 0])";			}; // JSD_CloseFence		}; // UserActions	}; // JSD_Fence_Gate_01}; // CfgVehicles

and my model.cfg

class CfgSkeletons{  class Default  {    isDiscrete = 1;    skeletonInherit = "";    skeletonBones[] = {};  };  class JSD_Fence_01_Gate_Skeleton: Default  {    skeletonInherit = "Default";    skeletonBones[] =    {      "SlidingFence", "",    };  };};class CfgModels{  class Default  {    sectionsInherit = "";    sections[] = {};    skeletonName = "";  };  class JSD_Fence_01_Gate: Default  {    skeletonName = "JSD_Fence_01_Gate_Skeleton";    sections[] =    {      "",    };    sectionsInherit = "";    class Animations    {      class FenceGate_Slide      {        type = translationY;        source = Fence_Source;        selection = SlidingFence;        axis = "SlidingFence_axis";        memory = 1;        minValue = 0;        maxValue = 1;        offset0 = 0;        offset1 = 5;      };    };  };};

It could be a very stupid simple little thing, but I can't figure it out.

Share this post


Link to post
Share on other sites

Line 48 of config.cpp, add inverted commas around the memory point.

position = "fence_button";

Share this post


Link to post
Share on other sites

Line 48 of config.cpp, add inverted commas around the memory point.

position = "fence_button";

 

Thanks, I changed it but it doesnt fix the problem. Are you certain it has to be this way though? I had done it this way because it's this way in the Arma 3 Samples House: "position = Door_1_trigger;". 

Share this post


Link to post
Share on other sites

This is how the vanilla bar gate looks:

class Land_BarGate_F : Wall_F {
	author = "Bohemia Interactive";
	mapSize = 8.75;
	class SimpleObject {
		animate[] = {
			{
				"Door_1_rot",
				0
			}
		};
		hide[] = {};
		verticalOffset = 0;
	};
	editorPreview = "\A3\EditorPreviews_F\Data\CfgVehicles\Land_BarGate_F.jpg";
	_generalMacro = "Land_BarGate_F";
	scope = 2;
	scopeCurator = 2;
	displayName = "Bar Gate";
	model = "\A3\Structures_F\Walls\BarGate_F.p3d";
	icon = "iconObject_10x1";
	editorSubcategory = "EdSubcat_Military";
	vehicleClass = "Structures_Fences";
	destrType = "DestructWall";
	animated = 1;
	armor = 150;
	cost = 1000;
	numberOfDoors = 1;
	class AnimationSources {
		class Door_1_source {
			source = "user";
			initPhase = 0;
			animPeriod = 1;
			sound = "RoadGateDoors";
			soundPosition = "Door_1_trigger";
		};
	};
	class UserActions {
		class OpenGate_1 {
			displayNameDefault = "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
			displayName = "Open door";
			position = "Bar_1_trigger";
			radius = 3;
			aiMaxRange = 9;
			onlyForPlayer = 0;
			condition = "this animationPhase 'Door_1_rot' < 0.5";
			statement = "this animate ['Door_1_rot', 1]";
		};
		class CloseGate_1 : OpenGate_1 {
			displayNameDefault = "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
			displayName = "Close door";
			condition = "this animationPhase 'Door_1_rot' >= 0.5";
			statement = "this animate ['Door_1_rot', 0]";
		};
	};
	actionBegin1 = "OpenGate_1";
	actionEnd1 = "OpenGate_1";
};

So, maybe try:

1) inheriting from class Wall_F

2) adding this condition to your Open user action:

      condition = "this animationPhase 'FenceGate_Slide' < 0.5";

3) use inverted comma's on your AnimationSources { source = "user"; } line  (may not be required, but safe to copy from BIS)

4) double check the spelling of the 'position' memory point on the model and config matches

Share this post


Link to post
Share on other sites

This is how the vanilla bar gate looks:

 

So, maybe try:

1) inheriting from class Wall_F

2) adding this condition to your Open user action:

      condition = "this animationPhase 'FenceGate_Slide' < 0.5";

3) use inverted comma's on your AnimationSources { source = "user"; } line  (may not be required, but safe to copy from BIS)

4) double check the spelling of the 'position' memory point on the model and config matches

 

Thanks a lot, I'm going to have to try this in two days as I can't tomorrow. It should work when I put the condition to true right? I just want the animation to show first, I'll then mess with the condition once I know how the first part of works.

Share this post


Link to post
Share on other sites

This is how the vanilla bar gate looks:

 

 

So, maybe try:

1) inheriting from class Wall_F

2) adding this condition to your Open user action:

      condition = "this animationPhase 'FenceGate_Slide' < 0.5";

3) use inverted comma's on your AnimationSources { source = "user"; } line  (may not be required, but safe to copy from BIS)

4) double check the spelling of the 'position' memory point on the model and config matches

 

So I tried this (and some other things) but it still doesn't work. Could it be a problem with my p3d?

 

Screenshot of my memory LOD in Object Builder, just in case it'd be visible from that.

 

In the meantime i've also added a door as the model looked stupid without it but I'm having the same problem with that. When I test the animations in either blender or in game they do work, but the action just does not show. I'll put the config.cpp and model.cfg I have now down here again. 

 

Config.cpp

#include "EditorCategories.hpp"

class CfgPatches
{
	class JSD_Fence
	{
		units[] =
		{
			"JSD_Fence_01_Gate",
			"JSD_Fence_01_2m",
			"JSD_Fence_01_4m",
			"JSD_Fence_01_Pillar",
		};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] =
		{
			"A3_Structures_F",
		};
	}; // JSD_Fence
}; // cfgPatches



class CfgVehicles
{
	class Wall_F;
	class JSD_Fence_01_4m: Wall_F
	{
		scope = 2;
		scopeCurator = 2;
		author = "JSD";
		model = "\JSD_Fence\JSD_Fence_01_4m.p3d";
		displayName = "JSD Fence 01 4m";
		vehicleClass = "JSD_VehicleClass_Objects";
		editorCategory = "JSD_EdCat_Fences";
		editorSubcategory = "JSD_EdSubcat_Fences";
	}; // JSD_Fence_01_4m
	class JSD_Fence_01_2m: JSD_Fence_01_4m
	{
		model = "\JSD_Fence\JSD_Fence_01_2m.p3d";
		displayName = "JSD Fence 01 2m";
	}; // JSD_Fence_01_2m
	class JSD_Fence_01_Pillar: JSD_Fence_01_4m
	{
		model = "\JSD_Fence\JSD_Fence_01_pillar.p3d";
		displayName = "JSD Fence 01 pillar";
	};
	class JSD_Fence_01_Gate : JSD_Fence_01_4m
	{
		editorPreview = "";
		model = "\JSD_Fence\JSD_Fence_01_Gate.p3d";
		displayName = "JSD Fence 01 Gate";
		animated = 1;
		numberOfDoors = 1;

		class AnimationSources
		{
			class SlidingFence_Source
			{
				source = "user";
				initPhase = 0;
				animPeriod = 2;
			}; // SlidingFence_Source

			class FenceDoor_Source
			{
				source = "User";
				initPhase = 0;
				animPeriod = 2;
			}; // FenceDoor_Source
		}; // AnimationSources

		class UserActions
		{

			class OpenGate_1
			{
				displayNameDefault="<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
				displayName="Open Gate";
				position = "SlidingFence_trigger";
				radius=3;
				aiMaxRange=9;
				onlyForPlayer=0;
				condition="true";
				statement="this animate [""FenceGate_Slide"", 1];";
			};
			class CloseGate_1: OpenGate_1
			{
				displayNameDefault="<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
				displayName="Close Gate";
				condition="this animationPhase 'FenceGate_Slide' >= 0.5";
				statement="this animate ['FenceGate_Slide', 0]";
			};

			class OpenFenceDoor_1
			{
				displayName = "Open Door";
				position = "FenceDoor_trigger";
				radius = 2;
				onlyForPlayer = 0;
				condition = true;
				statement = "this animate ['FenceDoor_Rotate',1]";
			};
			class CloseFenceDoor_1: OpenFenceDoor_1
			{
				displayName = "Close Door";
				statement = "this animate ['FenceDoor_Rotate',0]"
			};
		}; // UserActions
	}; // JSD_Fence_Gate_01
}; // CfgVehicles
 

 

Model.cfg

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

  class JSD_Fence_01_Gate_Skeleton: Default
  {
    skeletonInherit = "Default";
    skeletonBones[] =
    {
      "SlidingFence", "",
      "FenceDoor", "",
    };
  };
};

class TranslationZ;
class Rotate;
class CfgModels
{
  class Default
  {
    sectionsInherit = "";
    sections[] = {};
    skeletonName = "";
  };
  class JSD_Fence_01_Gate: Default
  {
    skeletonName = "JSD_Fence_01_Gate_Skeleton";
    sections[] =
    {
      "",
    };
    sectionsInherit = "";
    class Animations
    {

      class FenceGate_Slide
      {
        type = translationZ;
        source = Fence_Source;
        selection = SlidingFence;
        //axis = "SlidingFence_axis";
        memory = 0;
        minValue = 0;
        maxValue = 1;
        animPeriod = 0;
        offset0 = 0;
        offset1 = -100;
      };

      class FenceDoor_Rotate: Rotate
      {
        type = rotation;
        source = FenceDoor_Source;
        selection = FenceDoor;
        axis = FenceDoor_axis;
        memory = 1;
        minValue = 0;
        maxValue = 1;
        animPeriod = 0;
        angle0 = 0;
        angle1 = -(rad 90);
      };
    };
  };
};
 

Share this post


Link to post
Share on other sites

Right after posting that I started to do the Geometry LOD, and after completing that the actions do show. I am confused but it works now (:. Thanks for your help apollo 

 

http://imgur.com/lMCuPaHwhoo!

Share this post


Link to post
Share on other sites

Right so that all works, but I can't do the animation properly. I want the fence to slide smoothly but when I use it in game it kind of jumps to the place where it needs to go. I've tried changing all the animPeriod things, but that did not change much. It confuses me because the model has a door too, and that works fine but the fence does not. 

 

current Config.cpp

#include "EditorCategories.hpp"

class CfgPatches
{
	class JSD_Fence
	{
		units[] =
		{
			"JSD_Fence_01_Gate",
			"JSD_Fence_01_2m",
			"JSD_Fence_01_4m",
			"JSD_Fence_01_Pillar"
		};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] =
		{
			"A3_Structures_F"
		};
	}; // JSD_Fence
}; // cfgPatches



class CfgVehicles
{
	class Wall_F;
	class JSD_Fence_01_4m: Wall_F
	{
		scope = 2;
		scopeCurator = 2;
		destrType = "DestructNo";
		author = "JSD";
		model = "\JSD_Fence\JSD_Fence_01_4m.p3d";
		displayName = "JSD Fence 01 4m";
		vehicleClass = "JSD_VehicleClass_Objects";
		editorCategory = "JSD_EdCat_Fences";
		editorSubcategory = "JSD_EdSubcat_Fences";
	}; // JSD_Fence_01_4m
	class JSD_Fence_01_2m: JSD_Fence_01_4m
	{
		model = "\JSD_Fence\JSD_Fence_01_2m.p3d";
		displayName = "JSD Fence 01 2m";
	}; // JSD_Fence_01_2m
	class JSD_Fence_01_Pillar: JSD_Fence_01_4m
	{
		model = "\JSD_Fence\JSD_Fence_01_pillar.p3d";
		displayName = "JSD Fence 01 pillar";
	};
	class JSD_Fence_01_Gate : JSD_Fence_01_4m
	{
		editorPreview = "";
		model = "\JSD_Fence\JSD_Fence_01_Gate.p3d";
		displayName = "JSD Fence 01 Gate";
		animated = 1;

		class AnimationSources
		{
			class SlidingFence_Source
			{
				source = "User";
				initPhase = 0;
				animPeriod = 2;
			}; // SlidingFence_Source

			class FenceDoor_Source
			{
				source = "User";
				initPhase = 0;
				animPeriod = 2;
			}; // FenceDoor_Source
		}; // AnimationSources

		class UserActions
		{
			class OpenGate_1
			{
				displayNameDefault="<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
				displayName="Open Gate";
				position = "SlidingFence_trigger";
				radius=3;
				aiMaxRange=9;
				onlyForPlayer=0;
				condition="this animationPhase 'FenceGate_Slide' < 0.5";
				statement="this animate [""FenceGate_Slide"", 1];";
			};
			class CloseGate_1: OpenGate_1
			{
				displayNameDefault="<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
				displayName="Close Gate";
				condition="this animationPhase 'FenceGate_Slide' >= 0.5";
				statement="this animate ['FenceGate_Slide', 0]";
			};
			class OpenFenceDoor_1
			{
				displayName = "Open Door";
				position = "FenceDoor_trigger";
				radius = 2;
				onlyForPlayer = 0;
				condition = "this animationPhase 'FenceDoor_Rotate' < 0.5";
				statement = "this animate ['FenceDoor_Rotate',1]";
			};
			class CloseFenceDoor_1: OpenFenceDoor_1
			{
				displayName = "Close Door";
				condition = "this animationPhase 'FenceDoor_Rotate' >= 0.5";
				statement = "this animate ['FenceDoor_Rotate',0]";
			};
		}; // UserActions
	}; // JSD_Fence_Gate_01
}; // CfgVehicles
 

 

 

current Model.cfg

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

  class JSD_Fence_01_Gate_Skeleton: Default
  {
    skeletonInherit = "Default";
    skeletonBones[] =
    {
      "SlidingFence", "",
      "FenceDoor", ""
    };
  };
};

class Translation;
class Rotate;
class CfgModels
{
  class Default
  {
    sectionsInherit = "";
    sections[] = {};
    skeletonName = "";
  };
  class JSD_Fence_01_Gate: Default
  {
    skeletonName = "JSD_Fence_01_Gate_Skeleton";
    sections[] =
    {
      "",
    };
    sectionsInherit = "";
    class Animations
    {

      class FenceGate_Slide: Translation
      {
        type = translation;
        source = Fence_Source;
        selection = SlidingFence;
        axis = SlidingFence_axis;
        memory = 0;
        minValue = 0;
        maxValue = 1;
        animPeriod = 2;
        offset0 = 0;
        offset1 = -1;
      };

      class FenceDoor_Rotate: Rotate
      {
        type = rotation;
        source = FenceDoor_Source;
        selection = FenceDoor;
        axis = FenceDoor_axis;
        memory = 1;
        minValue = 0;
        maxValue = 1;
        animPeriod = 0;
        angle0 = 0;
        angle1 = -(rad 90);
      };
    };
  };
};
 

 

is anyone able to tell me what causes this and how to fix this?

Share this post


Link to post
Share on other sites

Try this in model.cfg 42-54:

 

class FenceGate_Slide {
        type = "translation";
        source = "Fence_Source";
        selection = "SlidingFence";
        axis = "SlidingFence_axis";
        memory = 1;
        minValue = 0;
        maxValue = 1;
        animPeriod = 2;
        offset0 = 0;
        offset1 = -1;
};

Share this post


Link to post
Share on other sites

 

Try this in model.cfg 42-54:

 

 

I had already tried that, but put it back to the way it is now because that's how it works with the door. 

 

The way I worded my problem feels a bit weird so here's a little GIF which shows what I mean:

VjplwbS.gifv

imgur wont work for some reason, but I uploaded it to google drive: 

https://drive.google.com/open?id=0ByvOOeCeZTt6d1FDOEZvNHZRQ1k

Share this post


Link to post
Share on other sites

Are you SURE you tried all of it?

Especially memory = 1;

yeah, I tried again when you posted that though just to be sure but it didn't work. 

Share this post


Link to post
Share on other sites

There is a spelling mistake in your source class in model.cfg line 45?

 

source = Fence_Source;

 

should be:

source = "SlidingFence_Source";

Share this post


Link to post
Share on other sites

 

There is a spelling mistake in your source class in model.cfg line 45?

source = Fence_Source;

should be:

source = "SlidingFence_Source";

oh god I missed that completely, thanks. there is some problem with steam for me and arma wont start at all so I'm going to have to test it later.

Share this post


Link to post
Share on other sites

 

There is a spelling mistake in your source class in model.cfg line 45?

 

oh my god that was it, I would have gone insane before realising that xd. Thanks so much dude.

Share this post


Link to post
Share on other sites

You're welcome.

I guess every modder has done a similar thing at some point!

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

×