BlackbirdSD 15 Posted November 23, 2019 New to the forum, played since Operation Flashpoint. I want an ammo box to be placed in the jungle with a 100 placement radius(which I know how to do) and have an IR grenade or IR strobe of some sort, be attached to or follow the placement of the ammo box. Im not into scripts yet so preferably in the Init field. Currently I tried placing the ammo box and put the "IR module" next to it and synced it to the box. This works and I see the IR Grenade but once I have a random placement of the ammo box, the IR grenade stays where it is and doesn't move to it. Thanks Share this post Link to post Share on other sites
kcal 6 Posted November 23, 2019 ("O_IRStrobe" createVehicle position this) attachTo [this,[0,0,0]]; Put this on init field of the ammo box. If you want to adjust relative position of IR strobe and ammobox, adjust [0,0,0]. 3 1 Share this post Link to post Share on other sites
BlackbirdSD 15 Posted November 24, 2019 That worked great! So I did the same by adding the strobe to a player and it worked but in my mission I start off as a scuba diver parachuting using this addBackpack "B_Parachute"; this setPos [getPos this select 0, getPos this select 1, 3000] Now the strobe works in freefall but once the chute opens, the strobes get left behind and not sure why. So I thought I will just add a backpack with the strobe, to be manually picked up from the inside the ammo box but how do I get that backpack (with the strobe Init command) inside the ammo crate? Thank you Share this post Link to post Share on other sites
killzone_kid 1333 Posted November 24, 2019 Because this is what happens to attached items when you enter a vehicle (in this case parachute) 1 1 Share this post Link to post Share on other sites
BlackbirdSD 15 Posted November 24, 2019 I just noticed that while getting in and out of a sub. When I said that when the chute opens I lose the strobe, I found out that it only gets lost for the 2 AI parachuters but not me as the player. when I land I still have the strobe but as soon as I enter my sub and get out, its gone. Any suggestions? Can the command line in the Init, be activated by a trigger or radio command to turn it back on after you exit the vehicle? 1 Share this post Link to post Share on other sites
wogz187 1086 Posted November 24, 2019 (edited) @BlackbirdSD, You can paste this function and call into your init.sqf. When player is NOT in a vehicle (including parachute) they will have IFF strobe. Spoiler you_fnc_strobeIFF= { params [["_caller", player]]; if (alive _caller) exitWith { _obj = "NVG_TargetC" createVehicle [0,0,0]; _obj removeMagazine "B_IR_Grenade"; _obj attachTo [_caller, [0,-0.03,0.07], "LeftShoulder"]; waitUntil {!isNull objectParent _caller || !alive _caller}; deleteVehicle _obj; waituntil {isNull objectParent _caller}; [_caller] spawn you_fnc_strobeIFF; }; }; [player] spawn you_fnc_strobeIFF; Will work with AI characters too. Have fun! Edited November 25, 2019 by wogz187 updated script 1 1 Share this post Link to post Share on other sites
BlackbirdSD 15 Posted November 24, 2019 7 hours ago, wogz187 said: @BlackbirdSD, You can paste this function and call into your init.sqf. When player is NOT in a vehicle (including parachute) they will have IFF strobe. Hide contents you_fnc_strobeIFF= { params [["_caller", player]]; if (alive _caller) exitWith { strobe_IFF = "NVG_TargetC" createVehicle [0,0,0]; _caller removeMagazine "B_IR_Grenade"; strobe_IFF attachTo [_caller, [0,-0.03,0.07], "LeftShoulder"]; waitUntil {!isNull objectParent _caller || !alive _caller}; deleteVehicle strobe_IFF; waituntil {isNull objectParent _caller}; [_caller] spawn you_fnc_strobeIFF; }; }; [player] spawn you_fnc_strobeIFF; Will work with AI characters too. Have fun! Thanks for the reply. I will need help with this. I haven't done scripts before. Works great for myself, haven't tried with human players but it doesn't seem to work with the playable AI Do my players need to have a specified name? "you_fnc_strobeIFF=" does this need to be left at "you" I have 3 human players playing my mission. Currently named p1,p2,p3 Thanks Share this post Link to post Share on other sites
wogz187 1086 Posted November 24, 2019 @BlackbirdSD, This is the call, [player] spawn you_fnc_strobeIFF; Anybody who calls the function gets the IR, [anybody] spawn you_fnc_strobeIFF; If it's MP it should probably be something like this, [p1,p2,p3] remoteExec ["spawn you_fnc_strobeIFF"]; but I haven't figured out remoteExec yet so somebody may care to correct me. Have fun! 2 Share this post Link to post Share on other sites
BlackbirdSD 15 Posted November 24, 2019 4 minutes ago, wogz187 said: @BlackbirdSD, This is the call, [player] spawn you_fnc_strobeIFF; Anybody who calls the function gets the IR, [anybody] spawn you_fnc_strobeIFF; If it's MP it should probably be something like this, [p1,p2,p3] remoteExec ["spawn you_fnc_strobeIFF"]; but I haven't figured out remoteExec yet so somebody may care to correct me. Have fun! 1. What do you mean by "This is the call"? 2. Do I just add this "[p1,p2,p3] remoteExec ["spawn you_fnc_strobeIFF"];" at the end of the INIt file? Thanks Share this post Link to post Share on other sites
wogz187 1086 Posted November 24, 2019 @BlackbirdSD, Quote What do you mean by "This is the call"? The call to start the function. Just putting the function in the init doesn't begin it. In this case it's technically a "spawn" not a "call". Try creating an "initPlayerLocal.sqf" file in your mission folder and pasting, Spoiler you_fnc_strobeIFF= { params [["_caller", player]]; if (alive _caller) exitWith { _obj = "NVG_TargetC" createVehicle [0,0,0]; _obj removeMagazine "B_IR_Grenade"; _obj attachTo [_caller, [0,-0.03,0.07], "LeftShoulder"]; waitUntil {!isNull objectParent _caller || !alive _caller}; deleteVehicle _obj; waituntil {isNull objectParent _caller}; [_caller] spawn you_fnc_strobeIFF; }; }; [player] spawn you_fnc_strobeIFF; *updated 1 Share this post Link to post Share on other sites
BlackbirdSD 15 Posted November 25, 2019 1 hour ago, wogz187 said: @BlackbirdSD, The call to start the function. Just putting the function in the init doesn't begin it. In this case it's technically a "spawn" not a "call". Try creating an "initPlayerLocal.sqf" file in your mission folder and pasting, Hide contents you_fnc_strobeIFF= { params [["_caller", player]]; if (alive _caller) exitWith { _obj = "NVG_TargetC" createVehicle [0,0,0]; _obj removeMagazine "B_IR_Grenade"; _obj attachTo [_caller, [0,-0.03,0.07], "LeftShoulder"]; waitUntil {!isNull objectParent _caller || !alive _caller}; deleteVehicle _obj; waituntil {isNull objectParent _caller}; [_caller] spawn you_fnc_strobeIFF; }; }; [player] spawn you_fnc_strobeIFF; *updated I created a file called InitPlayerLocal.sqf and pasted in the above. I setup myself as player another ai in my group as playable and another ai outside my group as playable and only I had the strobe and not the others. Share this post Link to post Share on other sites
wogz187 1086 Posted November 25, 2019 @BlackbirdSD, Quote I created a file called InitPlayerLocal.sqf and pasted in the above. I setup myself as player another ai in my group as playable and another ai outside my group as playable and only I had the strobe and not the others. Good. Okay. So when other players fill those slots they will get IR, I think. To make the two AI have IR-- in init.sqf, [p2] spawn you_fnc_strobeIFF; [p3] spawn you_fnc_strobeIFF; That might be sufficient to get the other players blinking, too-- I really don't know. I'm only scratching the surface of MP myself but now that I think about it you may need to use remoteExec to a) make everybody blink, and b) so everybody can actually see each other blinking. Which would be something like, [p1,p2,p3] remoteExec ["spawn you_fnc_strobeIFF;"]; but I'm not sure. Have fun! 1 Share this post Link to post Share on other sites
BlackbirdSD 15 Posted November 25, 2019 This worked for me and AI. just need to test with friends but im sure it will be ok. To make the two AI have IR-- in init.sqf, [p2] spawn you_fnc_strobeIFF; [p3] spawn you_fnc_strobeIFF; Thanks a lot! 1 Share this post Link to post Share on other sites
stburr91 1011 Posted November 25, 2019 On 11/24/2019 at 12:33 AM, killzone_kid said: Because this is what happens to attached items when you enter a vehicle (in this case parachute) Is there a way to attach an IR strobe to the parachute vehicle once it's deployed? Share this post Link to post Share on other sites
killzone_kid 1333 Posted November 25, 2019 attachto vehicle player? Share this post Link to post Share on other sites
Mr H. 402 Posted November 25, 2019 55 minutes ago, stburr91 said: Is there a way to attach an IR strobe to the parachute vehicle once it's deployed? Yes player addEventHandler ["GetInMan", { params ["_unit", "_role", "_vehicle", "_turret"]; if (_vehicle isKindOf "B_Parachute") then { private _toAttach = "";//classname of strobe effect private _IRG = _toAttach createVehicle (position _vehicle); _IRG attachto [_vehicle, [-0.2,0,0.6]]; }; }]; 3 1 Share this post Link to post Share on other sites
wogz187 1086 Posted June 23, 2020 An event handler is better for the removal of lights from dead units, { IRLight = "NVG_TargetC" createVehicle [0,0,0]; _x removeMagazine "B_IR_Grenade"; IRLight attachTo [_x, [0,-0.03,0.07], "LeftShoulder"]; _x addEventHandler ["Killed", {_lightID= _this select 0; {deleteVehicle _x;} forEach attachedObjects _lightID;}]; } forEach units _grp; Have fun! 1 1 Share this post Link to post Share on other sites
wogz187 1086 Posted June 25, 2020 Here's a more comprehensive solution, (after a bit more testing I found the GetInMan EH only works about 70% of the time... investigating) Spoiler { private _IRLight = "NVG_TargetC" createVehicle [0,0,0]; _IRLight attachTo [_x, [0,-0.03,0.07], "LeftShoulder"]; _x addEventHandler ["Killed", { {deleteVehicle _x} forEach attachedObjects _unit}]; _x addEventHandler ["GetInMan", { {deleteVehicle _x} forEach attachedObjects _vehicle}]; _x addEventHandler ["GetOutMan", { private _IRLight = "NVG_TargetC" createVehicle [0,0,0]; _IRLight attachTo [_unit, [0,-0.03,0.07], "LeftShoulder"]}]; } forEach units _grp; Removes light when boarding vehicles and reapplies upon exit. Units removed by script will leave a light unless attached items are also removed. Have fun! Share this post Link to post Share on other sites
wogz187 1086 Posted October 6, 2020 Fixed it, Spoiler you_fnc_addIR= { params [["_grp", grpnull, [grpNull]]]; { private _IRLight = "NVG_TargetC" createVehicle [0,0,0]; _x setVariable ["you_IRLight", _IRlight]; _IRLight attachTo [_x, [0,-0.03,0.07], "LeftShoulder"]; _x addEventHandler ["Killed", {deleteVehicle ((_this select 0) getVariable ["YOU_IRlight", objNull])}]; _x addEventHandler ["GetInMan", {deleteVehicle ((_this select 0) getVariable ["YOU_IRlight", objNull])}]; _x addEventHandler ["GetOutMan", {private _IRLight = "NVG_TargetC" createVehicle [0,0,0]; (_this select 0) setVariable ["you_IRLight", _IRlight]; _IRLight attachTo [(_this select 0), [0,-0.03,0.07], "LeftShoulder"];}]; } forEach units _grp; }; Paste the function in init.sqf, a unit init, mission init field, etc. Call example (unit init): [group this] call you_fnc_addIR; Or to do what OP asked for, Spoiler null= this spawn { private _IRLight = "NVG_TargetC" createVehicle [0,0,0]; _this setVariable ["you_IRLight", _IRlight]; _IRLight attachTo [_this, [0, 0, 0]]; }; right in the init dialog box of the object. Have fun! 2 Share this post Link to post Share on other sites
thy_ 171 Posted April 25, 2021 Guys, hi. Base on @wogz187 approch: 1) Create a file called "strobHuman.sqf" into your mission folder; 2) Put it in the file: private _IRLight = "NVG_TargetC" createVehicle [0,0,0]; (_this select 0) setVariable ["you_IRLight", _IRlight]; _IRLight attachTo [(_this select 0), [-0.08,-0.35,0.1], "LeftShoulder"]; //attached on the unit backpack. 3) In each INIT unit, insert it: null = [this] execVM "strobHuman.sqf"; OR For ACE users, this is a simple solution that works with units, objects and vehicles without calculation of axis position: Unique step) Just put it in each INIT object that you want to strobed: [this, this, ["ACE_IR_Strobe_Item"],true] remoteExec ["ace_attach_fnc_attach"]; Both solution i have tested 😉 Cheers! Share this post Link to post Share on other sites
wogz187 1086 Posted April 25, 2021 @thy_, Using a script function allows us to skip creating a new .sqf file. Paste the function in init.sqf, in the init field of a unit, object, helper, or directly in the mission init dialog field. Call the function any time with a single line, // in a script [_grp] call you_fnc_addIR; or // in a unit init field [group this] call you_fnc_addIR; This iterates through each unit in the group. The event handlers are necessary. Otherwise units will leave their IR beacon behind when boarding vehicles or upon death. To remove the lights, { deleteVehicle (_x getVariable ["you_IRlight", objNull]) } forEach units _grp Have fun! 2 Share this post Link to post Share on other sites
thy_ 171 Posted May 4, 2021 @wogz187 and everyone, hello. I've tried your solution and something is getting wrong here (but without error message): 1) In init.sqf file: 2) Then I've added the call into the group lead. When I ran it, there's no IR strobe on in-game, only darkness instead. No clue what is happening and some help where, will be very much appreciated. Share this post Link to post Share on other sites
wogz187 1086 Posted May 4, 2021 @thy_, I checked by copying and pasting the script above (my post) into an open scenario and it worked as expected.You can check by pasting the function into the unit's init along with the call. It does not have to be the leader of the group. Or call it on your player character from the debug menu! Have fun! Share this post Link to post Share on other sites
thy_ 171 Posted May 4, 2021 1 hour ago, wogz187 said: @thy_, I checked by copying and pasting the script above (my post) into an open scenario and it worked as expected.You can check by pasting the function into the unit's init along with the call. It does not have to be the leader of the group. Or call it on your player character from the debug menu! Have fun! @wogz187 Me too. Take a look in here: https://drive.google.com/file/d/15m5YUETgAJN3rp_5H3ELT3vmJ8nVmdQ1/view?usp=sharing Not sure what I'm doing wrong. If you put some light would be brilhant. Share this post Link to post Share on other sites
thy_ 171 Posted May 16, 2021 Regarding the example (link above), any idea why that is not working as expected? Share this post Link to post Share on other sites