Jump to content
Sign in to follow this  
Semedar

Player addAction attach IR Strobe to player?

Recommended Posts

Is there a way to addAction a player that will create an IR Stobe and attach it to said player?

My goal: Player is in thick woods at night while buddy is flying overhead with a littlebird but doesnt want to kill me. So I scroll my action menu and select "Turn IR On" and an IR Strobe follows me everywhere I go until I die.

This is the closest I found but it's for ACE, which I don't want to use:

http://ace.dev-heaven.net/wagn/IR_Strobes+notes

Something like this perhaps? Just an idea. :rolleyes:

Player Init

 p1 addAction [("<t color=""#EEEE00"">" + ("Turn IR On") +"</t>"), "Scripts\IR_Strobe.sqf"];

IR_Strobe.sqf

 _irstrobe = "ACE_IRStrobe_Object" createVehicle  getPos  p1;
 _irstrobe attachTo[p1,[0,0,0],""];
 ["ace_sys_irstrobe_aradd", [_irstrobe]] call CBA_fnc_globalEvent;

Edited by Semedar
Change Title

Share this post


Link to post
Share on other sites

This is what I have so far. It works, but when you start to run, the strobe eventually detaches from the character and is stuck on the ground.

//Strobe.sqf
//By Semedar
//Player Init: p1 addAction [("<t color=""#FFFFFF"">" + ("Strobe") +"</t>"), "Scripts\Player\Strobe.sqf"];

while { true } do
{ 
_irstrobe = "IR_Strobe_Marker" createVehicle  getPos  player;
_irstrobe attachTo [player,[0,0,1],""];
Sleep 5;
deleteVehicle _irstrobe;
};

Edit: I found out it detaches when the model disappears but the strobe is still on. Anyone know how to make the strobe light follow the character?

Edit 2: I also found out that the IR Strobe model disappears somewhere around 13-15 seconds. So maybe having it delete the IR Strobe and then creating a new one every 12-13 seconds?

Another Edit: I can't seem to delete the IR Strobe that I created via createVehicle with deleteVehicle. Anyone help me here?

Edited by Semedar

Share this post


Link to post
Share on other sites

Hi,

if attachTo doesn't work, you can use this alternative:

stroboDrop = false;
_irstrobe = "IR_Strobe_Marker" createVehicle (getPos  player);

while {!stroboDrop} do { 
_irstrobe setpos [(getPos player select 0), (getPos player select 1), 1];
_irstrobe setDir (getDir player);
sleep 0.01;
};

_irstrobe setpos [(getPos player select 0), (getPos player select 1), 0];

This way, to drop the strobo, you just have to set stroboDrop to true.

stroboDrop = true;

Then you can call it again, and so on.

Edited by sxp2high

Share this post


Link to post
Share on other sites
Hi,

if attachTo doesn't work, you can use this alternative:

stroboDrop = false;
_irstrobe = "IR_Strobe_Marker" createVehicle (getPos  player);

while {!stroboDrop} do { 
_irstrobe setpos [(getPos player select 0), (getPos player select 1), 1];
_irstrobe setDir (getDir player);
sleep 0.01;
};

_irstrobe setpos [(getPos player select 0), (getPos player select 1), 0];

This way, to drop the strobo, you just have to set stroboDrop to true.

stroboDrop = true;

Then you can call it again, and so on.

Tried yours but it just makes the strobe spawn and stay on the ground. :(

I think we're going to have to send a bug report because I don't think we can move/delete/mess around with an IR Strobe once it's been "deployed". As in the model disappears and all it leaves behind is the strobe light.

Edited by Semedar

Share this post


Link to post
Share on other sites

setPos it to [-10000,-10000,100000] before you delete it

Share this post


Link to post
Share on other sites
setPos it to [-10000,-10000,100000] before you delete it

Won't work either. :(

while { true } do
{ 
_irstrobeplayer = "IRStrobe" createVehicle  getPos  player;
_irstrobeplayer attachTo [player,[0,0,2],""];
Sleep 10;
[b]_irstrobeplayer setPosATL [-10000,-10000,100000];[/b]
deleteVehicle _irstrobeplayer;
};

My test mission:

Strobe_Test.utes.zip

Edited by Semedar

Share this post


Link to post
Share on other sites
you need to detach it first I guess

Hah, it was that simple, huh? :D

It worked, though! :D

while { true } do
{ 
_irstrobeplayer = "IRStrobe" createVehicle  getPos  player;
_irstrobeplayer attachTo [player,[0,0,1],""];
Sleep 15;
detach _irstrobeplayer;
_irstrobeplayer setPosATL [-10000,-10000,100000];
Sleep 0.1;
deleteVehicle _irstrobeplayer;
Sleep 0.1;
};

Question now, though:

  1. How would I be able to start/stop this script via Action Menu
  2. How to stop it when the player dies

---------- Post added at 03:01 AM ---------- Previous post was at 02:26 AM ----------

Would something like this work?

// Strobe2.sqf
// By Semedar
// Player Init: p1 addAction [("<t color=""#FFFFFF"">" + ("Strobe") +"</t>"), "Strobe2.sqf"];

strobe = true;

while { strobe } do
{ 
_irstrobeplayer = "IRStrobe" createVehicle  getPos  player;
_irstrobeplayer attachTo [player,[0,0,2],""];
Sleep 14.8;
detach _irstrobeplayer;
_irstrobeplayer setPosATL [-10000,-10000,100000];
Sleep 0.1;
deleteVehicle _irstrobeplayer;
Sleep 0.1;
};

WaitUntil{not isNull player};
player addEventHandler ["killed", {strobe = false}];

Edited by Semedar

Share this post


Link to post
Share on other sites

You can use the Strobe Effect instead of the IR-Marker model (ammo).

_irstrobe = "NVG_TargetW" createVehicle getpos unitName;

_irstrobe attachTo [unitName,[0,0,0.2],"neck"];

You can choose between three IR-Targets:

"NVG_TargetC": Independent AI will attack this.

"NVG_TargetW": West AI will attack this.

"NVG_TargetE": East AI will attack this.

Share this post


Link to post
Share on other sites

Mission Init:

strobeOn = player addAction ["MS-2000 On","strobeStart.sqf"];

strobeStart.sqf: (Working Now)

// strobeStart.sqf
// By Semedar
// Player Init: unit addAction ["MS-2000 On", "strobeStart.sqf"];

player removeAction strobeOn;
Sleep 0.1;
strobeOff = player addAction ["MS-2000 Off", "strobeStop.sqf"];

strobe = true;

while { strobe } do
{ 
_irstrobe = "NVG_TargetC" createVehicle getpos player;
_irstrobe attachTo [player,[0,0,0.2],"neck"];
Sleep 0.8;
detach _irstrobe;
deleteVehicle _irstrobe;
Sleep 0.1;
};

WaitUntil{not isNull player};
player addEventHandler ["killed", {strobe = false}];

strobeStop.sqf: (Working Now)

// strobeStop.sqf
// By Semedar
// Player Init: unit addAction ["MS-2000 Off", "strobeStop.sqf"];

player removeAction strobeOff;
Sleep 0.1;
strobeOn = player addaction ["MS-2000 On","strobeStart.sqf"];

strobe = false;

detach _irstrobe;
_irstrobe setPosATL [-10000,-10000,100000];
deleteVehicle _irstrobe;

Strobe_Test.utes.zip

Edit: Fixed :D Reason being the actions were local Edited the script I posted in case someone wants to use it. :D

Edited by Semedar

Share this post


Link to post
Share on other sites

Would be nice to have this work during the day time aswell. Somthing like the AC-130 script with the thermal image.

Share this post


Link to post
Share on other sites
Mission Init:

while { strobe } do
{ 
_irstrobe = "NVG_TargetC" createVehicle getpos player;
_irstrobe attachTo [player,[0,0,0.2],"neck"];
Sleep 0.8;
detach _irstrobe;
deleteVehicle _irstrobe;
Sleep 0.1;
};

This is needless. "NVG_TargetC" is blinking by itself.

Share this post


Link to post
Share on other sites

If you want to have this function active only if a player has an IR strobe in their inventory:

Don't add any code to the mission init (or remove it if you've already placed it) - because it will be in the trigger.

Create a trigger with the following parameters:

axis a: 0

axis b: 0

condition: "IRStrobe" in magazines player

On Activation: strobeOn = player addAction ["MS-2000 On","strobeStart.sqf"];

On Deactivation: player removeAction strobeOn;

Edited by nephros

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×