Home   Help Search Login Register  

Author Topic: Flare hangtime  (Read 3564 times)

0 Members and 1 Guest are viewing this topic.

Offline Knight Trane

  • Members
  • *
Flare hangtime
« on: 29 Nov 2008, 18:46:34 »
Hey Guys,

Is there a way to change the hang time of 40mm Flare?
 
I want to create a tripwire effect.  I want to use a "F_40mm_red".  I can get it to illuminate, but it goes out when it hits the ground.  I would like to set it at 3m hieght and have it hang there until it burns out.  Any thoughts?
« Last Edit: 01 Dec 2008, 06:50:06 by Knight Trane »

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flare hangtime
« Reply #1 on: 29 Nov 2008, 18:56:08 »
Try using the FIRED eventhandler to get the flare,
then setpos it where you want it.

Luke
Pesky Human!!
Wort Wort Wort.

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #2 on: 29 Nov 2008, 19:08:22 »
I know nothing about EventHandlers.  Could you link me to a good starting point?

Will a Fired eventhsndler work for a flare that was "fired" using this in a triger init field:
Code: [Select]
flare1 = "F_40mm_Red" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 50];
« Last Edit: 29 Nov 2008, 19:48:06 by Knight Trane »

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flare hangtime
« Reply #3 on: 29 Nov 2008, 21:54:44 »
That could work as a spawned object.
Dunno if the flare will fall from that point,
so you may need to loop it

For getting fired flares check this out.

Luke
Pesky Human!!
Wort Wort Wort.

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #4 on: 30 Nov 2008, 17:58:15 »
Alright,
The flare spawns and falls a bit before it ignites.  It goes out as soon as it hits the ground, if it doesn't go out on the way down first.  So, Luke you were right about the "Looping".  It works great.

Got this from =Odin=, over at BISforums:http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=918f705eb632bf046f11e7906bc49248;act=ST;f=71;t=76436

Quote
flare.sqs
Code Sample
_cnt = 0;
flare1 = "F_40mm_Red" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 35];
~3.5
#loop
; _cnt == "amount of times loop is run befor it ends"
?(_cnt == 400) : goto "end";
flare1 setPosASL [ (getPosASL tresflare1 select 0) + 0.199, (getPosASL tresflare1 select 1) - 0.199, (getPosASL tresflare1 select 2) + 2];
~0.001
_cnt = _cnt + 1;
goto "loop"
~1
#end
exit

This worked like a champ.  Now does any one think this would work in MP?  I know there has to be a variable sent out to all machines so everyone sees the flare.  How would I do that?  Does it go on the trigger or the flare?  Or both?
Any thoughts would be appreciated. 
Cheers! :clap:

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flare hangtime
« Reply #5 on: 30 Nov 2008, 20:42:00 »
Try to stay away from .sqs at least for later.

So your flare.sqs"
Code: (flare.sqs) [Select]
_cnt = 0;
flare1 = "F_40mm_Red" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 35];
~3.5
#loop
; _cnt == "amount of times loop is run befor it ends"
?(_cnt == 400) : goto "end";
flare1 setPosASL [ (getPosASL tresflare1 select 0) + 0.199, (getPosASL tresflare1 select 1) - 0.199, (getPosASL tresflare1 select 2) + 2];
~0.001
_cnt = _cnt + 1;
goto "loop"
~1
#end
exit

instead try:

Code: (flare.sqf) [Select]
publicvariable "flare1";
_cnt = 0;
flare1 = "F_40mm_Red" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 35];
sleep 3.5;
while {_cnt < 400} do
{
//_cnt == "amount of times loop is run befor it ends";
   flare1 setPosASL [ (getPosASL tresflare1 select 0) + 0.199, (getPosASL tresflare1 select 1) - 0.199, (getPosASL tresflare1 select 2) + 2];
   sleep 0.01;
   _cnt = _cnt + 1;
 };
exitwith{}

does the same thing with better formatting,
plus I belive publicvariable makes it run on all machines (MP).

Luke
Pesky Human!!
Wort Wort Wort.

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #6 on: 30 Nov 2008, 22:43:42 »
I got an error:

'|#|sleep 0.01;'
Error generic error in expression

 ???

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flare hangtime
« Reply #7 on: 01 Dec 2008, 00:12:39 »
I think I typed it right.

How did you execute it?

didi you use
Code: [Select]
[] execvm "flare.sqf"?

Try that.

Luke
Pesky Human!!
Wort Wort Wort.

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #8 on: 01 Dec 2008, 01:45:48 »
Still a no go.

I put this in the Init field of the trigger:
Code: [Select]
[] exec "Flare.sqf"
when I try:
Code: [Select]
[] execvm "Flare.sqf" I get  an erreor in the editor.  "Type script, expected nothing".

I also tried:
Code: [Select]
[] execVm "Flare.sqf" and
Code: [Select]
[this] execVM "Flare.sqf"The editor accepted that but then I got the same original error in the mission.

Its so close I can taste it.
« Last Edit: 01 Dec 2008, 01:50:33 by Knight Trane »

Offline Odin

  • Members
  • *
Re: Flare hangtime
« Reply #9 on: 01 Dec 2008, 01:52:23 »
what about
Code: [Select]
this = execVM "Flare.sqf"

Offline ModestNovice

  • Members
  • *
Re: Flare hangtime
« Reply #10 on: 01 Dec 2008, 03:11:53 »
yes when executing from a trigger you need a 'something' = exec bla bla.

Ex:
Code: [Select]
nil = [] execVM "flare.sqf";

"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flare hangtime
« Reply #11 on: 01 Dec 2008, 04:28:28 »
Still a no go.
...
Its so close I can taste it.

That it is.

You always have to name the script something.

Do what Da Chevs did.

Though I'm away from arma computer so I don't know whether the sleep is a genuine error or not.

Luke
Pesky Human!!
Wort Wort Wort.

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #12 on: 01 Dec 2008, 06:20:07 »
It works to a point.  I get an error at the start of the trigger.
Code: [Select]
'...sleep 0.01;
_cnt = _cnt + 1;
};
exitwith|#|{};'
Error Missing ;
File C:\Documents and settings|Knight Trane\My Documents|ArmA Other
Profiles\Knighttrane\mpmissions\FlareMPtest.Intro\flare.sqf, Line 17

I ran it with some mates.  Six at one point.  It produced six flares miliseconds apart.   ???

Would the multiple flares go away if I ran this on a Dedicated server?
I'm really lost on this multiplayer stuff.

Offline Odin

  • Members
  • *
Re: Flare hangtime
« Reply #13 on: 01 Dec 2008, 06:37:37 »
Hiya again

Try the SQF file this way with an if statatment to exit instead of just "exitwith{};"

Code: [Select]
if (isServer and (isNull player)) exitWith {};
publicvariable "flare1";
_cnt = 0;
flare1 = "F_40mm_Red" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 35];
sleep 3.5;
while {_cnt < 400} do
{
//_cnt == "amount of times loop is run befor it ends";
   flare1 setPosASL [ (getPosASL tresflare1 select 0) + 0.199, (getPosASL tresflare1 select 1) - 0.199, (getPosASL tresflare1 select 2) + 2];
   sleep 0.01;
   _cnt = _cnt + 1;
 };
if (true) exitwith {};

Also the server check at the start of the script should make it only run once on the server not all clients.

Odin

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #14 on: 01 Dec 2008, 06:49:37 »
OK!  Seems to work just fine. :good: :clap: :cool2:

I need to get some testers to check it in MP,  but it looks good.  No errors.  I can't tell you how much I like no errors.

Thanks guys. If the MP test works out I'll put the "solved" on it, and post in the BIS topic.

This is gonna be cool.