Home   Help Search Login Register  

Author Topic: Flare hangtime  (Read 3522 times)

0 Members and 1 Guest are viewing this topic.

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flare hangtime
« Reply #15 on: 01 Dec 2008, 07:15:30 »
Neat, glad to hear it!  :D

Be sure to post a screenshot!

Luke
Pesky Human!!
Wort Wort Wort.

Offline Odin

  • Members
  • *
Re: Flare hangtime
« Reply #16 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

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #17 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?
« Last Edit: 02 Dec 2008, 17:48:35 by Knight Trane »

Offline Odin

  • Members
  • *
Re: Flare hangtime
« Reply #18 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


 
« Last Edit: 07 Dec 2008, 04:29:14 by Odin »

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #19 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.

Offline Odin

  • Members
  • *
Re: Flare hangtime
« Reply #20 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

Offline Knight Trane

  • Members
  • *
Re: Flare hangtime
« Reply #21 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

Offline Odin

  • Members
  • *
Re: Flare hangtime
« Reply #22 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)
« Last Edit: 15 Dec 2008, 03:29:02 by Odin »

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flare hangtime
« Reply #23 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
Pesky Human!!
Wort Wort Wort.