OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: Binary on 02 Mar 2011, 02:46:26

Title: .sqf loop + create smoke shell
Post by: Binary on 02 Mar 2011, 02:46:26
Hi folks,

I'm a complete .sqf/.sqs retard, but understand a few things here and there..
I'm trying to create a simple script that creates persistent smoke (for a drop zone marking) for 10 minutes..

The idea was something in the line of (please don't laugh.. to hard..)

Code: [Select]
while { true } do
{
  smoke1 = "SmokeShellRed" createvehicle getpos smoke1;
  smoke2 = "SmokeShellRed" createvehicle getpos smoke2;
  smoke3 = "SmokeShellRed" createvehicle getpos smoke3;
  smoke4 = "SmokeShellRed" createvehicle getpos smoke4;

  sleep 40; // Roughly the time it takes for the smoke to dissapear
};

aaaaand i still haven't figured out how to terminate it from there, not really my highest priority right now.
Using the above, the smoke shows up the first time, but the loop doesn't seem to work..

The script is executed like this:
this exec "persistent-light-smoke.sqf"

As I said, I'm a scripting retard, but would love to understand why this doesn't work, and how to fix it..

Cheers !
Title: Re: .sqf loop + create smoke shell
Post by: i0n0s on 02 Mar 2011, 10:44:56
exec only works for sqs, sqf needs execVM
Title: Re: .sqf loop + create smoke shell
Post by: F2kSel on 02 Mar 2011, 22:51:24
call with  null= [] execvm "timesmoke.sqf"

Code: [Select]
while { time <10*60 } do
{
  smoke1 = "SmokeShellRed" createvehicle getpos smoke1;
  smoke2 = "SmokeShellRed" createvehicle getpos smoke2;
  smoke3 = "SmokeShellRed" createvehicle getpos smoke3;
  smoke4 = "SmokeShellRed" createvehicle getpos smoke4;

  sleep 40; // Roughly the time it takes for the smoke to dissapear
};

That should run for ten mins + how long the last smoke will run last.
Title: Re: .sqf loop + create smoke shell
Post by: Binary on 03 Mar 2011, 01:55:33
Thanks !

Does that mean that the following snippet:
Code: [Select]
{ time <10*60 } automaticly begins counting down 10 times 60 seconds??
Title: Re: .sqf loop + create smoke shell
Post by: F2kSel on 03 Mar 2011, 20:54:02
Yes it should just keep running the loop for around 10 minutes then exit.