PSYKO_nz 44 Posted March 17, 2014 hi there im half way through an underwater mission where the objective is to steal some sdv's, sneak into a harbour and then blow up 4 trawlers (mine layers in disguise, dastardly opfor trick!!) how ever I cant attach anything to the trawlers or the ground underneath them (underwater) also the buggers don't seam to take damage! ive used everything I can think of and nothing is denting the boats does anybody out there have any idea how to resolve these issues?? sinkable ships and underwater satchel placement? (what's the point of being an underwater demo expert if you cant do underwater demo!?) any help is greatly appreciated thanks in advance Share this post Link to post Share on other sites
cobra4v320 27 Posted March 17, 2014 (edited) There was a video I saw recently of a trawler listing to one side and everything falling off and sinking you will have to search for it. It was very well done. Here is my ghetto fabulous version: COB_BOAT enableSimulation false; _count = 0; while {true} do { _count = _count - 0.1; COB_BOAT setPos [(getPos COB_BOAT select 0),(getPos COB_BOAT select 1),_count]; if ((position COB_BOAT select 2) < -20) exitWith {true}; sleep 1; }; ---------- Post added at 17:12 ---------- Previous post was at 16:48 ---------- I dont think this mod was ever released. ---------- Post added at 17:17 ---------- Previous post was at 17:12 ---------- Found the ship video which also happens to be by Feint Edited March 17, 2014 by cobra4v320 Share this post Link to post Share on other sites
PSYKO_nz 44 Posted March 18, 2014 cheers bro ill give it a try, it goes in the unit init or in a sqf? ---------- Post added at 02:22 PM ---------- Previous post was at 02:11 PM ---------- found the video here Share this post Link to post Share on other sites
Magirot 14 Posted April 6, 2014 (edited) Huh. A day of scratching my head with setVectorDirAndUp loops, and now I learn from the video that all you need in Arma 3 to sink the trawler is something on these lines: trawler1 [url=https://community.bistudio.com/wiki/setCenterOfMass]setCenterOfMass[/url] [[-1.8, -6.5, -4.5], 60]; trawler1 [url=https://community.bistudio.com/wiki/setMass]setMass[/url] [5000000, 60]; That's pretty handy. I made a more complicated script which tries to account for faster sinking after the water reaches the deck. Also has some options for customisation. I'm not perfectly happy with it, but maybe someone finds it useful, or can suggest improvements / tweak it: /* Script for sinking a trawler. Save as sinkship.sqf or whatever you prefer. Call with: [shipname, sinkside (optional), seconds to sink (optional), smoke TRUE/FALSE (optional)] execVM "sinkship.sqf"; Or simply: shipname execVM "sinkship.sqf" Possible sinksides: "LEFT", "RIGHT", "LEFT FRONT", "RIGHT FRONT", "LEFT BACK", "RIGHT BACK", "RANDOM" If sinking time is 0, it will be randomised between 60 seconds and 180 seconds On default the sinkside is "LEFT BACK", sinking time 2 minutes, smoke emitter TRUE. Example: _null = [trawler1, "LEFT FRONT", 90] execVM "sinkship.sqf"; */ // Declare private variables private ["_ship", "_sinktime", "_sinkside", "_smokeloc", "_smoke_e", "_smoke", "_x", "_y", "_z", "_x1", "_y1", "_x2", "_y2", "_x3", "_y3", "_z1", "_z2", "_z3"]; // Fetch and validate the parameters _ship = [_this, 0, objNull] call BIS_fnc_param; _sinkside = [_this, 1, "LEFT BACK"] call BIS_fnc_param; _sinktime = [_this, 2, 120] call BIS_fnc_param; _smoke = [_this, 3, TRUE] call BIS_fnc_param; // Although it would be nice to implement damage to multiple locations, not today if ( _ship getVariable ["ShipIsSinking", FALSE] ) exitWith {}; _ship setVariable ["ShipIsSinking", TRUE, TRUE]; // If _sinktime is 0, randomise the time between 1-3 minutes. if (_sinktime == 0) then { _sinktime = 60 + random 120 }; // Get the default CenterOfMass of the trawler (which is [-0.17766, -1.72015, -8.49908]) _x = getCenterOfMass _ship select 0; _y = getCenterOfMass _ship select 1; _z = getCenterOfMass _ship select 2; // Z values for sinking are the same for all sides _z1 = _z + 1.0; _z2 = _z + 4.0; _z3 = _z + 8.5; _smokeloc = [0, 0, -6]; // Convert the string in _sinkside to upper case _sinkside = toUpper (_sinkside); // If _sinkside is "RANDOM", choose a random side from the array if (_sinkside == "RANDOM") then { _sinkside = ["LEFT", "RIGHT", "LEFT FRONT", "RIGHT FRONT", "LEFT BACK", "RIGHT BACK"] call BIS_fnc_selectRandom; }; // Declare the variables for setCenterOfMass switch (_sinkside) do { case "LEFT": { _x1 = _x - 1.0; _y1 = _y; _x2 = _x - 1.7; _y2 = _y - 2.5; _x3 = _x - 1.7; _y3 = _y; _smokeloc = [-3, 0, -6]; }; case "RIGHT": { _x1 = _x + 1.0; _y1 = _y; _x2 = _x + 1.7; _y2 = _y - 2.5; _x3 = _x + 1.7; _y3 = _y; _smokeloc = [3, 0, -6]; }; case "LEFT FRONT": { _x1 = _x - 0.6; _y1 = _y + 3.0; _x2 = _x - 1.5; _y2 = _y + 5.0; _x3 = _x - 1.7; _y3 = _y; _smokeloc = [-3, 8, -6]; }; case "RIGHT FRONT": { _x1 = _x + 0.6; _y1 = _y + 3.0; _x2 = _x + 1.5; _y2 = _y + 5.0; _x3 = _x + 1.7; _y3 = _y; _smokeloc = [3, 8, -6]; }; case "LEFT BACK": { _x1 = _x - 0.4; _y1 = _y - 2.5; _x2 = _x - 1.5; _y2 = _y - 5.0; _x3 = _x - 1.7; _y3 = _y; _smokeloc = [-3, -8, -6]; }; case "RIGHT BACK": { _x1 = _x + 0.4; _y1 = _y - 2.5; _x2 = _x + 1.5; _y2 = _y - 5.0; _x3 = _x + 1.7; _y3 = _y; _smokeloc = [3, -8, -6]; }; }; // Actual effect stuff begins here // Create the smoke emitter if (_smoke) then { _smoke_e = "#particlesource" createVehicle getPosATL _ship; _smoke_e setParticleClass "BigDestructionSmoke"; _smoke_e attachTo [_ship, _smokeloc]; }; sleep 2; // Slight tilt _ship setCenterOfMass [[_x1, _y1, _z1], _sinktime * 0.33]; _ship setMass [ 1500000, _sinktime * 0.33]; // Normal mass of the trawler is around 1 270 000. sleep (_sinktime * 0.33 + 0.5); // Water reaches the deck, fire extinguished, tilt and mass increasing if (_smoke) then { _smoke_e spawn { sleep 3; deleteVehicle _this } }; // Delete the smoke emitter after a few seconds. _ship setCenterOfMass [[_x2, _y2, _z2], _sinktime * 0.66]; _ship setMass [ 3300000, _sinktime * 0.66]; sleep (_sinktime * 0.66 + 0.5); // Make sure the ship sinks to the bottom instead of hanging halfway through. _ship setCenterOfMass [[_x3, _y3, _z3], _sinktime]; _ship setMass [ 7000000, _sinktime]; // Required mass depends on depth. // Wait until the ship has reached the bottom, then // disable simulation to save on performance. waitUntil { getPosATL _ship select 2 < 7 }; sleep 20; _ship enableSimulation FALSE; TRUE Here's it in action: I used this as the addAction script: private ["_target", "_unit", "_id", "_magaz", "_sinkside", "_attachpos", "_uy", "_relativedir", "_democharge"]; _target = _this select 0; _unit = _this select 1; _id = _this select 2; _magaz = magazines _unit; if(!("DemoCharge_Remote_Mag" in _magaz)) then { hint "You have no charges to place"; } else { hint "Bomb planted with a two minute timer."; _unit removeMagazine "DemoCharge_Remote_Mag"; _target removeAction _id; _relativedir = [_target, _unit] call BIS_fnc_relativeDirTo; _sinkside = "RANDOM"; _attachpos = [0, 0, 0]; _uy = -1; if (_relativedir <= 359 && _relativedir >= 274) then { _sinkside = "LEFT FRONT"; _attachpos = [-4.42, 8, -6]; _uy = -1 }; if (_relativedir >= 0 && _relativedir <= 94) then { _sinkside = "RIGHT FRONT"; _attachpos = [ 4.42, 8, -6]; _uy = 1 }; if (_relativedir >= 229 && _relativedir <= 273) then { _sinkside = "LEFT"; _attachpos = [-4.75, -2, -6]; _uy = -1 }; if (_relativedir >= 95 && _relativedir <= 139) then { _sinkside = "RIGHT"; _attachpos = [ 4.42, -2, -6]; _uy = 1 }; if (_relativedir <= 228 && _relativedir >= 185) then { _sinkside = "LEFT BACK"; _attachpos = [-4.75, -9, -6]; _uy = -1 }; if (_relativedir >= 140 && _relativedir <= 186) then { _sinkside = "RIGHT BACK"; _attachpos = [ 4.42, -9, -6]; _uy = 1 }; _democharge = "DemoCharge_Remote_Ammo_Scripted" createVehicle getPosATL _target; _democharge attachTo [_target, _attachpos]; _democharge setVectorDirAndUp [[0, 1, 0], [_uy, 1, 0]]; sleep 120; if (!isNull _democharge) then { _democharge setDamage 1; sleep 1; // only call for the client where the ship is local [[[_target, _sinkside], { [_this select 0, _this select 1] execVM "sinkship.sqf" } ], "BIS_fnc_spawn", _target] spawn BIS_fnc_MP; } }; Edited April 6, 2014 by Magirot Used correct direction check function and switched to BIS_fnc_MP in the addAction script 2 Share this post Link to post Share on other sites
cobra4v320 27 Posted April 6, 2014 Very nice Magirot! Share this post Link to post Share on other sites
Von Quest 1163 Posted April 6, 2014 Yeah, fantastic stuff! :bounce3: Share this post Link to post Share on other sites
Grumpy Old Man 3547 Posted April 6, 2014 This is incredible, never thought something like this could be possible. I wonder if BI will ever focus on implementing physx for soldiers and smaller objects or improve the current implementation, seeing what's possible in the current state wants you beg for more. Share this post Link to post Share on other sites
kremator 1065 Posted April 6, 2014 This is fantastic work. If there was a way to find out where the damage occurred you could sink the ship from that side. So if a missile impacts on the trawlers front, the front sinks etc. Not sure how easy it is to get that information. Share this post Link to post Share on other sites
Grumpy Old Man 3547 Posted April 6, 2014 This is fantastic work. If there was a way to find out where the damage occurred you could sink the ship from that side. So if a missile impacts on the trawlers front, the front sinks etc. Not sure how easy it is to get that information. This should be easy to implement with BIS_fnc_relativeDirTo Just scan for a placed satchel, call the function with the satchel and trawler as parameters and you got the relative direction where the satchel was placed. Share this post Link to post Share on other sites
IndeedPete 1038 Posted April 6, 2014 Huh. A day of scratching my head with setVectorDirAndUp loops, and now I learn from the video that all you need in Arma 3 to sink the trawler is something on these lines: trawler1 [url=https://community.bistudio.com/wiki/setCenterOfMass]setCenterOfMass[/url] [[-1.8, -6.5, -4.5], 60]; trawler1 [url=https://community.bistudio.com/wiki/setMass]setMass[/url] [5000000, 60]; That's pretty handy. I made a more complicated script which tries to account for faster sinking after the water reaches the deck. Also has some options for customisation. I'm not perfectly happy with it, but maybe someone finds it useful, or can suggest improvements / tweak it: /* Script for sinking a trawler. Save as sinkship.sqf or whatever you prefer. Call with: [shipname, sinkside (optional), seconds to sink (optional), smoke TRUE/FALSE (optional)] execVM "sinkship.sqf"; Or simply: shipname execVM "sinkship.sqf" Possible sinksides: "LEFT", "RIGHT", "LEFT FRONT", "RIGHT FRONT", "LEFT BACK", "RIGHT BACK", "RANDOM" If sinking time is 0, it will be randomised between 60 seconds and 180 seconds On default the sinkside is "LEFT BACK", sinking time 2 minutes, smoke emitter TRUE. Example: _null = [trawler1, "LEFT FRONT", 90] execVM "sinkship.sqf"; */ // Declare private variables private ["_ship", "_sinktime", "_sinkside", "_smokeloc", "_smoke_e", "_smoke", "_x", "_y", "_z", "_x1", "_y1", "_x2", "_y2", "_x3", "_y3", "_z1", "_z2", "_z3"]; // Fetch and validate the parameters _ship = [_this, 0, objNull] call BIS_fnc_param; _sinkside = [_this, 1, "LEFT BACK"] call BIS_fnc_param; _sinktime = [_this, 2, 120] call BIS_fnc_param; _smoke = [_this, 3, TRUE] call BIS_fnc_param; // Although it would be nice to implement damage to multiple locations, not today if ( _ship getVariable ["ShipIsSinking", FALSE] ) exitWith {}; _ship setVariable ["ShipIsSinking", TRUE]; // If _sinktime is 0, randomise the time between 1-3 minutes. if (_sinktime == 0) then { _sinktime = 60 + random 120 }; // Get the default CenterOfMass of the trawler (which is [-0.17766, -1.72015, -8.49908]) _x = getCenterOfMass _ship select 0; _y = getCenterOfMass _ship select 1; _z = getCenterOfMass _ship select 2; // Z values for sinking are the same for all sides _z1 = _z + 1.0; _z2 = _z + 4.0; _z3 = _z + 8.5; _smokeloc = [0, 0, -6]; // Convert the string in _sinkside to upper case _sinkside = toUpper (_sinkside); // If _sinkside is "RANDOM", choose a random side from the array if (_sinkside == "RANDOM") then { _sinkside = ["LEFT", "RIGHT", "LEFT FRONT", "RIGHT FRONT", "LEFT BACK", "RIGHT BACK"] call BIS_fnc_selectRandom; }; // Declare the variables for setCenterOfMass switch (_sinkside) do { case "LEFT": { _x1 = _x - 1.0; _y1 = _y; _x2 = _x - 1.7; _y2 = _y - 2.5; _x3 = _x - 1.7; _y3 = _y; _smokeloc = [-3, 0, -6]; }; case "RIGHT": { _x1 = _x + 1.0; _y1 = _y; _x2 = _x + 1.7; _y2 = _y - 2.5; _x3 = _x + 1.7; _y3 = _y; _smokeloc = [3, 0, -6]; }; case "LEFT FRONT": { _x1 = _x - 0.6; _y1 = _y + 3.0; _x2 = _x - 1.5; _y2 = _y + 5.0; _x3 = _x - 1.7; _y3 = _y; _smokeloc = [-3, 8, -6]; }; case "RIGHT FRONT": { _x1 = _x + 0.6; _y1 = _y + 3.0; _x2 = _x + 1.5; _y2 = _y + 5.0; _x3 = _x + 1.7; _y3 = _y; _smokeloc = [3, 8, -6]; }; case "LEFT BACK": { _x1 = _x - 0.4; _y1 = _y - 2.5; _x2 = _x - 1.5; _y2 = _y - 5.0; _x3 = _x - 1.7; _y3 = _y; _smokeloc = [-3, -8, -6]; }; case "RIGHT BACK": { _x1 = _x + 0.4; _y1 = _y - 2.5; _x2 = _x + 1.5; _y2 = _y - 5.0; _x3 = _x + 1.7; _y3 = _y; _smokeloc = [3, -8, -6]; }; }; // Actual effect stuff begins here // Create the smoke emitter if (_smoke) then { _smoke_e = "#particlesource" createVehicleLocal getPosATL _ship; _smoke_e setParticleClass "BigDestructionSmoke"; _smoke_e attachTo [_ship, _smokeloc]; }; sleep 2; // Slight tilt _ship setCenterOfMass [[_x1, _y1, _z1], _sinktime * 0.33]; _ship setMass [ 1500000, _sinktime * 0.33]; // Normal mass of the trawler is around 1 270 000. sleep (_sinktime * 0.33 + 0.5); // Water reaches the deck, fire extinguished, tilt and mass increasing if (_smoke) then { _smoke_e spawn { sleep 3; deleteVehicle _this } }; // Delete the smoke emitter after a few seconds. _ship setCenterOfMass [[_x2, _y2, _z2], _sinktime * 0.66]; _ship setMass [ 3300000, _sinktime * 0.66]; sleep (_sinktime * 0.66 + 0.5); // Make sure the ship sinks to the bottom instead of hanging halfway through. _ship setCenterOfMass [[_x3, _y3, _z3], _sinktime]; _ship setMass [ 7000000, _sinktime]; // Required mass depends on depth. // Wait until the ship has reached the bottom, then // disable simulation to save on performance. waitUntil { getPosATL _ship select 2 < 7 }; sleep 20; _ship enableSimulation FALSE; TRUE Here's it in action: I used this as the addAction script: private ["_target", "_unit", "_id", "_magaz", "_sinkside", "_attachpos", "_uy", "_relativedir", "_democharge"]; _target = _this select 0; _unit = _this select 1; _id = _this select 2; _magaz = magazines _unit; if(!("DemoCharge_Remote_Mag" in _magaz)) then { hint "You have no charges to place"; } else { hint "Bomb planted with a two minute timer."; _unit removeMagazine "DemoCharge_Remote_Mag"; _target removeAction _id; // needs to be run globally in MP _relativedir = [_target, _unit] call BIS_fnc_dirTo; _sinkside = "RANDOM"; _attachpos = [0, 0, 0]; _uy = -1; if (_relativedir <= 34 || _relativedir >= 304) then { _sinkside = "LEFT FRONT"; _attachpos = [-4.42, 8, -6]; _uy = -1 }; if (_relativedir >= 35 && _relativedir <= 124) then { _sinkside = "RIGHT FRONT"; _attachpos = [ 4.42, 8, -6]; _uy = 1 }; if (_relativedir >= 259 && _relativedir <= 303) then { _sinkside = "LEFT"; _attachpos = [-4.75, -2, -6]; _uy = -1 }; if (_relativedir >= 125 && _relativedir <= 169) then { _sinkside = "RIGHT"; _attachpos = [ 4.42, -2, -6]; _uy = 1 }; if (_relativedir <= 258 && _relativedir >= 215) then { _sinkside = "LEFT BACK"; _attachpos = [-4.75, -9, -6]; _uy = -1 }; if (_relativedir >= 170 && _relativedir <= 215) then { _sinkside = "RIGHT BACK"; _attachpos = [ 4.42, -9, -6]; _uy = 1 }; _democharge = "DemoCharge_Remote_Ammo_Scripted" createVehicle getPosATL _target; _democharge attachTo [_target, _attachpos]; _democharge setVectorDirAndUp [[0, 1, 0], [_uy, 1, 0]]; sleep 120; if (!isNull _democharge) then { _democharge setDamage 1; sleep 1; [_target, _sinkside] execVM "sinkship.sqf"; }; }; That's pretty cool! Will totally use that sometime! Share this post Link to post Share on other sites
Magirot 14 Posted April 6, 2014 This should be easy to implement with BIS_fnc_relativeDirToJust scan for a placed satchel, call the function with the satchel and trawler as parameters and you got the relative direction where the satchel was placed. Ooh, that's why the function in the bomb planting script was returning weird stuff, I used BIS_fnc_dirTo by accident. D: Fixed it now. Thanks, everyone. Share this post Link to post Share on other sites
Tankbuster 1747 Posted April 6, 2014 That's excellent. Totally using this.:) Share this post Link to post Share on other sites
rtek 10 Posted April 7, 2014 (edited) how did you call the script for placing the charge on the side of the boat? Edited April 7, 2014 by RTEK Share this post Link to post Share on other sites
Magirot 14 Posted April 7, 2014 this addAction ["Place Explosive Charge", "attach_charge.sqf"]; on the trawler object's init. Share this post Link to post Share on other sites
rtek 10 Posted April 7, 2014 (edited) yeah that's awesome. thanks for making that script. very cool. works great on other boats too. How can the attach script be modified to destroy a boat? I'm trying to destroy a csat HMG boat, even with the boat set to critical damage, but the blast wont destroy it. Any chance of using that exploding barrel script to get the demo charge to be amplified? _barrel = _this select 0; if (isServer) then { _ex = createVehicle [ "Bo_Mk82", _barrel modeltoworld [0,0,1], [], 0, "CAN_COLLIDE" ]; _ex setVectorDirAndUp [[0,0,1],[0,-1,0]]; _ex setVelocity [0,0,-1000]; deleteVehicle _barrel; }; I tried to change _barrel to _boat, but it didnt do anything different. this addEventHandler ["HandleDamage",{if ((_this select 4 ) in ["DemoCharge_Remote_Ammo"] ) then {_this execvm "boom.sqf"}}]; I put that EH on the boat to call the boom.sqf with _boat instead of _barrel, hoping the demo charge would activate the script but it didnt blow up how I hoped. Edited April 7, 2014 by RTEK Share this post Link to post Share on other sites
Magirot 14 Posted April 7, 2014 (edited) works great on other boats too. Really? :Oo: I'd have thought that the increase in mass at the beginning would sink any other ship like a rock right away. ...actually I guess that's an appropriate sinking speed for any other vessel the game has. However, that addAction script attaches the explosive based on the size of the trawler, so there's a floating explosive somewhere nearby. You could maybe put the location setup of the latter under an if so it'll attach to the default [0, 0, 0] when it's not a trawler: private ["_target", "_unit", "_id", "_magaz", "_sinkside", "_attachpos", "_uy", "_relativedir", "_democharge"]; _target = _this select 0; _unit = _this select 1; _id = _this select 2; _magaz = magazines _unit; if(!("DemoCharge_Remote_Mag" in _magaz)) then { hint "You have no charges to place"; } else { hint "Bomb planted with a two minute timer."; _unit removeMagazine "DemoCharge_Remote_Mag"; _target removeAction _id; _relativedir = [_target, _unit] call BIS_fnc_relativeDirTo; _sinkside = "RANDOM"; _attachpos = [0, 0, 0]; _uy = -1; if (_target isKindOf "C_Boat_Civil_04_F") then { if (_relativedir <= 359 && _relativedir >= 274) then { _sinkside = "LEFT FRONT"; _attachpos = [-4.42, 8, -6]; _uy = -1 }; if (_relativedir >= 0 && _relativedir <= 94) then { _sinkside = "RIGHT FRONT"; _attachpos = [ 4.42, 8, -6]; _uy = 1 }; if (_relativedir >= 229 && _relativedir <= 273) then { _sinkside = "LEFT"; _attachpos = [-4.75, -2, -6]; _uy = -1 }; if (_relativedir >= 95 && _relativedir <= 139) then { _sinkside = "RIGHT"; _attachpos = [ 4.42, -2, -6]; _uy = 1 }; if (_relativedir <= 228 && _relativedir >= 185) then { _sinkside = "LEFT BACK"; _attachpos = [-4.75, -9, -6]; _uy = -1 }; if (_relativedir >= 140 && _relativedir <= 186) then { _sinkside = "RIGHT BACK"; _attachpos = [ 4.42, -9, -6]; _uy = 1 }; }; _democharge = "DemoCharge_Remote_Ammo_Scripted" createVehicle getPosATL _target; _democharge attachTo [_target, _attachpos]; _democharge setVectorDirAndUp [[0, 1, 0], [_uy, 1, 0]]; sleep 120; if (!isNull _democharge) then { _democharge setDamage 1; sleep 1; // only call for the client where the ship is local // maybe put this under an if as well? [[[_target, _sinkside], { [_this select 0, _this select 1] execVM "sinkship.sqf" } ], "BIS_fnc_spawn", _target] spawn BIS_fnc_MP; } }; How can the attach script be modified to destroy a boat? I'm trying to destroy a csat HMG boat, even with the boat set to critical damage, but the blast wont destroy it. Edit: Maybe it was because of it attaching a long way off the boat in the way I mentioned above? If not, you could just put _target setDamage 1; after the last sleep. Edited April 7, 2014 by Magirot Share this post Link to post Share on other sites
rtek 10 Posted April 7, 2014 it does sink it rather quick, but it does sink like the trawler does, usually back end down first the times i tried it. Only thing is once it's at the bottom, the waves cause them to go nuts. Share this post Link to post Share on other sites
whiztler 137 Posted April 7, 2014 Next gen stuff mate. Well done Share this post Link to post Share on other sites
Tapparella 10 Posted May 25, 2014 Guys, do you think is possible to create a Tutorial to how to do these stuff? I didn't find anything usefull about Sinking boats in Arma 3 on line. Especially for noobs like me. Thanks, Tapparella Share this post Link to post Share on other sites
katipo66 94 Posted May 26, 2014 Great to see, is it considered !alive once sunk in terms of trigger conditions? Share this post Link to post Share on other sites
cpthammerbeard 10 Posted April 5, 2015 (edited) Hi there, script is awesome in SP, but having some problems with MP execution. I have this script here _smAttachMine = getMarkerPos "smAttachMineTwo"; drugShip = "C_Boat_Civil_04_F" createVehicle _smAttachMine; I'm using the following for the addAction _attachCharge = [[drugShip,["Place Explosive Charge",{[drugShip,player,0] execVM "scripts\attach_charge.sqf"}]],"addAction",true,true,false] call BIS_fnc_MP; my problem is the error message shows drugShip as undefined for the pass through to the execVM. If I define as a publicVariable like below, the adddAction doesn't execute attach_charge. _smAttachMine = getMarkerPos "smAttachMineTwo"; drugShip = "C_Boat_Civil_04_F" createVehicle _smAttachMine; Any thoughts? Edited April 5, 2015 by CptHammerBeard Share this post Link to post Share on other sites
theopolus 69 Posted January 29, 2016 Great Script and thanks to everyone for contributing. I do have one problem with it in that it doesn't appear to work on a dedicated server environment. The status of the ship changes to !alive, that part is fine, all the sexy animations of it sinking are missing. I've attached a video showing the issues - skip to 3:00 to see the charges go off; https://youtu.be/iIjFNzto_rs Any suggestions? Share this post Link to post Share on other sites
Texeiro 15 Posted January 18, 2019 Hello, sorry for coment on this old post. I was trying to make the trawler sink to a charge explosion, using Magirot sripts, but there is not attachtTo.sqf scrip availabe, so I tried with EoV script: Spoiler /* Stealthstick's "Explosive-To-Vehicle" Script -Allows players to attach their explosive charges to any vehicle. */ EtV_ChargeCheck = { _charge = _this select 0; _unit = _this select 1; _hasIt = _charge in (magazines _unit); _nearVehs = nearestObjects [_unit,["Air","Ship","LandVehicle"],5]; _return = (_hasIt && count _nearVehs > 0 && alive _unit); _return }; EtV_TouchOff = { _array = _this select 3; _unit = _array select 0; _explosives = _unit getVariable ["charges",[]]; { if(alive _x) then { "HelicopterExploSmall" createVehicle (position _x); deleteVehicle _x; }; } 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"]; _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]]; "HelicopterExploSmall" createVehicle (position _explosive); deleteVehicle _explosive; }; 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"; }; }; _nearVehicle = (nearestObjects [_unit,["Air","Ship","LandVehicle"],5]) select 0; _explosive = _class createVehicle [0,0,0]; _explosive attachTo [_unit,[0,0,0],"leftHand"]; _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 <= 5) exitWith {_return = true;};} forEach _explosives; _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, true, true, "","['DemoCharge_Remote_Mag',_target] call EtV_ChargeCheck"]; _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; I put this addActionthis addAction ["Place Explosive Charge", "EtV.sqf"];on the trawler object's init. . I couldnt make it work. Please i someone could check what I m doing wrong, I will be gratefull. Share this post Link to post Share on other sites
Texeiro 15 Posted January 18, 2019 I made it!!!!!! I used sabotage.sqf by Malak Spoiler _object = _this select 0; player playMove "advepercmstpsnonwrfldnon_putdown"; sleep 15; _timeleft = 20; while {true} do { // 5 minutes counter hintsilent format ["Charge Explode in :%1", [((_timeleft)/60)+.01,"HH:MM"] call bis_fnc_timetostring]; if (_timeleft < 1) exitWith{}; _timeleft = _timeleft -1; sleep 1; }; "M_Mo_82mm_AT" createvehicle getpos _object; {_x setdamage 1} foreach crew _object + [_object]; Now the problem is that it seems that player has unlimited charges, like if doesn t take in account soldier inventary , beside there s no charge animation as in the next video: This is the first time that I made a scripting thing work, I knew, I didn´t write a line of code, but still, I m very happy! If someone could help me whit this issues, thanks in advance. EDIT: More!!! I solved it...Magirot addaction is Attach_Charge.sqf. Now works like a charm...Tried MP and works too! If anyone want to try, here{s the sample mission: http://www.mediafire.com/folder/egaz9yx0yqhcy/hundirbarcofinall.Stratis Share this post Link to post Share on other sites
Play3r 147 Posted March 31, 2019 On 1/18/2019 at 2:51 AM, Texeiro said: I made it!!!!!! I used sabotage.sqf by Malak Reveal hidden contents _object = _this select 0; player playMove "advepercmstpsnonwrfldnon_putdown"; sleep 15; _timeleft = 20; while {true} do { // 5 minutes counter hintsilent format ["Charge Explode in :%1", [((_timeleft)/60)+.01,"HH:MM"] call bis_fnc_timetostring]; if (_timeleft < 1) exitWith{}; _timeleft = _timeleft -1; sleep 1; }; "M_Mo_82mm_AT" createvehicle getpos _object; {_x setdamage 1} foreach crew _object + [_object]; Now the problem is that it seems that player has unlimited charges, like if doesn t take in account soldier inventary , beside there s no charge animation as in the next video: This is the first time that I made a scripting thing work, I knew, I didn´t write a line of code, but still, I m very happy! If someone could help me whit this issues, thanks in advance. EDIT: More!!! I solved it...Magirot addaction is Attach_Charge.sqf. Now works like a charm...Tried MP and works too! If anyone want to try, here{s the sample mission: http://www.mediafire.com/folder/egaz9yx0yqhcy/hundirbarcofinall.Stratis Spoiler // SAVE AS attach_charge.sqf private ["_target", "_unit", "_id", "_magaz", "_sinkside", "_attachpos", "_uy", "_relativedir", "_democharge"]; _target = _this select 0; _unit = _this select 1; _id = _this select 2; _magaz = magazines _unit; if(!("DemoCharge_Remote_Mag" in _magaz)) then { hint "No tenés cargas!"; } else { hint "Bomba Plantada con 40 segundos de delay."; _unit removeMagazine "DemoCharge_Remote_Mag"; _target removeAction _id; _relativedir = [_target, _unit] call BIS_fnc_relativeDirTo; _sinkside = "RANDOM"; _attachpos = [0, 0, 0]; _uy = -1; if (_relativedir <= 359 && _relativedir >= 274) then { _sinkside = "LEFT FRONT"; _attachpos = [-4.42, 8, -6]; _uy = -1 }; if (_relativedir >= 0 && _relativedir <= 94) then { _sinkside = "RIGHT FRONT"; _attachpos = [ 4.42, 8, -6]; _uy = 1 }; if (_relativedir >= 229 && _relativedir <= 273) then { _sinkside = "LEFT"; _attachpos = [-4.75, -2, -6]; _uy = -1 }; if (_relativedir >= 95 && _relativedir <= 139) then { _sinkside = "RIGHT"; _attachpos = [ 4.42, -2, -6]; _uy = 1 }; if (_relativedir <= 228 && _relativedir >= 185) then { _sinkside = "LEFT BACK"; _attachpos = [-4.75, -9, -6]; _uy = -1 }; if (_relativedir >= 140 && _relativedir <= 186) then { _sinkside = "RIGHT BACK"; _attachpos = [ 4.42, -9, -6]; _uy = 1 }; _democharge = "DemoCharge_Remote_Ammo_Scripted" createVehicle getPosATL _target; _democharge attachTo [_target, _attachpos]; _democharge setVectorDirAndUp [[0, 1, 0], [_uy, 1, 0]]; sleep 40; if (!isNull _democharge) then { _democharge setDamage 1; sleep 1; // only call for the client where the ship is local [[[_target, _sinkside], { [_this select 0, _this select 1] execVM "sinkship.sqf" } ], "BIS_fnc_spawn", _target] spawn BIS_fnc_MP; } }; // this addAction ["Place Explosive Charge", "attach_charge.sqf"]; on the trawler object's init. the Attach:charge.sqf Share this post Link to post Share on other sites