Tajin 349 Posted July 11, 2009 Did anyone ever miss the possibility to attach satchelcharges to objects ? Stick them directly on a hostile tank, instead of dropping it nearby just to watch the tank drive away once you're in a save distance. Oh making your own Carbombs is also as easy as can be with that. :p This is how it works ingame: Walk up to an object (got to get very close ofcourse) keep it in your aim while placing a regular satchel charge. *voila* If you do it right, the charge will be attached to the object and you can use it as usual. How to activate that feature: This goes into the init of the person who should be able to use sticky satchels: nul = this addEventHandler ["fired", {nul=_this execVM "stickycharge.sqf"}]; (can also be added to multiple units at once with an forEach statement, needs to be reapplied in case of respawn) Script: "stickycharge.sqf" _unit = _this select 0; _weapon = _this select 1; _muzzle = _this select 2; _mode = _this select 3; _ammo = _this select 4; _shot = player; _pos = []; _vecup = []; _vecdir = []; _speed = []; _new = player; if (((_ammo == "PipeBomb") || (_ammo == "TimeBomb")) && !(cursorTarget isKindOf "Man") ) then { _shot = nearestObject [_unit, _ammo]; sleep 0.005; _thing = cursorTarget; _bound = boundingBox _thing; _x1 = (_bound select 0 select 0)-1; _x2 = (_bound select 1 select 0)+1; _y1 = (_bound select 0 select 1)-1; _y2 = (_bound select 1 select 1)+1; _mpos = _thing WorldToModel getPos _unit; _mx = _mpos select 0; _my = _mpos select 1; if ((_mx > _x1) && (_mx < _x2) && (_my > _y1) && (_my < _y2)) then { _shot attachTo [_thing,[0,0,-0.2]]; }; }; Share this post Link to post Share on other sites
Heatseeker 0 Posted July 11, 2009 This is almost evil man, what can it be atached to? (no i wasnt thinking about cows..) Share this post Link to post Share on other sites
Tajin 349 Posted July 11, 2009 Only thing it doesn't allow right now is soldiers. ^^ Cows should work, btw theres another script like this coming up. Probably gonna post it later. Share this post Link to post Share on other sites
.kju 3244 Posted July 11, 2009 GDT Mod Satchel Might be useful to check for inspiration. Yours is already making use A2 functionality. So please go on Tajin. :) Share this post Link to post Share on other sites
bhaz 0 Posted July 11, 2009 Did anyone ever miss the possibility to attach satchelcharges to objects ? Nice work, seems more convenient having this as a script rather than an add-on that everyone would require. How about using attach to load / unload ammo crates on the back of 5T trucks? Share this post Link to post Share on other sites
Xtreme1989 10 Posted July 11, 2009 Gonna test this right now, awesome feature :p ! thx Tajin and others who dedicate time so we can enjoy the game even more :cool: ! Share this post Link to post Share on other sites
The_Angry_Canadian 10 Posted July 12, 2009 How can you get those stachel ? I've looked into the ammo boxes and in the 5 boxes I spawned, none add statchels ?! How can you have 1 ammo box with ALL the weapons / ammo / etc. Share this post Link to post Share on other sites
LtCmdrBoon 0 Posted July 13, 2009 How can you have 1 ammo box with ALL the weapons / ammo / etc. What you do is search for all the weapons and ammo classnames and add them line by line to an ammo box using the addweapon and addmagazine commands in a script then you send the script to me :D:D Share this post Link to post Share on other sites
Tajin 349 Posted July 13, 2009 What you do is search for all the weapons and ammo classnames No. But I can send you the script anyway ;) Try this, but it may need to be filtered a bit. nul=[this] execVM "nameofscript.sqf"; equipweap = _this select 0; _rootclass = "cfgWeapons"; _count = count (configFile >> _rootclass); _total = 0; for [{_x=0}, {_x<_count}, {_x=_x+1}] do { sleep 0.0005; _obj=(configfile >> _rootclass) select _x; _val=(_obj >> "model"); _str=(getText _val); _weapon = configName _obj; if (_str != "") then { _total = _total + 1; equipweap addWeaponCargo [_weapon,10]; }; }; _rootclass = "cfgMagazines"; _count = count (configFile >> _rootclass); _total = 0; for [{_x=0}, {_x<_count}, {_x=_x+1}] do { sleep 0.0005; _obj=(configfile >> _rootclass) select _x; _val=(_obj >> "displayName"); _str=(getText _val); _weapon = configName _obj; if (_str != "") then { _total = _total + 1; equipweap addMagazineCargo [_weapon,30]; }; }; Share this post Link to post Share on other sites
The_Angry_Canadian 10 Posted July 13, 2009 What you do is search for all the weapons and ammo classnames and add them line by line to an ammo box using the addweapon and addmagazine commands in a scriptthen you send the script to me :D:D Thx Tajin, I started searching before you stuff and found that : http://www.armaholic.com/page.php?id=5843 Works great. Someone did the job of searching everything. But i'll keep yours to learn how to work with objects. It's a good example. Share this post Link to post Share on other sites
Tajin 349 Posted July 13, 2009 Yup, knowing how to read the config-entrys can be very useful. For example if you have an weapon-addon, then those weapons would automatically be added to the box aswell. Share this post Link to post Share on other sites
icebreakr 3157 Posted August 4, 2009 Tajin: is this normal that you cannot see timebomb/satchel once when you attach it to a vehicle for example? Share this post Link to post Share on other sites
romes 10 Posted October 13, 2009 OK Peeps, well, I really like the sound of this, but I'm a total noob with ArmA....so can somebody please explain to me in laymans terms exactly where the sqf file goes ect to make it work? I've bunged it in the mission folder and tried it in the editor but all I end up with is a satchel on the ground! Ta muchly in advance for your patience and assistance. Share this post Link to post Share on other sites
Binesi 10 Posted October 13, 2009 Interesting... Is that sleep necessary? I'd rather do this as a call. Doing it execVM is a bit slow for using on "fired". Share this post Link to post Share on other sites
Padjur 10 Posted October 13, 2009 This is were you put the sqf file Romes. C:\Documents and Settings\(your) "User Name"\My Documents\ArmA 2\MPMissions OR missions folder\(the) "Mission Name Folder" Which is the normal path to the mission folder which should have inside it at least a mission SQM file.This is where all the sqf files, the int.sqf file, the description EXT.file and any other file relating to the mission must go. You should then be able to load this file from the editor preview, by calling the script as Tajin instructs. Share this post Link to post Share on other sites
bartkusa 10 Posted July 7, 2010 (edited) edit: apparently I'm from the first to try this sort of thing.This script is fantastic, and there's so much more it could do. I'm starting to invest in it, and I'd like some help. Here's what little I've got so far: So far, I'm just prototyping, so the code is sloppy. I'm trying to leave spaces to insert other features later. It now has three chunks: 1. How to initialize player addEventHandler ["fired", {nul=_this execVM "stickySatchel\enablePlayer.sqf"}]; 2. enablePlayer.sqf // Originally by Tajin _unit = _this select 0; _weapon = _this select 1; _muzzle = _this select 2; _mode = _this select 3; _ammo = _this select 4; _shot = player; _pos = []; _vecup = []; _vecdir = []; _speed = []; _new = player; if (((_ammo == "PipeBomb") || (_ammo == "TimeBomb")) && !(cursorTarget isKindOf "Man") ) then { _shot = nearestObject [_unit, _ammo]; sleep 0.005; _thing = cursorTarget; _bound = boundingBox _thing; _x1 = (_bound select 0 select 0)-1; _x2 = (_bound select 1 select 0)+1; _y1 = (_bound select 0 select 1)-1; _y2 = (_bound select 1 select 1)+1; _mpos = _thing WorldToModel getPos _unit; _mx = _mpos select 0; _my = _mpos select 1; _mz = _mpos select 2; if ((_mx > _x1) && (_mx < _x2) && (_my > _y1) && (_my < _y2)) then { _angleThingToUnit = 90 - (_mx atan2 _my); _bombX = _mx - 0.67 * (cos _angleThingToUnit); _bombY = _my - 0.67 * (sin _angleThingToUnit); _bombZ = _mz + 0.67; _shot attachTo [_thing,[_bombX,_bombY,_bombZ]]; if (true) then { // TODO conditionally initiate // TODO what vehicles can be affected? Do some take longer than others? // TODO increase explosive yield if vehicle has satchels/ammo in cargo? if (isNil "bombID") then { bombArray = [_shot]; } else { bombArray set [count bombArray, _shot]; }; publicVariable "bombArray"; _carBombActionId = _thing addAction [ "Wire bomb to engine", // Title "stickySatchel\engineTriggeredBomb.sqf", // Script file _shot, // Arguments 0, // Priority false, // Show action in hovering titleText? true, // Hide on use? "", // Shortcut format [ // Allow user to use this action? "(player == _this) && (alive (bombArray select %1))", (count bombArray) - 1 ] ]; }; }; }; 3. engineTriggeredBomb.sqf private ["_target", "_caller", "_actID", "_bomb", "_stopWaiting"]; _target = _this select 0; _caller = _this select 1; _actID = _this select 2; _bomb = _this select 3; waitUntil {(!alive _target) || (!alive _bomb) || (isEngineOn _target)}; if (isEngineOn _target && alive _bomb) then { sleep (0.5 + random 3); _caller action ["TOUCHOFF", _caller]; }; _target removeAction _actID; I've got a few scripting questions, and I'm also looking for feature requests. Planned features Animation when setting up engine-triggered car bomb Setting up engine-triggered car bomb should take time (10-20 seconds) Configure which vehicles (cars, helicopters, etc) can have satchels attached to them, how long it takes to connect the satchels to the engine Make the explosion bigger if there's satchels/ammo in the trunk Allow one player to disarm another's satchel (how?) Known bugs If you move 300m from an engine-rigged bomb, I don't think the bomb will go off Once you rig up a bomb to an engine, the action "Wire bomb to engine" does not disappear If you attach a bomb to a car, and then detach it, the "Wire bomb to engine" action does not disappear Edited July 7, 2010 by bartkusa Share this post Link to post Share on other sites
omri2050 197 Posted December 13, 2012 I don't know if its relevant but I have ARMA 2 COMBINED OPERATIONS help please? Thanks Share this post Link to post Share on other sites
On_Sabbatical 11 Posted December 13, 2012 I will steal this one :D thanks for sharing :P Share this post Link to post Share on other sites