OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Knight Trane on 29 Nov 2008, 18:46:34

Title: Flare hangtime
Post by: Knight Trane 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?
Title: Re: Flare hangtime
Post by: Luke on 29 Nov 2008, 18:56:08
Try using the FIRED eventhandler to get the flare,
then setpos it where you want it.

Luke
Title: Re: Flare hangtime
Post by: Knight Trane 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];
Title: Re: Flare hangtime
Post by: Luke 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 (http://www.ofpec.com/forum/index.php?topic=22490.msg150537#msg150537) out.

Luke
Title: Re: Flare hangtime
Post by: Knight Trane 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 (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:
Title: Re: Flare hangtime
Post by: Luke 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
Title: Re: Flare hangtime
Post by: Knight Trane on 30 Nov 2008, 22:43:42
I got an error:

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

 ???
Title: Re: Flare hangtime
Post by: Luke 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
Title: Re: Flare hangtime
Post by: Knight Trane 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.
Title: Re: Flare hangtime
Post by: Odin on 01 Dec 2008, 01:52:23
what about
Code: [Select]
this = execVM "Flare.sqf"
Title: Re: Flare hangtime
Post by: ModestNovice 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";

Title: Re: Flare hangtime
Post by: Luke 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
Title: Re: Flare hangtime
Post by: Knight Trane 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.
Title: Re: Flare hangtime
Post by: Odin 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
Title: Re: Flare hangtime
Post by: Knight Trane 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.
Title: Re: Flare hangtime
Post by: Luke on 01 Dec 2008, 07:15:30
Neat, glad to hear it!  :D

Be sure to post a screenshot!

Luke
Title: Re: Flare hangtime
Post by: Odin on 01 Dec 2008, 07:40:45
 :D Good news
Enjoy!

 For a bit of fun with flares I created this .sqs (hehe sorry Luke ;))

lightshow.sqs
Code: [Select]
_d = direction tresflare1;
_cnt = 0;
~0.1
flare1 = "F_40mm_Red" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 35];
flare1 setdir _d
flare2 = "F_40mm_Yellow" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 35.001];
flare2 setdir _d
flare3 = "F_40mm_Green" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 35.002];
flare3 setdir _d
flare4 = "F_40mm_White" createVehicle [getPos tresflare1 select 0, getPos tresflare1 select 1, 35.003];
flare4 setdir _d
~3.5
#loop
; _cnt == "amount of times loop is run befor it ends"
?(_cnt == 400) : goto "end";
flare1 setPosASL [ (getPosASL tresflare1 select 0) + 0, (getPosASL tresflare1 select 1) - 0, (getPosASL tresflare1 select 2) + 2];
~0.001
flare2 setPosASL [ (getPosASL tresflare1 select 0) + 3, (getPosASL tresflare1 select 1) - 3, (getPosASL tresflare1 select 2) + 5];
~0.001
flare3 setPosASL [ (getPosASL tresflare1 select 0) + 6, (getPosASL tresflare1 select 1) - 6, (getPosASL tresflare1 select 2) + 8];
~0.001
flare4 setPosASL [ (getPosASL tresflare1 select 0) + 9, (getPosASL tresflare1 select 1) - 9, (getPosASL tresflare1 select 2) + 11];
~0.001
goto "loop1";
#loop1
flare1 setPosASL [ (getPosASL tresflare1 select 0) + 12, (getPosASL tresflare1 select 1) - 12, (getPosASL tresflare1 select 2) + 14];
~0.001
flare2 setPosASL [ (getPosASL tresflare1 select 0) + 9, (getPosASL tresflare1 select 1) - 9, (getPosASL tresflare1 select 2) + 17];
~0.001
flare3 setPosASL [ (getPosASL tresflare1 select 0) + 6, (getPosASL tresflare1 select 1) - 6, (getPosASL tresflare1 select 2) + 20];
~0.001
flare4 setPosASL [ (getPosASL tresflare1 select 0) + 3, (getPosASL tresflare1 select 1) - 3, (getPosASL tresflare1 select 2) + 23];
~0.001
goto "loop2";
#loop2
flare1 setPosASL [ (getPosASL tresflare1 select 0) - 0, (getPosASL tresflare1 select 1) + 0, (getPosASL tresflare1 select 2) + 25];
~0.001
flare2 setPosASL [ (getPosASL tresflare1 select 0) - 3, (getPosASL tresflare1 select 1) + 3, (getPosASL tresflare1 select 2) + 23];
~0.001
flare3 setPosASL [ (getPosASL tresflare1 select 0) - 6, (getPosASL tresflare1 select 1) + 6, (getPosASL tresflare1 select 2) + 20];
~0.001
flare4 setPosASL [ (getPosASL tresflare1 select 0) - 9, (getPosASL tresflare1 select 1) + 9, (getPosASL tresflare1 select 2) + 17];
~0.001
goto "loop3";
#loop3
flare1 setPosASL [ (getPosASL tresflare1 select 0) - 12, (getPosASL tresflare1 select 1) + 12, (getPosASL tresflare1 select 2) + 14];
~0.001
flare2 setPosASL [ (getPosASL tresflare1 select 0) - 9, (getPosASL tresflare1 select 1) + 9, (getPosASL tresflare1 select 2) + 11];
~0.001
flare3 setPosASL [ (getPosASL tresflare1 select 0) - 6, (getPosASL tresflare1 select 1) + 6, (getPosASL tresflare1 select 2) + 8];
~0.001
flare4 setPosASL [ (getPosASL tresflare1 select 0) - 3, (getPosASL tresflare1 select 1) + 3, (getPosASL tresflare1 select 2) + 5];
~0.001
_cnt = _cnt + 1;
goto "loop"
~1
#end
exit

It looks like a Close incounter
Title: Re: Flare hangtime
Post by: Knight Trane on 01 Dec 2008, 22:43:50
 :( 
Still seeing multiple flares.

=odin=,
Thats pretty funny.  lol!

There still multiple flares spawning.  One for every Player.  I knocked the Z distance down to 28 and reduced the sleep time to 1.3.

When it ignites, it stays still and you can't see the multiple flares.  Is this OK or will it cause problems if I place alot of them?  I don't intend on tripping them all at once or anything crazy like that.

Would it be possible to make this some thing a player could place himself in game?
Title: Re: Flare hangtime
Post by: Odin on 05 Dec 2008, 22:07:31
Heya mate, do you mean Like a deployable booby trap? If so Yes quite possible. I have made a Deployable IED so I think we could change that script around a little to serve your purpose. You can find that here http://www.ofpec.com/forum/index.php?topic=32584.msg224159#msg224159. if you have trouble changing it around let me know. I will have a look later today at it aswell when I get a spare moment.

EDIT: G'day again Ok I modified the IED script. I think I fixed the drop effects to setpos'ing the flare 5000m away from the trigger area when it first drops then setpos'ing back for the loop. anyways 1st for this method to work you will have to delete your "tresflare1" Logic.

Now add this line to your init;
Code: [Select]
deployFlare = player addAction ["Deploy TripFlare", "rovingFlare.sqf",[],-1, false, false, ""];

add these 3 scripts

rovingFlare.sqf
Code: [Select]
//////////////////////////////////////////////////////////////////
// rovingFlare.sqf
// Created by: Odin
// Usage; This script is called upon using the action from the menu In-game
//
// //Trigger ====>
//
// sleep 0.001;
// trgz = createTrigger["EmptyDetector",getPos IED];
// trgz setTriggerArea[30,30,0,true];
// trgz setTriggerActivation["EAST","PRESENT",false];
// trgz setTriggerStatements["this", "execVM ""findIED.sqf""", ""];
// trgz setTriggerType "NONE";
//
// When using the trigger, be sure to change which side is to activate the Trigger, eg.
//
// trgz setTriggerActivation["EAST","PRESENT",false];
//
// This is set to EAST, to change to WEST, use.
//
// trgz setTriggerActivation["WEST","PRESENT",false];
//
//////////////////////////////////////////////////////////////////

_caller = _this select 1;
//id = _this select 2; // action param
if (_caller != player) exitWith {};
 
// delete previously placed flare
deleteVehicle trgz;
_caller removeAction deployFlare;
defuse_obj removeAction UndeployFlare;
deleteMarker idflare;
deleteVehicle tresflare1;
deleteVehicle defuse_obj;


// begin creating new flare

idflare = format["%1TripFlare",(name player)];

sleep 0.1;

titleText ["Setting TripFlare...", "Plain Down"];
//titleRsc["ProgressBar", "plain"];

_d = direction _caller + 90;
tresflare1 = "AAPL093" Createvehicle position _caller;
tresflare1 setDir _d;
tresflare1 setPosASL [ (getPosASL _caller select 0) + 0.199, (getPosASL _caller select 1) - 0.199, getPosASL _caller select 2];
_pos = position tresflare1;
_plrTag = format["%1's TripFlare",(name player)];
flaremarker = createMarker [idflare, _pos];
flaremarker setMarkerShape "ICON";
flaremarker setMarkerType "Marker";
flaremarker setMarkerColor "ColorRedAlpha";
flaremarker setMarkerText _plrTag;
flaremarker setMarkerSize [0.5, 0.5];
flaremarker setMarkerDir 45;
sleep 0.001;
defuse_obj = "weaponholder" Createvehicle getmarkerpos flaremarker;
defuse_obj addMagazineCargo ["500Rnd_TwinVickers",1];
defuse_obj setDir _d;
defuse_obj setPos [ (getmarkerpos flaremarker select 0) + 0.001, (getmarkerpos flaremarker select 1) - 0.001, getmarkerpos flaremarker select 2];

_caller playMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 3.0;
WaitUntil {animationState _caller != "AinvPknlMstpSlayWrflDnon_medic"};
sleep 0.1;

// Trigger ====>

sleep 0.001;
trgz = createTrigger["EmptyDetector",getPos tresflare1];
trgz setTriggerArea[30,30,0,true];
trgz setTriggerActivation["EAST","PRESENT",false];
trgz setTriggerStatements["this", "execVM ""flare.sqf""", ""];
trgz setTriggerType "NONE";
publicvariable "trgz";
sleep 0.8;
titleText ["TripFlare deployed...", "Plain Down"];
sleep 1;
//deployFlare = player addAction ["Deploy TripFlare", "rovingFlare.sqf",[],-1, false, false, ""];
UndeployFlare = defuse_obj addAction ["Defuse TripFlare", "defuseflare.sqf"];

if (true) exitWith {};

flare.sqf
Code: [Select]
if (isServer and (isNull player)) exitWith {};

_cnt = 0;
flare1 = "F_40mm_Red" createVehicle [(getPos tresflare1 select 0) + 5000, (getPos tresflare1 select 1) - 5000, 35];
publicvariable "flare1";
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;
 };
defuse_obj removeAction UndeployFlare;
deleteMarker idflare;
deleteVehicle tresflare1;
deleteVehicle defuse_obj;
deleteVehicle trgz;

if (true) exitwith {};

defuseflare.sqf
Code: [Select]
//////////////////////////////////////////////////////////////////
// defuse.sqf
// Created by: Odin
// USAGE:
// This script will delete all actions, the Flare object, the created trigger and the marker,
// then re-add the Deploy TripFlare action again.
//////////////////////////////////////////////////////////////////

_caller = _this select 1;
//id = _this select 2; // action param
if (_caller != player) exitWith {};

defuse_obj removeAction UndeployFlare;
sleep 0.1;

titleText ["Defusing TripFlare...", "Plain Down"];
//titleRsc["DefuseProgressBar", "plain"];

_caller playMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 3.0;
WaitUntil {animationState _caller != "AinvPknlMstpSlayWrflDnon_medic"};
sleep 1.9;
titleText ["TripFlare defused...", "Plain Down"];
deleteVehicle trgz;
_caller removeAction deployFlare;
defuse_obj removeAction UndeployFlare;
deleteMarker idflare;
deleteVehicle tresflare1;
deleteVehicle defuse_obj;

titleText ["TripFlare Defused...", "Plain Down"];

deployFlare = _caller addAction ["Deploy TripFlare", "rovingFlare.sqf",[],-1, false, false, ""];

if (true) exitWith {};

All should work in MP as far as I can tell :scratch:

I also have a Dialog progress bar for this but have excluded its use, but if it works and you want it let me know.

I am intrested in seein if this works properly in MP so can you tell me how it go'es if you use it?

GL
Odin


 
Title: Re: Flare hangtime
Post by: Knight Trane on 08 Dec 2008, 09:57:00
Out freaking standing!
I'll try this out with my unit tuesday night.  I'll let you know what happens.  Thanks

And your Roving IED is awesome.
Title: Re: Flare hangtime
Post by: Odin on 08 Dec 2008, 11:20:43
 :-[ Thanx mate I hope it works first time, just not sure if it is MP friendly.. but if it is it will help me convert the IED script over to MP aswell  :D
Title: Re: Flare hangtime
Post by: Knight Trane on 10 Dec 2008, 15:45:07
Well,
like all good ideas, its back to the forums we go.  LOL, lol, lol.

Odin,  couldn't get it to work.  I got the addaction and the animation, but when the East entered my trap nothing.  At least as far as I could tell. 

In the "rovingflare.sqf", I replaced the (playername) with the name of my player.  That got me as far as the addaction and animation.

This is the sqf as I have it minus the opening remarks:
Code: [Select]
_caller = _this select 1;
//id = _this select 2; // action param
if (_caller != player) exitWith {};
 
// delete previously placed flare
deleteVehicle trgz;
_caller removeAction deployFlare;
defuse_obj removeAction UndeployFlare;
deleteMarker idflare;
deleteVehicle tresflare1;
deleteVehicle defuse_obj;


// begin creating new flare

idflare = format["%1TripFlare",(p1)];

sleep 0.1;

titleText ["Setting TripFlare...", "Plain Down"];
//titleRsc["ProgressBar", "plain"];

_d = direction _caller + 90;
tresflare1 = "AAPL093" Createvehicle position _caller;
tresflare1 setDir _d;
tresflare1 setPosASL [ (getPosASL _caller select 0) + 0.199, (getPosASL _caller select 1) - 0.199, getPosASL _caller select 2];
_pos = position tresflare1;
_plrTag = format["%1's TripFlare",(p1)];
flaremarker = createMarker [idflare, _pos];
flaremarker setMarkerShape "ICON";
flaremarker setMarkerType "Marker";
flaremarker setMarkerColor "ColorRedAlpha";
flaremarker setMarkerText _plrTag;
flaremarker setMarkerSize [0.5, 0.5];
flaremarker setMarkerDir 45;
sleep 0.001;
defuse_obj = "weaponholder" Createvehicle getmarkerpos flaremarker;
defuse_obj addMagazineCargo ["500Rnd_TwinVickers",1];
defuse_obj setDir _d;
defuse_obj setPos [ (getmarkerpos flaremarker select 0) + 0.001, (getmarkerpos flaremarker select 1) - 0.001, getmarkerpos flaremarker select 2];

_caller playMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 3.0;
WaitUntil {animationState _caller != "AinvPknlMstpSlayWrflDnon_medic"};
sleep 0.1;

// Trigger ====>

sleep 0.001;
trgz = createTrigger["EmptyDetector",getPos tresflare1];
trgz setTriggerArea[30,30,0,true];
trgz setTriggerActivation["EAST","PRESENT",false];
trgz setTriggerStatements["this", "execVM "flare.sqf"", ""];
trgz setTriggerType "NONE";
publicvariable "trgz";
sleep 0.8;
titleText ["TripFlare deployed...", "Plain Down"];
sleep 1;
//deployFlare = player addAction ["Deploy TripFlare", "rovingFlare.sqf",[],-1, false, false, ""];
UndeployFlare = defuse_obj addAction ["Defuse TripFlare", "defuseflare.sqf"];


On another note concernig the actual trigger.  I'm going to try to make it "Rectangular", with a=30, b=1.  Place it so one end is about 5m from :"player", running along the direction the "player" is facing.  Will also be onetime use set off by anyone. 

Again,  its so close I can taste it.  but this time it will be better.  Like before it was "cake", but now it's "German Chacolate Cake".  OH YEAH! :D
Title: Re: Flare hangtime
Post by: Odin on 15 Dec 2008, 03:22:38
G'day again, srry for the late reply, but I have been as flat as a lizard drinking water, Xmass time is crazy in the building Game :dry:.

Anyways I Have tried again to fix this even tested it on a dedicated server, where it worked. I have simplified the script so it is now a one time use (Deleted the marker and defuse action)

I looked through Xeno's Domination scripts to see how he adds actions and this is the result, not sure if it is correct but it works I think ???  Only thing I can't help with is the trigger location from player so I added a 5 second sleep befor it is created after the action is finished, so in otherwords if You don't want to set it off yourself Run!! after deploying.

In the Init.sqf add this
Code: [Select]
flr1 = 0;
// Use this to add the action to player
sleep 1;
call compile preprocessFile "jip.sqf";

jip.sqf
Code: [Select]
PRIVATE ["_p"];

_p = player;

if (side _p == West) then {
if (_p == p1) then {
flr1 = _p addAction ["Deploy TripFlare", "rovingFlare.sqf",[],-1,false];
};

};

if (true) exitWith {};

NOTE; p1 is the name given in the editor, for the player to recieve the Action. Change the side to suit your player.

rovingFlare.sqf
Code: [Select]
_caller = _this select 1;
//id = _this select 2; // action param
if (_caller != player) exitWith {};

titleText ["Setting TripFlare...", "Plain Down"];
_d = direction _caller;
tresflare1 = "AAPL093" Createvehicle position _caller;
tresflare1 setDir _d;
tresflare1 setPosASL [ (getPosASL _caller select 0) + 0.199, (getPosASL _caller select 1) - 0.199, getPosASL _caller select 2];
sleep 1;

_caller playMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 3.0;
WaitUntil {animationState _caller != "AinvPknlMstpSlayWrflDnon_medic"};
sleep 0.8;
titleText ["TripFlare deployed...", "Plain Down"];

sleep 5;


trgz = createTrigger["EmptyDetector",getPos tresflare1];
trgz setTriggerArea[30,1,_d,false];
trgz setTriggerActivation["ANY","PRESENT",false];
trgz setTriggerStatements["this", "execVM ""flare.sqf""", ""];
trgz setTriggerType "NONE";
publicvariable "trgz";

p1 removeAction flr1;

if (true) exitWith {};

flare.sqf
Code: [Select]
if (isServer and (isNull player)) exitWith {};

_cnt = 0;
flare1 = "F_40mm_Red" createVehicle [(getPos tresflare1 select 0) + 5000, (getPos tresflare1 select 1) - 5000, 35];
publicvariable "flare1";
sleep 0.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;
 };
deleteVehicle tresflare1;
deleteVehicle trgz;

if (true) exitwith {};

I hope it all works, that is about the limit of my MP scripting knowledge (LOL not much really)
Title: Re: Flare hangtime
Post by: Luke on 24 Dec 2008, 02:21:26
Odin a few things to address:

rovingFlare.sqf

{the phrase "if (_caller != player) exitwith {};" should be "If not(_caller == player) exitwith {};"}

Code: [Select]
_caller = _this select 1;
//id = _this select 2; // action param
if (_caller != player) exitWith {};

titleText ["Setting TripFlare...", "Plain Down"];
_d = direction _caller;
tresflare1 = "AAPL093" Createvehicle position _caller;
tresflare1 setDir _d;
tresflare1 setPosASL [ (getPosASL _caller select 0) + 0.199, (getPosASL _caller select 1) - 0.199, getPosASL _caller select 2];
sleep 1;

_caller playMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 3.0;
WaitUntil {animationState _caller != "AinvPknlMstpSlayWrflDnon_medic"};
sleep 0.8;
titleText ["TripFlare deployed...", "Plain Down"];

sleep 5;


trgz = createTrigger["EmptyDetector",getPos tresflare1];
trgz setTriggerArea[30,1,_d,false];
trgz setTriggerActivation["ANY","PRESENT",false];
trgz setTriggerStatements["this", "execVM ""flare.sqf""", ""];
trgz setTriggerType "NONE";
publicvariable "trgz";

p1 removeAction flr1;

if (true) exitWith {};

{in the phrase 'trgz setTriggerStatements["this", "execVM ""flare.sqf""", ""];'
you can except the deployer forever by changing it to
'trgz setTriggerStatements["this&&not(_unit in thislist)", "execVM ""flare.sqf""", ""];'}


Nothing verified but a few things I saw and thought would help.

Luke