dlegion 98 Posted March 23, 2017 hi all ! i was searching for a script that has the same effects as ACE3 explosives (i no longer use ACE3 because i want to keep it compatible with vanilla), and i found two great scripts, 3D explosives by Zorilya http://www.armaholic.com/page.php?id=22059 SMS explosives by Voiper http://www.armaholic.com/page.php?id=28266 now....both have theyr strenght and weakness, like 3D explosives miss the feature to detonate a specific charge and not all togheter, while SMS has this feature, but lack a good placement system (cannot stick to vertical surfaces, cannot move mines in water ecc...) my question is this: anyone knows a vanilla compatible script/addon that has all this working? in case of a "no" .... i already tried to merge both, and was successful, but due to my lack of script ability, i'm actually placing 2 mines at once, one for each script, and i need a simple line to not drop the second mine if there are less than 2 in inventory! can somepne help me ? thanks ! Share this post Link to post Share on other sites
dlegion 98 Posted March 24, 2017 ...or another (better) solution would be make the SMS script run on his own action (added with addaction), can anyone help please? Share this post Link to post Share on other sites
kauppapekka 27 Posted March 27, 2017 Don't know how either one of those work and not keen on downloading them to find out, but here's a script to detonate a single explosive at a time (as it seemed smaller task to do): Spoiler //Some event handlers are persistent (i.e. they stay attached to a unit, even after it dies and respawns) so if you got a respawn you need to find out yourself if the eventhandler stays active player addEventHandler ["fired", { if (_this select 4 in ["DemoCharge_Remote_Ammo", "SatchelCharge_Remote_Ammo", "ClaymoreDirectionalMine_Remote_Ammo", "IEDUrbanSmall_Remote_Ammo", "IEDLandSmall_Remote_Ammo", "IEDUrbanBig_Remote_Ammo", "IEDLandBig_Remote_Ammo"]) then { private ["_actionID"]; _actionID = player addAction [ "Detonate " + getText (configfile >> "CfgMagazines" >> _this select 5 >> "displayName") + " [" + mapGridPosition (_this select 6) + "]", {_this select 3 setDamage 1}, _this select 6 ]; [_this select 6, _actionID] spawn { waitUntil {sleep 0.5; !alive (_this select 0) || !alive player}; if (alive player) then { player removeAction (_this select 1); }; }; }; } ]; Now if the 3D explosives uses the vanilla way to place an explosive then placing this code into initPlayerLocal.sqf should do the job. But if it just creates one with createMine you need to edit the script. Also there's no range check on this unlike the basic Touch off action. Share this post Link to post Share on other sites
dlegion 98 Posted March 28, 2017 Huge thanks man !! Gonna try it as soon as i get back from work ! Thanks !! Share this post Link to post Share on other sites
dlegion 98 Posted April 6, 2017 yeeah it works perfectly in SP ! tonight will test it on dedicated! huge thanks man !! Share this post Link to post Share on other sites
dlegion 98 Posted April 7, 2017 Works on dedicated too !! Really thanks man, awesome script, you re great !!! Share this post Link to post Share on other sites
dlegion 98 Posted April 16, 2017 hello again! i really wish to merge this awesome simple and efficient script of Kauppapekka into stealthstick's EtV script (so i can finally attach a charge and detonate just the one needed !). i think the relevant part is where is the "attachTo", here is the code of this part: Spoiler EtV_AttachCharge = { _array = _this select 3; _charge = _array select 0; _unit = _array select 1; private "_class"; _unit removeMagazine _charge; _unit playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; switch _charge do { case "DemoCharge_Remote_Mag": { _class = "DemoCharge_Remote_Ammo"; // D type of charge ... wish to add SatchelCharge_Remote_Ammo }; case "SatchelCharge_Remote_Mag": { _class = "SatchelCharge_Remote_Ammo"; // D type of charge ... tried to add SatchelCharge_Remote_Ammo }; }; // _nearVehicle = (nearestObjects [_unit,["Air","Ship","LandVehicle"],5]) select 0; _nearVehicle = cursorobject; // D added _explosive = _class createVehicle [0,0,0]; _explosive attachTo [_unit,[0,0.3,0],"leftHand"]; // D spawn charge distance to left hand _random0 = random 180; _random1 = random 180; [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank; [_explosive,_nearVehicle,_unit,_random0,_random1] spawn { _explosive = _this select 0; _nearVehicle = _this select 1; _unit = _this select 2; _random0 = _this select 3; _random1 = _this select 4; sleep 1.5; _explosive attachTo [_nearVehicle]; [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank; _unit setVariable ["charges",(_unit getVariable ["charges",[]]) + [_explosive]]; [_explosive,_unit] spawn EtV_TimedCharge; }; }; in case you need the full script, i paste it here : Spoiler /* Stealthstick's "Explosive-To-Vehicle" Script -Allows players to attach their explosive charges to any vehicle. EDITED BY DLEGION TO ATTACH TO EVERYTHING, MULTIPLE CHARGES (added satchels ecc),BETTER EXPLOSION (specific to charge) /////////////////////////////////////////////////////////////////////// ///DETONATE SPECIFIC CHARGE //Some event handlers are persistent (i.e. they stay attached to a unit, even after it dies and respawns) so if you got a respawn you need to find out yourself if the eventhandler stays active player addEventHandler ["fired", { if (_this select 4 in ["DemoCharge_Remote_Ammo", "SatchelCharge_Remote_Ammo", "ClaymoreDirectionalMine_Remote_Ammo", "IEDUrbanSmall_Remote_Ammo", "IEDLandSmall_Remote_Ammo", "IEDUrbanBig_Remote_Ammo", "IEDLandBig_Remote_Ammo"]) then { private ["_actionID"]; _actionID = player addAction [ "Detonate " + getText (configfile >> "CfgMagazines" >> _this select 5 >> "displayName") + " [" + mapGridPosition (_this select 6) + "]", {_this select 3 setDamage 1}, _this select 6 ]; [_this select 6, _actionID] spawn { waitUntil {sleep 0.5; !alive (_this select 0) || !alive player}; if (alive player) then { player removeAction (_this select 1); }; }; }; } ]; //////////////////////////////////////////////////////////////////////// */ EtV_ChargeCheck = { _charge = _this select 0; _unit = _this select 1; _hasIt = _charge in (magazines _unit); // _nearVehs = nearestObjects [_unit,["Air","Ship","LandVehicle"],5]; // D changed targeting system // _return = (_hasIt && count _nearVehs > 0 && alive _unit); _nearVehs = cursorobject; _return = (_hasIt && _unit distance _nearVehs <8 && alive _unit); // D distance 1 of 2 (8 minumum for biggest vehicle) _return }; EtV_TouchOff = { _array = _this select 3; _unit = _array select 0; _explosives = _unit getVariable ["charges",[]]; { if(alive _x) then { // "BO_GBU12_LGB" createVehicle (position _x); // D ...was HelicopterExploSmall // deleteVehicle _x; _x setDamage 1; // D set so now really explode the charge and not create a fake explosion }; } forEach _explosives; _unit setVariable ["charges",[]]; }; EtV_UnitCheck = { private "_return"; _unit = _this select 0; _explosives = _unit getVariable ["charges",[]]; if(count _explosives > 0) then { _return = true; } else { _return = false; }; _return }; EtV_TimedCharge = { _explosive = _this select 0; _unit = _this select 1; // _illogic = group server createUnit ["logic", Position _explosive, [], 0, "FORM"]; // to comment? // // _illogic attachTo [_explosive]; while {alive _explosive} do { waitUntil {!isNil {_illogic getVariable "timer"};}; if(_illogic getVariable "timer" == 0) exitWith { _charges = _unit getVariable ["charges",[]]; _unit setVariable ["charges",_charges - [_explosive]]; // "BO_GBU12_LGB" createVehicle (position _explosive); // D edited // deleteVehicle _explosive; _explosive setDamage 1; }; sleep 1; _oldTime = _illogic getVariable "timer"; _illogic setVariable ["timer",_oldTime - 1]; }; }; EtV_AttachCharge = { _array = _this select 3; _charge = _array select 0; _unit = _array select 1; private "_class"; _unit removeMagazine _charge; _unit playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; switch _charge do { case "DemoCharge_Remote_Mag": { _class = "DemoCharge_Remote_Ammo"; // D type of charge ... wish to add SatchelCharge_Remote_Ammo }; case "SatchelCharge_Remote_Mag": { _class = "SatchelCharge_Remote_Ammo"; // D type of charge ... tried to add SatchelCharge_Remote_Ammo }; }; // _nearVehicle = (nearestObjects [_unit,["Air","Ship","LandVehicle"],5]) select 0; _nearVehicle = cursorobject; // D added _explosive = _class createVehicle [0,0,0]; _explosive attachTo [_unit,[0,0.3,0],"leftHand"]; // D spawn charge distance to left hand _random0 = random 180; _random1 = random 180; [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank; [_explosive,_nearVehicle,_unit,_random0,_random1] spawn { _explosive = _this select 0; _nearVehicle = _this select 1; _unit = _this select 2; _random0 = _this select 3; _random1 = _this select 4; sleep 1.5; _explosive attachTo [_nearVehicle]; [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank; _unit setVariable ["charges",(_unit getVariable ["charges",[]]) + [_explosive]]; [_explosive,_unit] spawn EtV_TimedCharge; }; }; EtV_ClosestExplosive = { _unit = _this select 0; _charges = _unit getVariable ["charges",[]]; _newArray = []; {_newArray = _newArray + [player distance _x];} forEach _charges; _closest = _newArray call BIS_fnc_lowestNum; _selection = _newArray find _closest; _charge = _charges select _selection; _charge }; EtV_Timer = { private "_explosive"; _array = _this select 3; _unit = _array select 0; _explosive = [_unit] call EtV_ClosestExplosive; _illogic = (nearestObjects [_explosive,["Logic"],50]) select 0; if(!isNil "_illogic") then { _oldTime = _illogic getVariable ["timer",0]; _illogic setVariable ["timer",_oldTime + 30]; _newTime = _illogic getVariable "timer"; hint format ["Explosive timer set to %1 seconds.",_newTime]; }; }; EtV_UnitCheckTimer = { private "_return"; _unit = _this select 0; _explosives = _unit getVariable ["charges",[]]; _return = false; {if(_unit distance _x <= 8) exitWith {_return = true;};} forEach _explosives; // D distance for action _return }; //[unit] spawn EtV_Actions; EtV_Actions = { private ["_unit"]; _unit = _this select 0; _unit addAction ["<t color=""#FFE496"">" +"Attach Explosive Charge", EtV_AttachCharge, ["DemoCharge_Remote_Mag",_unit], 1, false, true, "","['DemoCharge_Remote_Mag',_target] call EtV_ChargeCheck"]; _unit addAction ["<t color=""#FFE496"">" +"Attach Explosive Satchel", EtV_AttachCharge, ["SatchelCharge_Remote_Mag",_unit], 1, true, true, "","['SatchelCharge_Remote_Mag',_target] call EtV_ChargeCheck"]; // D added _unit addAction ["<t color=""#FFE496"">" +"Touch-Off Explosives", EtV_TouchOff, [_unit], 1, true, true, "","[_target] call EtV_UnitCheck"]; _unit addAction ["<t color=""#FFE496"">" +"+30Secs to Timer", EtV_Timer, [_unit], 1, true, true, "","[_target] call EtV_UnitCheckTimer"]; }; //======================= EtVInitialized = true; really thanks for the help, fixing this its like the end of a many-years-long nightmare for me :) Share this post Link to post Share on other sites
kauppapekka 27 Posted April 20, 2017 (edited) I guess this should do it if you replace the spawn part with this spawn. Spoiler EtV_AttachCharge = ... ... ... [_explosive,_nearVehicle,_unit,_random0,_random1, _charge] spawn { _explosive = _this select 0; _nearVehicle = _this select 1; _unit = _this select 2; _random0 = _this select 3; _random1 = _this select 4; _charge = _this select 5; sleep 1.5; _explosive attachTo [_nearVehicle]; [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank; //_unit setVariable ["charges",(_unit getVariable ["charges",[]]) + [_explosive]]; //[_explosive,_unit] spawn EtV_TimedCharge; private ["_actionID"]; _actionID = _unit addAction [ "Detonate " + getText (configfile >> "CfgMagazines" >> _charge >> "displayName") + " [" + getText (configfile >> "CfgVehicles" >> typeOf _nearVehicle >> "displayName") + "]", {_this select 3 setDamage 1}, _explosive ]; [_explosive, _unit, _actionID] spawn { waitUntil {sleep 0.5; !alive (_this select 0) || !alive (_this select 1)}; if (alive (_this select 1)) then { _this select 1 removeAction (_this select 2); }; }; }; Edited April 20, 2017 by kauppapekka Pointless line in the script Share this post Link to post Share on other sites
dlegion 98 Posted April 20, 2017 HUGE thanks man ! tested, it works perfectly ! really, really THANKS ! Share this post Link to post Share on other sites
dlegion 98 Posted May 2, 2017 hi all ! after accurate testing, i found 2 very hidden little problems : 1) the script offer to attach an explosive to a "simple map object" (like a tree in the map) , but trying to do it the result is that explosives get attached to your own left hand. 2) when attaching to an editor placed "simple object" , or to an object with "enableSimulation FALSE" , it let it to attach, but when you try to detonate, it does not. can someone understand whats wrong there ? thanks !!!!! PS: ( i wish to make it so it get attached to anything i'm pointing with cursor, and able to detonate it be it simple object or not ) Share this post Link to post Share on other sites
dlegion 98 Posted May 2, 2017 i found a possible explanation for the not detonating problem here:https://community.bistudio.com/wiki/attachTo seems it have to be detached before setdamage 1 command ! Share this post Link to post Share on other sites
dlegion 98 Posted May 3, 2017 I noticed that the objects that allow attach actions, but dont actually attach explosive to, are nameless. Like trees, bushes ecc... Maybe thats related ? Any way to attach something to a nameless object ? Share this post Link to post Share on other sites
kauppapekka 27 Posted May 3, 2017 Yup attachTo doesn't seem to want to work with them map objects. One way would be to just place the object with the setPos commands and get the position you want with modelToWorld or lineIntersect, as it doesn't really need to be attached as the stuff won't move around. Also might want to take this part away from the script if you're placing stuff on other than vehicles: + " [" + getText (configfile >> "CfgVehicles" >> typeOf _nearVehicle >> "displayName") + "]" Share this post Link to post Share on other sites
dlegion 98 Posted May 3, 2017 Awesome !! Hem...im sorry to have to disturb you....but i need your help with code for this ! I wish to keep compatibility with vehicles and "displayName " if possible ! Really thanks for you help man really appreciated !!! ------------- E D I T ------------ well i was thinking, if its possible to discriminate the two situations, so can be used as it is for everything, but for a map object can be used a different system, and i found this:https://community.bistudio.com/wiki/attachedTo seems it returns the object , so a kind of check: IF AttachedTo ObjNull THEN .... setpos (getpos player lefthand) or something like it. the real point is being able to use this for example from underwater, where you try to attach a mine to an object and dont want it to fall, a situation that normal game dont let you place a mine at all in water, and even if placed will probably fall to the sea bottom! really thanks for any help !! Share this post Link to post Share on other sites
kauppapekka 27 Posted May 4, 2017 [_explosive,_nearVehicle,_unit,_random0,_random1, _charge] spawn { _explosive = _this select 0; _nearVehicle = _this select 1; _unit = _this select 2; _random0 = _this select 3; _random1 = _this select 4; _charge = _this select 5; sleep 1.5; _explosive attachTo [_nearVehicle]; sleep 0.1; if (!(isNull attachedTo _explosive) && {!(isNull _nearVehicle)}) then { _explosive setPosWorld getPosWorld _nearVehicle; }; [_explosive,_random0,_random1] call BIS_fnc_SetPitchBank; //_unit setVariable ["charges",(_unit getVariable ["charges",[]]) + [_explosive]]; //[_explosive,_unit] spawn EtV_TimedCharge; private ["_actionID"]; _actionID = 0; if (_nearVehicle isKindOf "LandVehicle" || _nearVehicle isKindOf "Air" || _nearVehicle isKindOf "Ship") then { _actionID = _unit addAction [ "Detonate " + getText (configfile >> "CfgMagazines" >> _charge >> "displayName") + " [" + getText (configfile >> "CfgVehicles" >> typeOf _nearVehicle >> "displayName") + "]", {_this select 3 setDamage 1}, _explosive ]; } else { _actionID = _unit addAction [ "Detonate " + getText (configfile >> "CfgMagazines" >> _charge >> "displayName") + " [" + mapGridPosition _explosive + "]", {_this select 3 setDamage 1}, _explosive ]; }; [_explosive, _unit, _actionID] spawn { waitUntil {sleep 0.5; !alive (_this select 0) || !alive (_this select 1)}; if (alive (_this select 1)) then { _this select 1 removeAction (_this select 2); }; }; }; Share this post Link to post Share on other sites
dlegion 98 Posted May 4, 2017 man.... really i wish to thank you somehow ! you're my personal explosives hero !! H U G E THANKS !!!!!!!!! Share this post Link to post Share on other sites
omri2050 197 Posted October 29, 2017 Hey guys Sorry for the stupid question... I think this script is the solution to my problem But i don't hav e a clue where i need to paste this script or what to do with it in this form... Can you please tell me where to paste it and if i need to make sure that i have additional files to make it work? Thanks a lot!!! Share this post Link to post Share on other sites