Home   Help Search Login Register  

Author Topic: .sqf loop + create smoke shell  (Read 2100 times)

0 Members and 1 Guest are viewing this topic.

Offline Binary

  • Members
  • *
.sqf loop + create smoke shell
« 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 !
"Ah.. Home sweet hell !" - Al Bundy

Offline i0n0s

  • Moderator
  • *****
Re: .sqf loop + create smoke shell
« Reply #1 on: 02 Mar 2011, 10:44:56 »
exec only works for sqs, sqf needs execVM

Offline F2kSel

  • Members
  • *
Re: .sqf loop + create smoke shell
« Reply #2 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.

Offline Binary

  • Members
  • *
Re: .sqf loop + create smoke shell
« Reply #3 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??
"Ah.. Home sweet hell !" - Al Bundy

Offline F2kSel

  • Members
  • *
Re: .sqf loop + create smoke shell
« Reply #4 on: 03 Mar 2011, 20:54:02 »
Yes it should just keep running the loop for around 10 minutes then exit.