Jump to content
Sign in to follow this  
FW200

Trying to animate a door through an eventhandler

Recommended Posts

I'm working (for old times sake) on a plane, on which I have 2 doors and a ladder. I want the plane to be locked when the doors are closed and when the doors are opened the plane to be unlocked.

However I can't even seem to get the Open door thing to work..

My addon knowledge stems from the Operation Flashpoint era, and so do these scripts.. so any help would be nice :)

So this is what I have:

CONFIG.CPP:

	class AnimationSources 
	{
		class leftdoor		
		{
			source = "user"; 
			animPeriod = 2;  
			initPhase=0;
		};	
		class rightdoor		
		{
			source = "user"; 
			animPeriod = 2; 
			initPhase=0;
		};
		class ladder		
		{
			source = "user"; 
			animPeriod = 2; 
			initPhase=0;
		};	

	};

	class UserActions 
	{
		class FWA_AN14DOORSOPEN
		{
			displayName = "Open Door";		
			position = "door";			
			radius = 5;
			onlyForPlayer = 0;
			condition = "this animationPhase ""leftdoor"" < 0.5";
			statement = "this exec ""\FWA_AN14\opendoor.sqf""";
		};

		class FWA_AN14DOORSCLOSE 
		{
			displayName = "Close Door";
			position = "door";
			radius = 5;
			onlyForPlayer = 0;
			condition = "this animationPhase ""leftdoor"" > 0.5";
			statement = "this exec ""\FWA_AN14\closedoor.sqf""";
		};
     		  };
              };            

The doors and ladder have been defined in the model.cfg and do actually work in Buldozer.

Opendoor.sqf:

_plane = _this select 0

_plane animate ["leftdoor", 1];
_plane animate ["rightdoor", 1];

sleep 0.5;

_plane animate ["ladder", 1];
exit

closedoor.sqf is pretty much the same except in reverse..

Share this post


Link to post
Share on other sites

Change exec to execVM (you are using sqf sintax)

Change the script for this one:

_plane = _this;

_plane animate ["leftdoor", 1];

_plane animate ["rightdoor", 1];

sleep 0.5;

_plane animate ["ladder", 1];

profit

The main problem its that you were passing the object as it was( this exec ....) and then on the script you used it as it was an array ( _this select 0).

Edited by columdrum

Share this post


Link to post
Share on other sites

Yay that was it :) Thanks a lot! Do you also happen to know how I could lock the plane ?

---------- Post added at 20:02 ---------- Previous post was at 19:44 ----------

Never mind, got that going too :)

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  

×