Jump to content

Photo
- - - - -

set back the animation value by script


  • Please log in to reply
7 replies to this topic
Thread Starter
drunken officer
drunken officer

    Sergeant

  • Members
  • 186 posts

  • Joined: 10-July 2011

Posted 05 February 2012 - 10:16 #1

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

Thread Starter
drunken officer
drunken officer

    Sergeant

  • Members
  • 186 posts

  • Joined: 10-July 2011

Posted 14 February 2012 - 10:55 #2

no one knows the answer :(

rocket
rocket

    BI Developer

  • 648 posts

  • Joined: 11-June 2007

Posted 16 February 2012 - 17:06 #3

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.
"He will come to death. An image of the splendor of the kings of men in glory, undimmed before the breaking of the world."

Sealife
Sealife

    Banned

  • 1362 posts

  • Joined: 26-August 2011

Posted 16 February 2012 - 18:06 #4

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

Thread Starter
drunken officer
drunken officer

    Sergeant

  • Members
  • 186 posts

  • Joined: 10-July 2011

Posted 19 February 2012 - 10:06 #5

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.

rocket
rocket

    BI Developer

  • 648 posts

  • Joined: 11-June 2007

Posted 20 February 2012 - 08:27 #6

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.
"He will come to death. An image of the splendor of the kings of men in glory, undimmed before the breaking of the world."

Thread Starter
drunken officer
drunken officer

    Sergeant

  • Members
  • 186 posts

  • Joined: 10-July 2011

Posted 23 February 2012 - 16:16 #7

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]; 

};


rocket
rocket

    BI Developer

  • 648 posts

  • Joined: 11-June 2007

Posted 07 March 2012 - 16:15 #8

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.
"He will come to death. An image of the splendor of the kings of men in glory, undimmed before the breaking of the world."