10t 12 Posted December 4, 2013 (edited) Hi all, I'm trying to put a placed demo charge into a container (a static object which I can then carry on the player, using an attachTo - not a weaponContainer). I can get it attached, but once I attach it to the container, the "Touch off 1 bomb(s)" option won't set it off. The following works: - function checks if a democharge ("DemoCharge_Remote_Ammo") is nearby - function attaches nearest democharge to the container (satFONE, in this case) with the required offset More stuff: - If I try and use the "Touch off" action, the action disappears (as though it worked). - If I place two charges, the action shows "Touch off 2 bomb(s)" and I can detonate the unattached one. The "Touch off" action then disappears. - I can disarm the explosive. It then returns to its disarmed state and I can pick it up and re-deploy it. - I know there are some great "stick explosives on anything" scripts out there already. I'm not using them because I swap the Satellite Phone with a Suitcase (normally at [0,0,0]) when the player picks it up. As part of that swap it attaches the Demo Charge to the suitcase/sat phone as required. - If I attach the satellite phone to the bomb it works fine, but then when I pick up the phone the bomb is left behind. I'm open to another way of doing things if it'll let me use an existing, working script (like keep the sat phone object the same and change the model, or something - but I don't have any idea how to do that or if it's even possible). Ideally I'd be able to place the Demo Charge, set the timer (desired, but not requried), place it in the sat phone, "close" the phone, have the timer run out and detonate OR Touch off the bomb and detonate it. Any ideas? The script that adds the actions to the container (just the relevant bit - the other parts are the pickup/drop and open/close bits). I know there are too many global variables, but I was having "undefined variable" errors so I've dropped back to this for now. explCharge = objNull; action_setChargeFone = satFONE addAction ["Set Charge", { if (!isNull explCharge) then { hint "Explosives already set!"; } else { _explCharge = [satFONE, [0,0,-0.15]] call ZAK_fnc_setChargeInObj; if (!isNull explCharge) then { hint format ["Expl Charge set: %1", explCharge]; // this is just a debug hint - ###TODO: remove }; explCharge = _explCharge; }; }]; And the put-DemoCharge-in-object function: // 10T_fnc_setChargeInObj.sqf private ["_receptacle","_offset", "_explCharge"]; _receptacle = [_this, 0, objNull, [objNull]] call BIS_fnc_param; _offset = [_this, 0, objNull, [objNull]] call BIS_fnc_param; _explCharge = objNull; _listOfBombs = (player nearObjects ["DemoCharge_Remote_Ammo", 2]); if ((count _listOfBombs) > 0) then { _explCharge = (nearestObject [player, "DemoCharge_Remote_Ammo"]); _explCharge attachTo [satFONE, [0,0,-0.15]]; //_explCharge enableSimulation; hint format ["RC: %1\nOS: %2\n Expl: %3", _receptacle, _offset, _explCharge]; // this is just a debug hint - ###TODO: remove } else { hint "Looking for Demo Charge...\nNo explosives placed nearby!"; }; _explCharge Edited December 4, 2013 by 10T Added line about attaching satFONE to explCharge Share this post Link to post Share on other sites
f2k sel 164 Posted December 4, 2013 How about this, I was using it last night to move a live charge and it seems to work. I never tested inside an object. If you need to move it a little less than 300 meters or you won't have the option to Touch it off. _explCharge setpos (satFONE modeltoworld [0,0,0]); Share this post Link to post Share on other sites
10t 12 Posted December 5, 2013 F2k Sel I'm away from my machine right now, so I can't check. I'm sure that would work to initially place the charge at the case, but when the case is carried around later, the charge will be left behind, right? I'm keen to avoid doing something like looping a script that updates the charge position every frame, since it'll be used in MP and I'd like to avoid wacky issues and any unnecessary network messages. I did make some progress by switching positions of the charge and case, and then attaching the case to the explosive (instead of the other way around). Now the pickup script checks whether a charge has been placed (if (!isNull explCharge) then...) and if so, it attaches explCharge to the player instead. The case is attached to the charge, so it follows. All good, except now - with the DemoCharge attached - my player walk/run animation doesn't play any more. The character is just hovering 1mm above the ground and scooting everywhere like a dalek or a single-frame sprite from a game from the 1980s. Is that a known issue, or have I just messed something up? Share this post Link to post Share on other sites
f2k sel 164 Posted December 5, 2013 (edited) You have another issue, you can't attach things to the laptop. When you use the attachto command it will move the object to the lap top but it's not attached. If the object is correctly attached the object will still explode when it's set off, it only fails when attachto fails. Attachto worked much better in A2/OA , you could still detonate an attached charge and it seems to attach to more objects. Your going to have to fake it. Edited December 5, 2013 by F2k Sel Share this post Link to post Share on other sites