Results 1 to 8 of 8

  Click here to go to the first Developer post in this thread.  

Thread: set back the animation value by script

  1. #1

    set back the animation value by script

    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.

    Code:
    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

  2. #2
    Sergeant
    Join Date
    Jul 10 2011
    Location
    Germany / SN
    Posts
    154
    Author of the Thread
    no one knows the answer

  3.   Click here to go to the next Developer post in this thread.   #3
    BI Developer
    Join Date
    Jun 11 2007
    Location
    Brno, Czech Republic
    Posts
    648
    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."

  4. #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

  5. #5
    Sergeant
    Join Date
    Jul 10 2011
    Location
    Germany / SN
    Posts
    154
    Author of the Thread
    Quote Originally Posted by Rocket View Post
    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.

  6.   Click here to go to the next Developer post in this thread.   #6
    BI Developer
    Join Date
    Jun 11 2007
    Location
    Brno, Czech Republic
    Posts
    648
    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.

  7. #7
    Sergeant
    Join Date
    Jul 10 2011
    Location
    Germany / SN
    Posts
    154
    Author of the Thread
    Code:
    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]; 
    };

  8.   This is the last Developer post in this thread.   #8
    BI Developer
    Join Date
    Jun 11 2007
    Location
    Brno, Czech Republic
    Posts
    648
    Do you have script errors on?

    Code:
    private ["_blah","_animVal","","_bl"];
    Should throw an error regarding global variable in local namespace, or something similar, as you have "" in the private definitions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •