Jump to content

Recommended Posts


I am trying to enable grain effect in loop. When loop start, grain effect is ok, but then in next loop iteration it stop. I want to repeat effect until "_effect == 0" (change back to normal)

 



private ["_unit"];
params ["_unit"];

[_unit] spawn 
{
    private ["_unit", "_effect", "_ppEffectGrain", "_ppEffectColor"];
    params ["_unit"];

    _ppEffectGrain = ppEffectCreate ["filmGrain", 2001];
    _ppEffectGrain ppEffectEnable true;

    _ppEffectColor = ppEffectCreate ["ColorCorrections", 1501];
    _ppEffectColor ppEffectEnable true;

    while {true} do 
    {
        _effect = _unit getVariable ["effect", 0]; //1,2,3,4,5

//do stuff here

        if(isPlayer _unit) then
        {

          //enable effect
            if(_effect > 3) then 
            {
                _ppEffectGrain ppEffectAdjust [1.0, 2.0, 7.0, 0.0, 0.0, true];
                _ppEffectGrain ppEffectCommit 1; // effect is not repeating

                _ppEffectColor ppEffectAdjust [0.9, 1.2, 0, [0.5,0.5,0.5,0],[0.5,0.5,0.5,0],[0.5,0.5,0.5,0]];
                _ppEffectColor ppEffectCommit 0.5; // effect is not repeating enable/disable
            };


            //disable effect
            if(_effect == 0) then 
            {
                _ppEffectGrain ppEffectAdjust [0.1, 1.5, 1.7, 0.2, 1.0, true]; //default
                _ppEffectGrain ppEffectCommit 1;

                _ppEffectColor ppEffectAdjust [1.0, 1.0, 0.0, [0.0,0.0,0.0,0],[1.0,1.0,1.0,1.0],[0.299,0.587,0.114,0]]; //default
                _ppEffectColor ppEffectCommit 1;
            };

        };

        sleep 1;
    };

};


Share this post


Link to post
Share on other sites

I had huge troubles handling effects that have been created separately despite having unique priorities.

Try the alternate syntax and see if it persists:

_ppEffects = ppEffectCreate [["filmGrain", 2001],["ColorCorrections", 1501]];
_ppEffects params ["_ppEffectGrain ","_ppEffectColor "]

Share this post


Link to post
Share on other sites

Why not use waitUntil ?

 

There is other stuff in loop, just not relevant to example. In this example there will be usefull, but needed it with loop every second. Thank you for pointing that out.

Share this post


Link to post
Share on other sites

 

I had huge troubles handling effects that have been created separately despite having unique priorities.

Try the alternate syntax and see if it persists:

_ppEffects = ppEffectCreate [["filmGrain", 2001],["ColorCorrections", 1501]];
_ppEffects params ["_ppEffectGrain ","_ppEffectColor "]

 

No change in behaviour. Still collorCorrection changed but grain stoped.

Share this post


Link to post
Share on other sites

Weird indeed, it only works at the first time it's >= 4

If you set it to 0, wait for the iteration to happen, than change it back to >=4 I can swear there's film grain happening, but not very prominent.

No clue here.

 

Cheers

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

×