OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Xsi9mm on 19 Feb 2007, 00:41:34

Title: I need a good script that will simulate sleep please help.
Post by: Xsi9mm on 19 Feb 2007, 00:41:34
I need a script for my mission that will make the player sleep for a few hours untill day time. I would like someone to preferably make a script that i can use and make a variable for the amount of time that i want to pass while the screen im assuming will be black. Anyways i just want a script that will simulate player sleep and passing of time thanks!
Title: Re: I need a good script that will simulate sleep please help.
Post by: Terox on 24 Feb 2007, 21:48:40
the very very basic system would simply require you to run a script on the players client that would blacken out the screen and then fade back in after a while.
Check the comref for:

titlecut

eg

titlecut ["You are asleep","BLACK IN",0]
~60
titlecut ["You have been awoken","BLACK OUT",0]
Title: Re: I need a good script that will simulate sleep please help.
Post by: Wolfrug on 25 Feb 2007, 02:22:01
There are two basic ways to pass time in ArmA/OFP : skipTime and setAccTime. The former simply jumps the hours forward without, AFAIK, actually affecting anything else (like sleep or wait commands, timeouts, countdowns or anything else goverenered by other things than the dayTime check). The latter actually speeds up time (like when you press the x2 and x4 buttons in-game), but you can reach much higher time accelerations than just x4. Problem with this is obviously that a very high time acceleration will probably break most complicated scripts, cause very erratic AI behaviour, and most probably make your computer go "oomph" and die due to too much stuff happening too quickly.

So, the best solution is probably using skipTime, which will simulate time passing quite nicely. Extrapolating on Terox' solution there, a script like this would be easy enough:

Code: [Select]
_skiptime = _this select 0

titlecut ["You fall asleep.", "Black Out", 1]
~(_skiptime * 2)
skipTime _skipTime
titleCut ["You wake up.", "Black In", 1]
exit

Call it somewhere as:

Have fun!

Wolfrug out.