OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect on 08 Jan 2009, 18:46:38

Title: Do not allow X speed for duration of a script
Post by: The-Architect on 08 Jan 2009, 18:46:38
How can I stop the player being able speed up time during a script?
Title: Re: Do not allow X speed for duration of a script
Post by: Deadfast on 08 Jan 2009, 19:56:55
Perhaps there's a better way, but you could simply run a loop checking if accTime != 1 and if so setting it to 1

Code: [Select]
while {scriptOn} do
{
if (accTime != 1) then
{
setAccTime 1;
};

sleep 0.5;
};
Title: Re: Do not allow X speed for duration of a script
Post by: The-Architect on 08 Jan 2009, 21:00:05
Sorry to be a pain but how would I do this in a .sqs?
Title: Re: Do not allow X speed for duration of a script
Post by: Deadfast on 08 Jan 2009, 22:42:38
I suck at SQS, but this seems to work :D

Code: [Select]
#loop

? accTime != 1 : setAccTime 1;

~0.5

? scriptOn : goto "loop"
Title: Re: Do not allow X speed for duration of a script
Post by: Tyger on 09 Jan 2009, 06:08:04
Arch, just curious but why would you want to implement this with SQS? SQF (functions) perform much better than SQS when executing something at rapid intervals. So your mission would have better performance running this script as an SQF than and SQS.

Im sure for most the difference would be negligible, but it might not be transparent to some.
Just my 2 cents worth.
Title: Re: Do not allow X speed for duration of a script
Post by: The-Architect on 09 Jan 2009, 10:49:57
I've not learned all the syntax for .sqf. At least with .sqs I kind of know where I am.
You know how it is, when you're flying through a particular point with a project you don't want to stop and learn a whole new thing. If there's an easy way you'll take it.
Title: Re: Do not allow X speed for duration of a script
Post by: hoz on 09 Jan 2009, 15:10:05
The path of least resistance :)
Title: Re: Do not allow X speed for duration of a script
Post by: bedges on 09 Jan 2009, 15:37:21
Unfortunately, the path of least resistance all too often ends abruptly in a 400ft waterfall with big pointy rocks below. If ArmAII goes .sqf-only, your .sqs barrel will not survive the drop.

It's really not that much more to learn (http://www.ofpec.com/ed_depot/index.php?action=details&id=390&game=ArmA) at all.
Title: Re: Do not allow X speed for duration of a script
Post by: Ext3rmin4tor on 09 Jan 2009, 15:55:17
He's right, I spent 3 days to learn SQF syntax, it's worth your time. The control structures allow you to make a good code and not that "spaghetti code" shit you have to do with goto's in SQS. Besides as he said, ArmA2 will be propbably SQF only
Title: Re: Do not allow X speed for duration of a script
Post by: hoz on 09 Jan 2009, 16:02:53
I agree also, mostly the main differences are just the looping functions all other commands really remain the same.