Jump to content
Sign in to follow this  
Fux911

Slowmotion Question

Recommended Posts

Hello Guys !

I have a lil problem with my scripting...

Well I want to make a slowmotion script with this example:

When a unit gets killed the time should be set to 0.200 after 3 seconds or so it should go back to normal time. I tried If - then - else script but when i write:

if alive unit then setacctime 1.0 else setacctime 0.2 for 3 seconds then go back to normal time (the brackets are intentionally missing!!!)

Just another thing, is it possible to get this script working for houses and empty vehicles as well ?

THANKS for your help !!!!

Share this post


Link to post
Share on other sites
(the brackets are intentionally missing!!!)

Why? Brackets and braces and parentheses and semi-colons are critical to the operation of the SQF scripting language and one character or symbol out of place can cause your entire game to crash. Leaving them out "intentionally" is basically saying "I don't want help, ignore this post".

Use:

[code]
if (alive unit) then {
   setAccTime 1.0;
} else {
   setAccTime 0.2;
   sleep 3;
   setAccTime 1.0;
};
[/code]

tags around all of your code so that we can see where you've gone wrong without random guessing.

Share this post


Link to post
Share on other sites

I just left the brackets in the post away not in the trigger... sorry

But it doesnt work...

Share this post


Link to post
Share on other sites

How are you implementing the if statement? In a trigger?

Share this post


Link to post
Share on other sites
How are you implementing the if statement? In a trigger?

under condition, but the code kylania posted doesn't work.

Share this post


Link to post
Share on other sites

Of course that code doesn't work. It was a demo for you to see how to post your actual code using the code tags. :)

Share this post


Link to post
Share on other sites
Of course that code doesn't work. It was a demo for you to see how to post your actual code using the code tags. :)

Ah I see ! OK sorry...

Here is the script file:

If(alive man)Then{setAccTime 1.0}Else{setAccTime .200};

So when I fill in this sleep option it dont even goes to 0.200 speed.

Share this post


Link to post
Share on other sites

Is 'man' an AI you have to kill? like a sniper shot kinda thing?

Trigger condition:

!alive man

Trigger onAct:

_null = [] spawn {setAccTime 0.2; sleep 0.6; setAccTime 1};

Play around with the 0.6. At 0.2 time acc that'll be around 3 seconds, just long enough for a nice slow rag doll death.

Edited by kylania

Share this post


Link to post
Share on other sites
Leaving them out "intentionally" is basically saying "I don't want help, ignore this post".

Nicely said. :ok:

Fux911, you might want to use an Eventhandler for this, instead of a Trigger.

That way you only have to copy this line into the init-field of any unit that should trigger the slowmo-effect.

this addEventHandler ["killed", "[] spawn {setAccTime 0.2; sleep 0.6; setAccTime 1}"];

Share this post


Link to post
Share on other sites

Better yet:

this addEventHandler ["killed", setAccTime 0.2; {0 spawn {sleep 0.6; setAccTime 1}}]

This ensures the slowmo applies immediately, even if there is some lag. Also, keep in mind that sleep is affected by slowmo which is why 0.6s will actually be 3s.

Share this post


Link to post
Share on other sites

Is there a way to get the same effect but rather when the player kills an enemy unit?

Sorry for necroing

Share this post


Link to post
Share on other sites

There is, but then you'd have to attach the eventhandler to every unit and also include a check as to who did the killing.

like this:

{_x addEventHandler ["killed", if ((_this select 1) == player) then {setAccTime 0.2; {0 spawn {sleep 0.6; setAccTime 1}}}]} forEach allUnits;

Note that this wont include units that are spawned afterwards.

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  

×