Jump to content
Sign in to follow this  
Prospero

Creating mid-air explosions

Recommended Posts

Hi all,

At the moment, when I want to create an explosion at any location (including - crucially - in mid-air), I camCreate one shell73 at the desired location, and then immediately camCreate another shell73 on top of it to detonate it (I read of this method in these forums). Whether one gets an explosion of twice the power of one shell73 by this method, I'm not sure. Anyone know?

Is anyone aware of a method to camCreate a satchel-type charge and detonate it in a similar fashion? - and note - I need something that works in mid-air as well as on the ground.

Or any other ideas for creating mid-air explosions of different scales?

Additionally, is anyone aware of how to camCreate a working grenade which one can then use setVelocity to "throw"?

Prospero

Share this post


Link to post
Share on other sites

_pos = getPos this

_obj = "grenade" camCreate [_pos select 0, _pos select 1, 3]  ;3 is a guess..just anything higher than player or whatever is at origin

; game obj at degree 0 is north, counting clockwise

; cos/sin angles at deg 0 is east, counting counter-clockwise

_dir = -(getDir this) + 90

_scalar = 5

_vx = _scalar * cos _dir

_vz = _scalar * sin _dir

_vy = _scalar * tan 45 ;I have no idea, however much umph you want to give it

_obj setVelocity [_vx, _vz, _vy]

I think that is right (not tested).  ACTUALLY NOW THAT I THINK ABOUT IT THIS IS ALL WRONG.  But I'm going to bed & don't want to think anymore. tounge.gif

Doolittle

Share this post


Link to post
Share on other sites

Make 2 triggers (call them createMine and explodeMine) and make a marker (call it minePos). For the marker's type make it empty so it can't be seen in the briefing map and place the marker where you want the explosion to be. Ok, now.....

In the init field of the trigger createMine type:

mine = "Mine" camCreate[getmarkerpos "minePos" select 0, getmarkerpos "minePos" select 1, 150];

150 is the height, change that to suit yourself. Have the activation as whatever you want for the the trigger to make the mine and use the same activation the trigger to explode the mine. Now, to explode the mine, in the trigger explodeMine type:

mine setDammage 1;

MABYE this will work, I havent tested it but give me yell if it doesn't and if not what errors u get. This will also only work once, unless you make lots and lots of trigger, and I'm guessing you want to make an exploding flak type of effect? So mabye a script would be best. Anyways, good luck.

Share this post


Link to post
Share on other sites

I'm pretty sure that neither of these methods will work for mid-air stuff. I've been through this. Regardless of the height at which you set the charge, it goes off at height 0.

Why do people post code that they haven't tried out?wink.gif

Prospero

Share this post


Link to post
Share on other sites

Well, if I know the code will solve the problem, but might have some syntax errors, I'll post it.

The answer prospero is, yes, you will generate twice the explosive power.

Also, if you're using shells that have a good deal of velocity (like a falling artillery shell), you're liable to have the falling shell detonate, and the other drop to the ground and explode.

How I get around this is by colliding the shell with a non-explosive object. My favorite is to camcreate a particle generated by an explosion (e.g., FxExploGround1), since I figure with all that crap flying around, nobody's going to notice an extra speck of dirt.

 For a working example of how this works, check out the "multifuzeburst.sqs" script over in my artillery suite at OFPEC.

Or, just appreciate this untested pseudocode:

Shell = "Shell73" camcreate [x, y, z]

Fuze = "FxExploGround1" camcreate getpos shell

as far as camcreating a working grenade, what's the problem?  Shouldn't it work just fine if you don't camcreate it in contact with anything?

And a satchel-type charge.  No, satchels can't be detonated that way.  You can make a config.cpp mod that has all the characteristics of a satchel (explosion sound, fx) but uses the shotshell simulation.

You might get some dust effects on the ground. That's a relic of the game engine.

Share this post


Link to post
Share on other sites

Prospero, I posted the code off of the top of my head. Am I going to go take the time to test it out and then get back to you?! I'd rather not answer posts then. I think it's better to have something then nothing. By the way, I was trying to answer your grenade throwing question, not your first question.

Doolittle

Share this post


Link to post
Share on other sites

Doolittle,

I did not intend any offence! Perhaps I worded my last message a little wrongly. I am just a little frustrated as I've tried many things over the past couple of weeks;)

Re: the grenades, I have tried to camCreate grenades in various ways and never been able to. I've tried in the air, on the ground etc...

The only way I was ever able to manipulate them was by throwing one myself (manually), using nearestObject to "catch" its identity, and then setPos'ing it to the desired location. This works, but the grenade explodes instantly after being setPos'ed, and always at zero altitude.

Edit: I have not tried setVelocity with this method yet. Prob is, I still can't camCreate the grenade in the first place.

Prospero

Share this post


Link to post
Share on other sites

The code from Dinger works like a charm

Without scripts, just create a GAMELOGIC or an invisibleH

Then in its initialization line put this to have an explosion at 20 meters up

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">BOOOM = "Shell73" camcreate [(getpos this select 0), (getpos this select 1), (getpos this select 2)+20]; Fuze = "FxExploGround1" camcreate getpos BOOOM<span id='postcolor'>

Thanks for the code Dinger, i had no idea how to make an air explosion too

Share this post


Link to post
Share on other sites

biggrin.gif

You guys are great - I've been trying to create a flack script and have been pulling my hair out all week. I could not make mid-air explosions, thought I tried just about everything. I will be sure to give you credit within my scripts.

Thanks!!!

Share this post


Link to post
Share on other sites
Guest jacobaby

for the best flak attack collide a Flare and shell73 at the height u want, just use camcreate in the same place and voila.

mail me for working script

boanerges AT clara.co.uk

Share this post


Link to post
Share on other sites

i just made a script

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

; flak.sqs

; by brendan

_explosion = _this select 0

_unit = _this select 1

_time1 = _this select 2

_time2 = _this select 3

_yn = _this select 4

_rounds = _this select 5

#loop1

? _yn == 1 : goto "loop1"

goto "timer"

#timer

_i = 0

~_time1

goto "loop"

#loop

_i = _i + 1

_bang = _explosion camcreate  getpos _unit

~_time2

Fuze = "FxExploGround1" camcreate getpos _bang

? _i == _rounds : goto "timer"

? _yn == 1 : goto "end1"

? not alive( _unit) : goto "end1"

goto "loop"

#end

EXIT<span id='postcolor'>

its a bit messy so i got some explaining to do

_explosion = choose your explosion

_unit = wich unit the flaks directed at

_time1 = time between rounds

_time2 = time it takes to explode

_yn = 0 to make it work 1 to stop

_rounds = how many rounds per go

example

in units init field

or activtion box

["shell73",a10,5,0.4,0,5]

hope this helps and works,

works fine with me , i only just started scripting and

its so much easier and better

brendan

Share this post


Link to post
Share on other sites

I'd camcreate a shell and a small object on eachother. When the shell explodes, move the small object away. And so on and so on.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×