Sign in to follow this  
Followers 0
drunken officer

set back the animation value by script

8 posts in this topic

Hi guys.

I try to create a bluelight, which is turn around all the time, when the player start it. It should stop the roation, when the player stop it.

After a lot of hours, i know, that i've to use a script for that. SourceAddress="loop"; is not working with source="user";. I tryed it with source="time"; the loop works.

So far.

Now i want to write a script. My target is to start the animation and if the animation value = 1, then set back the animation to 0.1. Not to 0, because i've a sound with this rotation.

But to set back the value to 0.1 is not working in my script. There i need help.

if (isDedicated) exitWith {};
private ["_blah","_bommel"];
_blah = _this select 0;
_bommel = _blah animationPhase 'bluelight';
hintSilent "script start"; //test 
while {true} do {
if (_bommel == 1) then {_blah set [animationPhase 'bluelight', 0.1];};
sleep 0.1;
};

Thx

Share this post


Link to post
Share on other sites

Hi there,

Try adding 0.1 (or +1 for a full sequence) to the animation phase. As you have set it as a looping animation, it will continue to process the animation with higher values. For best results you would want to also reset the value at set intervals to stop the animation value becoming to large.

_animVal = 0;

...

_animVal = _animVal + 0.1;

_blah set [animationPhase 'bluelight',_animVal];

Does this help? Let me know if any problems.

Share this post


Link to post
Share on other sites

use your time loop again use second or whichever suits and instead of giving the use an action to stop start the light , give them the action to hide it( obviosuly call it lights on off still)

in other words add another animation to the model of type hide and then hide unhide using Useraction ?

hope it helps

Share this post


Link to post
Share on other sites
Hi there,

Try adding 0.1 (or +1 for a full sequence) to the animation phase. As you have set it as a looping animation, it will continue to process the animation with higher values. For best results you would want to also reset the value at set intervals to stop the animation value becoming to large.

Does this help? Let me know if any problems.

It's not working. One turn, thats all :(

At the first, i choose the way like Thromp and work around with hiddenselections. But this should not be the end of it.

Share this post


Link to post
Share on other sites

Are you adding the value every revolution? In your original code, you are just setting it initially to 1 (one animation). You need to continually set the animation to a higher value per the code I pasted above.

Share this post


Link to post
Share on other sites
if (isDedicated) exitWith {};
private ["_blah","_animVal","","_bl"];
_animVal = 0;
while {true} do
{
_blah = _this select 0;
_bl = _blah animationPhase 'bluelight';
waitUntil {_blah animationPhase 'blaulicht' > 0 };
player sideChat format["%1",_bl];
... lightpoint.... // code for lightpoint
_animVal = _animVal + 0.1;
_blah set [animationPhase 'bluelight',_animVal]; 
};

Share this post


Link to post
Share on other sites

Do you have script errors on?

private ["_blah","_animVal",[b]""[/b],"_bl"];

Should throw an error regarding global variable in local namespace, or something similar, as you have "" in the private definitions.

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  
Followers 0