Jump to content
Sign in to follow this  
blackpixxel

Play custom animation via *.sqf-file

Recommended Posts

Hi,

I made an *.rtm - Animation in Oxygen for a pump-action shotgun. This animation should be played after every shot.

The animation itself works. I could set it to be the reload animation for the weapon and then it was played every time I was reloading the gun.

But for the pump-action I need the animation to be played every time a shot is fired. So I made a little init.sqf-file with the following content:

player addEventHandler ["fired", "hint 'shot_fired'"];
player addEventHandler ["fired", "playGesture 'PumpActionStand'"];

The file works. the hint apears after every shot, but it does not play the animation/gesture.

Here is the part of the config that defines the animation:

class CfgMovesBasic
{
class DefaultDie;
class ManActions
{
	BoltActionAnim_stand = "BoltActionAnim_stand";
};
class Actions
{
	class RifleBaseStandActions;
	class NoActions: ManActions
	{
		BoltActionAnim_stand[] = {"PumpActionStand","Gesture"};
	};
};
};
class CfgGesturesMale
{
class Default;
class RifleReloadProneBase;
class States
{
	class PumpActionStand: Default
	{
		file = "\tb_arifle_hkump45\anim\Handanim_hkump45_pump.rtm";
		looped = 0;
		speed = .24;
		mask = "handsWeapon";
		headBobStrength = 0;
		headBobMode = 0;
		canPullTrigger = 1;
		rightHandIKBeg = 1;
		rightHandIKEnd = 1;
		leftHandIKCurve[] = {0,1,0.05,0,0.95,0,1,1};
	};
};
};

So I wish to know what I have to do to achieve my goal - my knowledge about config/scripting is exactly zero, so I would appreciate every help.

Thank you!

Share this post


Link to post
Share on other sites

Use something like this:

player addEventHandler ["fired", "_this execvm 'shotgunpump.sqf'"];  

shotgunpump.sqf

private ["_unit","_weapon","_muzzle","_type","_sh"];
_unit = _this select 0;
_weapon = _this select 1;
_muzzle = _this select 2;
_type = _this select 4;
_sh = _this select 6;
_needReload = (_unit ammo _weapon !=0);


if((_needReload) && (_weapon == "my_shotgun"))then{sleep 0.3; _unit playAction "BoltActionAnim_stand";};

You want to use playaction rather than the gesture

Edited by Kerc Kasha

Share this post


Link to post
Share on other sites

Thank you for your reply.

Sadly it doesn't work.

The name 'BoldActionAnim_stand' is not the name of a default animation. It is a custom one. So I would say that Arma does not know where it should finde the Animation. Maybe I have to define it somewhere else?

Share this post


Link to post
Share on other sites

It should work.. I used something like this and it worked without issue:

class CfgMovesBasic
{
class DefaultDie;
class ManActions
{

	PumpActionStand = "PumpActionStand";

};
class Actions
{
	class NoActions: ManActions
	{
		PumpActionStand[] = {"PumpActionStand","Gesture"};
       };
   };
};

EDIT: Maybe the class names need to be the same

Share this post


Link to post
Share on other sites

Now it is working fine. Now I am using an init.sqf to initialize the fired event and the additional PumpAction.sqf .

Thanks alot for your fast help!

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  

×