Jump to content
Sign in to follow this  
Yuval

Simple animation with progressbar and handling

Recommended Posts

I am currently working on a mission. I added an action to a prop which I want players to "interact with" in order to trigger an event I scripted. How can I make the players interact with it using the action, play an animation with a progress bar of lets say 10 seconds until the "interaction" is done and then if they are still alive, trigger the event?

Share this post


Link to post
Share on other sites

Hi i wrote the side mission where i use addaction to interact

Its look like that

	[[joker,"<t color='#ff9900'>REPAIR</t>",{
			private ["_mechanicj"];
			_mechanicj = _this select 1;
			_mechanicj playMove "AinvPknlMstpSnonWnonDnon_medic_1";
			sleep 5;
			joker setDamage 0;
			joker setFuel 1;
	},nil,6,false,true,"","(_target distance _this) < 5 AND getDammage joker != 0"],"INS_fnc_addactionMP",false,false] spawn BIS_fnc_MP;

Hope it helps

Share this post


Link to post
Share on other sites

Hi i wrote the side mission where i use addaction to interact

Its look like that

	[[joker,"<t color='#ff9900'>REPAIR</t>",{
			private ["_mechanicj"];
			_mechanicj = _this select 1;
			_mechanicj playMove "AinvPknlMstpSnonWnonDnon_medic_1";
			sleep 5;
			joker setDamage 0;
			joker setFuel 1;
	},nil,6,false,true,"","(_target distance _this) < 5 AND getDammage joker != 0"],"INS_fnc_addactionMP",false,false] spawn BIS_fnc_MP;

Hope it helps

It is very very critical for me to know whether the animation succeeded (done properly) or failed (cancelled or player died before it finished). I am using a variable that says whether the prop is being interacted so only 1 player could interact with it at once. Also I want the animation to be done successfully so the players will have to take consequences incase they haven't cleared the area properly.

Share this post


Link to post
Share on other sites

This is a snippet from something I wrote, I'll post the rest if you want.
Hopefully this might help.

_startTime = time; // Start Time
_totalTime = time + _actionTime; // Expected finish time
_Animation = "ANIMATIONHERE"; // Animation

waitUntil {

     _progressBar progressSetPosition ((time - _startTime)/_actionTime); // Sets the progress position of the progress bar. _progressBar is the progress bar control. 
	 
     if (animationState player != _Animation ) then {
          player switchMove _Animation ;
          player playMoveNow _Animation;
     };

     (!alive player) || (time >= _totalTime) // if player is dead or passed end time, exit
};

if (!alive player) then {
	hint "Action Aborted";
	_progressBar progressSetPosition 0;
} else {
	hint "Animation/action Completed";
};

You might need to add functionality to check whether or not the action is interrupted. 

Share this post


Link to post
Share on other sites

This is a snippet from something I wrote, I'll post the rest if you want.

Hopefully this might help.

_startTime = time; // Start Time
_totalTime = time + _actionTime; // Expected finish time
_Animation = "ANIMATIONHERE"; // Animation

waitUntil {

     _progressBar progressSetPosition ((time - _startTime)/_actionTime); // Sets the progress position of the progress bar. _progressBar is the progress bar control. 
	 
     if (animationState player != _Animation ) then {
          player switchMove _Animation ;
          player playMoveNow _Animation;
     };

     (!alive player) || (time >= _totalTime) // if player is dead or passed end time, exit
};

if (!alive player) then {
	hint "Action Aborted";
	_progressBar progressSetPosition 0;
} else {
	hint "Animation/action Completed";
};

You might need to add functionality to check whether or not the action is interrupted. 

Seems very nice! Can you post the rest since I don't exactly understand what to do with _actionTime. Do I need to set it myself or is there anything that generates it?

Share this post


Link to post
Share on other sites

I was too lazy to type, so I made you a TEST MISSION instead; can't guarantee it'll be perfect!

 

Check the files for information. The actual progress Bar script is in the '\Functions' Folder!

  • Like 3

Share this post


Link to post
Share on other sites

I was too lazy to type, so I made you a TEST MISSION instead; can't guarantee it'll be perfect!

 

Check the files for information. The actual progress Bar script is in the '\Functions' Folder!

Working fucking great! Thanks man I love you

Share this post


Link to post
Share on other sites

Working fucking great! Thanks man I love you

Swearing is not allowed on these forums.

  • Like 1

Share this post


Link to post
Share on other sites

Swearing is not allowed on these forums.

Yes it is, damn it!

Within reason, of course.

  • Like 1

Share this post


Link to post
Share on other sites

Swearing is not allowed on these forums.

You've made my day :D

  • Like 1

Share this post


Link to post
Share on other sites

Swearing is not allowed on these forums.

 

Bullshit, he can say what he wants.  As long as he's not calling someone a wanker or a fucking cunt then it's ok.

 

It would be silly to have some sort of "naughty language filter" given that the game is full of humans murdering other humans and swearing liberally while they're doing it.

  • Like 1

Share this post


Link to post
Share on other sites

Bullshit, he can say what he wants.  As long as he's not calling someone a wanker or a fucking cunt then it's ok.

 

It would be silly to have some sort of "naughty language filter" given that the game is full of humans murdering other humans and swearing liberally while they're doing it.

 

There is actually kids that have signed up on this forum, you know.  :P (Hate to call out names, but there has been a lot of them since the maintenance)

 

 

But in any case, I noticed that they have removed that rule since the maintenance, so I guess its fine to swear now.

 

MURICA

FUCK

 YEAH

Share this post


Link to post
Share on other sites

7 posts on topic and 9 posts off topic. lol just move this to general discussion and change it to discussion about swearing.

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  

×