Jump to content

Sign in to follow this  
gobbo

Sound delayed + Particle speed

Recommended Posts

Hi folks!

I'm currently working on a nuke script and for that I need the sound delayed depending on the player's distance to the explosion site.

I think I'm gonna do it like this

if (((player distance _nukepos) > 0) && ((player distance nukepos) < 350)) then
{
 playSound "Nuke";
}
else if (((player distance _nukepos) > 350) && ((player distance nukepos) < 700)) then
{
 ~1
 playSound "Nuke";
}
else if (((player distance _nukepos) > 700) && ((player distance nukepos) < 1050)) then
{
 ~2
 playSound "Nuke";
}
[...]

Anyone got a better idea?

2nd thing: The shockwave should move at 350m/s. What's the correct speed for the particleCircle array? 350 is way too fast, already tried it.

so long

Edited by gobbo

Share this post


Link to post
Share on other sites

I may be mistaken, but aren't explosions and sounds in Arma delayed by default?

Share this post


Link to post
Share on other sites

Actually my nuke is no explosion, its more a simulation of an explosion using particles and setdamage.

So i would have to place a loud sound source on the game logic on the detonation spot to have the sound delay of ArmA II. If someone knows how to do that, tell me! :)

Share this post


Link to post
Share on other sites

OK, apparently all you have to do is use the command:

playSound "soundname"

within a trigger or unit (could also use game logic) I've looked around for sound names but can't find any example for explosion. Also you may want to use this (it is a nuke after all) http://community.bistudio.com/wiki/soundVolume

Share this post


Link to post
Share on other sites

is that an .sqf or .sqs script?

for sqf this would be more accurate delay, the speed of sound being 345:

sleep ((player distance _nukepos) / 345);
playSound "Nuke";

Much more simple too. :)

Edited by King Nothing

Share this post


Link to post
Share on other sites
  King Nothing said:
is that an .sqf or .sqs script?

for sqf this would be more accurate delay, the speed of sound being 345:

sleep ((player distance _nukepos) / 345);
playSound "Nuke";

Much more simple too. :)

It's sqf, but I trid it with dividing, didn't work...

Share this post


Link to post
Share on other sites
  gobbo said:
Hi folks!

I'm currently working on a nuke script and for that I need the sound delayed depending on the player's distance to the explosion site.

I think I'm gonna do it like this

...

2nd thing: The shockwave should move at 350m/s. What's the correct speed for the particleCircle array? 350 is way too fast, already tried it.

so long

1. If you have an account on dev-heaven you should be able to check the source for ACE's sys_nuke. You can see how I did the sound in there.

2. Shockwaves are supersonic. While slower effect may look impressive the wave hauls along IRL.

Share this post


Link to post
Share on other sites

So how fast is a nuclear shock wave and what are the speed parameters for the particle circle? I got them at [-120, -120, 0] now, way too slow.

Share this post


Link to post
Share on other sites

You can glean some info from "Effects of Nuclear Weapons", the unclassified versions available in many places.

I used around Mach 2 for my shockwaves - 680 m/s.

Share this post


Link to post
Share on other sites

Okay, thanks so far.

Another question: I noticed that the smoke particles disappear in a rectangle around the player. Can I somehow deactivate this to create a denser atmosphere?

Share this post


Link to post
Share on other sites

I'd have to see a pic or vid to be sure. But the game engine does put limits on visible range of particle effects and how many generators are running at one time. If you go over those limits your pretty effects start getting shut down in first-in first-out order.

For example, when I first implimented sectional destruction of buildings my cloud got nerfed. The work-around was to add a slight random delay to when each building is damaged to add some jitter to the number of clouds forming at once. Given that buildings may take a shock and then fall down later, the effect has some real-life supporting arguments.

Share this post


Link to post
Share on other sites

You can see it in the second part of this one:

Share this post


Link to post
Share on other sites

Took a look at it, not bad so far really. Sound needs work.

What was yield and distance from blast?

Good news is that I don't think your "box" is what I was thinking about. More an illusion of cloud density than anything. Depending on that yield and it being a ground-burst you could just go for a wave of dense mist and then some sustained, but lighter dust kicked up.

Share this post


Link to post
Share on other sites

Actually that version was without the delay script, just delayed it by 5 secs... :D

I've got a dense wave now and dust coming after it with 2/3 of its speed. Still need to find a good vector for the shock wave though. :/

€: Err... and the most important thing is still missing, too... No damage yet. :)

Edited by gobbo

Share this post


Link to post
Share on other sites

In ACE's sys_nuke, the routines fnc_damage.sqf, fnc_DamageSectional.sqf, and fnc_DamageNonClass.sqf might be worth studying.

Share this post


Link to post
Share on other sites

Yeah I have lk's nuke for reference.

This is how i fixed all the effects now:

nukeeff.sqf:

_nukepos = _this select 0;
nul = [] execVM "enveffects.sqf";

"colorCorrections" ppEffectAdjust [2, 30, 0, [0.0, 0.0, 0.0, 0.0], [0.8*2, 0.5*2, 0.0, 0.7], [0.9, 0.9, 0.9, 0.0]];
"colorCorrections" ppEffectCommit 0;
"colorCorrections" ppEffectAdjust [1, 0.8, -0.001, [0.0, 0.0, 0.0, 0.0], [0.8*2, 0.5*2, 0.0, 0.7], [0.9, 0.9, 0.9, 0.0]];  
"colorCorrections" ppEffectCommit 3;
"colorCorrections" ppEffectEnable true;
"filmGrain" ppEffectEnable true; 
"filmGrain" ppEffectAdjust [0.02, 1, 1, 0.1, 1, false];
"filmGrain" ppEffectCommit 5;

sleep ((player distance _nukepos) / 345);
playsound "nuke";
player spawn quake;
sleep 2;
player spawn ash;
sleep 10;
"filmGrain" ppEffectEnable false;
"colorCorrections" ppEffectEnable false;

The sleep values are for debug, they will be set to 10 and 300 for release.

Last thing to do with the effects is de-spaning the ash. I tried some things but I didn't get it yet.

€: Double flash... Just remembered... 2 more lines and I got that one. ;)

€²: And I got the shockwave now. It's faster than the sound, not quite 2x the speed, but it is faster, tho.

Edited by gobbo

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  

×