Home   Help Search Login Register  

Author Topic: Explosive barrels etc  (Read 2968 times)

0 Members and 5 Guests are viewing this topic.

Gooner861

  • Guest
Explosive barrels etc
« on: 11 Jun 2004, 21:39:26 »
If u had a mission where u had to be carfeul that u did not shoot barrels placed around cos they were explosive or had chemicals in them etc, is there a way to make it explode if a stray bullet hits it?
« Last Edit: 11 Jun 2004, 21:39:43 by Gooner861 »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Explosive barrels etc
« Reply #1 on: 11 Jun 2004, 21:46:54 »
Read the eventhandler tute by unknown-guy-that-armsty-doesn't-remember. Should get you watch you need. Ooooo! That with a nice wiz-wiz-bullet script could make a nasty habit for the AI. :D

:beat: *Gets Shot* :beat:

Gooner861

  • Guest
Re:Explosive barrels etc
« Reply #2 on: 11 Jun 2004, 21:56:13 »
Complicated stuff. I'll have to read the tute by IGOR DRUKOV about 20 times to understand it. Thanks. I'll eventually understand it, i think.

Offline Blanco

  • Former Staff
  • ****
Re:Explosive barrels etc
« Reply #3 on: 11 Jun 2004, 22:11:31 »
I don't think an addeventhandler "hit" work on objects like a barrel, only humans and sometimes vehicles

use

?getdammage barrel > 0.1 : ....BOOOM!!

Search or search or search before you ask.

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:Explosive barrels etc
« Reply #4 on: 12 Jun 2004, 13:21:35 »
I have used this on many maps:
in the initialization block of the barrel put
[this]exec "barrboom.sqs"

then
;;barrboom.sqs
?!(local Server): Goto "end"
_barr=_this select 0
_shell = "heat125"
_barr setdammage .7
#start
?(getdammage _barr)<.75:goto "start"
_shell = "heat125" camcreate (getpos _barr)
#end
Exit

you can obviously tinker with the setdammage and getdammage to make the barrels more or less volitile, and the _shell type to make them more or less explosive

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Explosive barrels etc
« Reply #5 on: 12 Jun 2004, 18:16:34 »
Hello all!

Grendel made just such a script that launches the barrels into the air after exploding and will even catch nearby troops on fire! Enjoy!  ;D


                                                                      Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

Gooner861

  • Guest
Re:Explosive barrels etc
« Reply #6 on: 12 Jun 2004, 20:35:32 »
Thanks for the help people.

Zombie i tried ur script but it didnt work  ???.

Wadmann cud u explain those scripts please cos im abit unsure as how to activate them, wot names to give etc.

Thanks.

Offline sim

  • Members
  • *
  • Hot! Real hot! Damn Hot!
Re:Explosive barrels etc
« Reply #7 on: 12 Jun 2004, 22:11:40 »
hey!!!

Gooner m8, maddmatt has created an exploding barrel script and it is pretty damn good... I'll post it 2moz after i ask his permission or ill get him 2 do it... ;D

sim
The Unsung Campaign Team Leader

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Explosive barrels etc
« Reply #8 on: 12 Jun 2004, 22:28:21 »
EH Hit works on everything I belive. Once did a bomb and when you shot it (EH Hit), it would've exploded.

:beat: *Gets Shot* :beat:

ponq

  • Guest
Re:Explosive barrels etc
« Reply #9 on: 12 Jun 2004, 22:35:16 »
I'm not wadmann, but here's how the script works:

create a few barrels on the map you want to explode once they take damage. Give them all a name (barrel1, barrel2, barrel3, barrel4)

now add (or create) the init.sqs in your mission folder:
Code: [Select]
barrellist=[barrel1, barrel2, barrel3, barrel4]
{_x addeventhandler [{hit},{_this exec {explode.sqs}}]} forEach barrellist

You see, just add all the barrels you want to script to run on in the barrellist.

now you only have to make sure the explode and burn scripts are in your mission folder too.

(little add, comment this line in explode.sqs:
Code: [Select]
;player sidechat format["%1",_dammage]
to get rid of the player side chat .

gl with this nice script!



Gooner861

  • Guest
Re:Explosive barrels etc
« Reply #10 on: 12 Jun 2004, 22:50:27 »
Ok so ive dun as it says but each time a preview an error comes up saying there is an invalid number in this :

{_x addeventhandler [{hit},{_this exec {explode.sqs}}]} forEach barrellist


Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Explosive barrels etc
« Reply #11 on: 12 Jun 2004, 23:02:56 »
Try this:

{_x addeventhandler ["hit",{_this exec "explode.sqs"}]} forEach barrellist


Planck
I know a little about a lot, and a lot about a little.

Gooner861

  • Guest
Re:Explosive barrels etc
« Reply #12 on: 12 Jun 2004, 23:07:19 »
Nah its still comes up with an error message.

By the way im using the mission.sqm that comes with the scripts. In it there is a trigger with this in the On activation field:

if ({man} counttype [_x] == 1) then {[_x] exec {burn.sqs}}"" forEach thislist

Dunno if that will help at all.

Offline Jezuro

  • Members
  • *
  • Hookah 4 lyfe!
    • Jezuro's ArmA Workshop
Re:Explosive barrels etc
« Reply #13 on: 13 Jun 2004, 00:44:39 »
I think this is gonna help you  ;)

{_x addeventhandler [{hit},{(_this select 0) exec {explode.sqs}}]} forEach barrellist
"We are Her salvation, and through Her command we shall live forever. I will not die. Not here. Not now. Never!!!"

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Explosive barrels etc
« Reply #14 on: 13 Jun 2004, 07:04:07 »
Hello Gooner861!

As this is not my script, I can't add much to the discussion other than add/ask this:

Code: [Select]
{_x addeventhandler [{hit},{_this exec {explode.sqs}}]} forEach barrellistThis is the line from my working demo mission with no errors so it should work for everyone else.
 
Did the demo work for you and did you then merge the demo into you own mission in order to get this error?

Did you add an array for "barrellist" in the init and also name the barrels correctly?

What version of OFP are you running? I received no errors with 1.96.

Oh yeah, where was the !#! looking error marker in the line of code? That usually will dial me into just the part that is wrong.

Quote
Ok so ive dun as it says but each time a preview an error comes up saying there is an invalid number in this :

{_x addeventhandler [{hit},{_this exec {explode.sqs}}]} forEach barrellist


As most of the commands in this line of code do not return a number as a value, I can only guess that it has to do with the forEach command and therefore the "Barrellist" but guess is the operative phrase here. Maybe Grendel will stop by and clear this up for everyone!  ;)

                                                             Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.