Home   Help Search Login Register  

Author Topic: Mine Backpack Explode script (ACCEPTED)  (Read 7064 times)

0 Members and 1 Guest are viewing this topic.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Mine Backpack Explode script (ACCEPTED)
« on: 26 Jun 2007, 08:10:55 »
When you shoot an engineer carrying a mine on his pack, an explosion occurs. 

Features:

- Explosion only occurs if this is a torso shot (thanks to LCD for figuring that out).
- Explosion occurs at height of mine on back.
- Explosion height dependent on unit stance--stand, crouch, prone (thanks to Mandoble's stance detection script).
- If standing or crouched, blast at engineer's back propels body forward.
- If prone, explosion causes body to "bounce"

See attached sample mission.  Tweak the _speed parameter if you want bodies to fly further.

Prerequisite:

- Requires Mandoble's awesome stance detection function:  http://www.ofpec.com/forum/index.php?topic=29174.0

Enjoy!  :cool2:

Edit:  Updated to handle units in vehicles. 

If you torso shoot an engineer in a vehicle, you will also get an explosion.  On a gunner, the explosion force is mostly external to the vehicle, so the vehicle will likely not be destroyed.  If engineer is driver or cargo, the force is more internal to vehicle, and vehicle may be destroyed. 

Version 2.1 Released on 2/14/2009.  Changes:
1. Added default _mine_height to fix bug.  Thanks to Worldeater for solution!
2. Added _checkHasMine toggle, that if true, unit will only explode if he has a mine in inventory.  By default this is false.  Mission Designer must edit this variable to set it to true if desired.  Thanks to Fleepee for finding, and Spooner for solution.

Get Mine Backpack Explode v2.1
« Last Edit: 20 Feb 2009, 21:21:55 by Mandoble »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mine Backpack Explode script by Shark Attack & JohnnyBoy
« Reply #1 on: 26 Jun 2007, 10:02:49 »
Nice and original idea  :good:
What would happen if the unit is inside a vehicle?  :whistle:

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Mine Backpack Explode script by Shark Attack & JohnnyBoy
« Reply #2 on: 26 Jun 2007, 18:02:30 »
Thanks.  This was Shark Attack's great idea, I just fine tuned it.

Hmmmm, have to test the vehicle angle...good thought.

I'm thinking we either have no explosion if in a vehicle (we assume its too hard to hit the pack directly), or we explode the vehicle...  Shark, what do you think?
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mine Backpack Explode script by Shark Attack & JohnnyBoy
« Reply #3 on: 26 Jun 2007, 18:48:21 »
The point is, if vehicle unit != unit THEN do not check unit stance.

Personally I would create the small explosion inside the vehicle, even if the vehicle is damaged and not the passenger as long as the vehicle is not an armoured one :D

Offline sharkattack

  • Former Staff
  • ****
Re: Mine Backpack Explode script by Shark Attack & JohnnyBoy
« Reply #4 on: 26 Jun 2007, 22:34:40 »
sounds  good to me  ..
"HOLY SARDINE" - see Shark-Attack meet his match

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Mine Backpack Explode script by Shark Attack & JohnnyBoy
« Reply #5 on: 27 Jun 2007, 07:12:58 »
Uploaded a new version of script/sample mission to top post.  Now vehicles are handled:

If you torso shoot an engineer in a vehicle, you will also get an explosion.  On a gunner, the explosion force is mostly external to the vehicle, so the vehicle will likely not be destroyed.  If engineer is driver or cargo, the force is more internal to vehicle, and vehicle may be destroyed.  Engineers riding inside hard armored vehicles won't be torso shot, and aren't an issue.

As Mando says, stance has no effect when in a vehicle.

If you don't like this vehicle explode option, there is a boolean at the top of the script where you can turn this feature off.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mine Backpack Explode script by Shark Attack & JohnnyBoy
« Reply #6 on: 28 Jun 2007, 00:55:05 »
There is a potential problem using Dammaged EH alone, the unit will explode by any cause that caused the damage, not only due bullets hitting the torso.

For example, you put there a car, order your men to get in, and accelerate crashing against a house. If any of your men gets damaged, BOOM. Of course, same happens when you hit with your car any of the other units. May be you can make this work also with HIT EH, as HIT EH returns also the CausedBy object, if it was simply a collision, causedBy will have the damaged unit, if not, it will have the unit that fired against the damaged unit. You may try to activate both EHs, and dammaged wait a quarter of second before checking a global variable where HIT EH put the causedBy.

You may also adapt this script, not only to engineers, but also to terrorists with explosives around their torso too.

Offline sharkattack

  • Former Staff
  • ****
Re: Mine Backpack Explode script by Shark Attack & JohnnyBoy
« Reply #7 on: 23 Jul 2007, 20:31:37 »
Quote
You may also adapt this script, not only to engineers, but also to terrorists with explosives around their torso too.

a  fine  idea    :good:
"HOLY SARDINE" - see Shark-Attack meet his match

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: Mine Backpack Explode script (ACCEPTED)
« Reply #8 on: 01 Feb 2009, 10:11:54 »
the soldier who has no more mine continue to explode... i've tested it in the editor and the removeallweapons command.  :scratch:

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Mine Backpack Explode script (ACCEPTED)
« Reply #9 on: 01 Feb 2009, 10:29:24 »
Not so much a bug, as an omission, since it doesn't seem to ever try to take into account that the soldier actually has any mines. Needs somewhere a:
Code: [Select]
({ _x in ["Mine", "MineE"] } count (magazines _unit)) > 0
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline schuler

  • Contributing Member
  • **
Re: Mine Backpack Explode script (ACCEPTED)
« Reply #10 on: 01 Feb 2009, 10:45:11 »
also to add to that , there is an error when heli's assault the soldier ;) at least for me there was!
Semper Fi

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Mine Backpack Explode script (ACCEPTED)
« Reply #11 on: 14 Feb 2009, 20:07:04 »
Script has been updated to address Bug reported in Schuler's fine First Response mission, and Fleepee's concern about allowing explosion only if unit has a mine in his inventory.  I thank Worldeater and Spooner for providing solutions to the two problems.

Regarding the mine in inventory, I chose to do this with a toggle variable in the script.  Mission Designer must edit the script and set the _checkHasMine variable to true if they want this feature.  I chose the default to false (do not check for a mine in inventory) because:

a. Engineer units still show a mine on their back, even though they have none in inventory.
b. People are using this script for the modded terrorist units that have a suicide belt on.  The suicide belts are not in inventory, so we can't code this restriction.

OFPEC:  Please update the approved downloadable resource with the new script.  Thanks much!
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mine Backpack Explode script (ACCEPTED)
« Reply #12 on: 14 Feb 2009, 20:25:40 »
The zip attached there is not 2.2 but 2.1, unless the versioning inside and in zip file is wrong.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Mine Backpack Explode script (ACCEPTED)
« Reply #13 on: 14 Feb 2009, 21:09:32 »
Sorry for the confusion Mandoble.

The zip is correct, I edited the first post wrong.  I fixed the first post now to read 2.1.

Gracias.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline schuler

  • Contributing Member
  • **
Re: Mine Backpack Explode script (ACCEPTED)
« Reply #14 on: 15 Feb 2009, 02:43:59 »
its nice to see your a good boy Johnny  ;)
will be using this update in my mission! cheers to Worldeater and Spooner
congratulates on the accepted johnnyboy  :yes:
« Last Edit: 15 Feb 2009, 02:49:11 by schuler »
Semper Fi