Home   Help Search Login Register  

Author Topic: nearExp - Concussion Effects from Explossions (ACCEPTED)  (Read 4278 times)

0 Members and 1 Guest are viewing this topic.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
I made this script a long time ago and I can't help but feel a little guilty for not releasing it sooner.

I have noticed in this site that many people have asked how to detect explosions, people have tried the following:

- Crater Object Detection
- Particle Detection
- Effect Adaption

All of these are reasonable but they each come with their own side effects.

After a long time to trail and error I found the perfect way to detect an explosion, but its more of a trick than detection.

Influenced by the Suppression script I decided to use the method of a looping detection of bullets in a radius using nearestObject in the same way to detect shells, rockets, missiles, specific grenades, mines and bombs.

But this doesn't really explain it.  So the way the effect works for when these projectiles blow up is to use a hundredth of a second loop to; firstly detect the projectile and secondly for the projectile to disappear.

This however would mean that the effect happens when the projectile leaves the radius, but this script is tuned so that it only activates the effects when the projectile disappears 'whilst' it was inside the radius.

So behold the script you have all been dying for, you can now relive the epic effects from Call of Duty, Medal of Honour, Vietcong and a ton of other games you know and love.

Credit for designing the script goes to me, however credit also goes to Gielovic for simplifying the script into a more tidy and compact final version.

Code: [Select]
// call {[A] execVM "nearExp.sqf"}
// A - Target Radius.
// 20 is best.

_d = _this select 0;

NearExp =

{
private["_ammo"];
_ammo = _this select 0;

_projectile = nearestObject [player, _ammo];

while {(_projectile distance player) < _d} do
{
sleep 0.01;
_projectile = nearestObject [player, _ammo];

if (isnull _projectile) then
{
if (alive player) then
{
       sleep 0.1;
       titlecut ["","WHITE IN",2];
       0.5 fadesound 0;
       playsound "PSFX_RINGING";
       setAccTime 0.5;
       sleep 2;
       2 fadesound 1;
       setAccTime 0.75;
       sleep 0.75;
       setAccTime 1;
};
};
};
};

while {alive player} do
{
sleep 0.01;
["RocketCore"] call NearExp;
["MissileCore"] call NearExp;
["ShellCore"] call NearExp;
["MineCore"] call NearExp;
["TimeBombCore"] call NearExp;
["G_40mm_HE"] call NearExp;
["G_30mm_HE"] call NearExp;
["G_40mm_HE_6G30"] call NearExp;
["GrenadeHandTimed"] call NearExp;
["GrenadeHand"] call NearExp;
};
exit;

I would like you to take notice of this section:

Code: [Select]
if (alive player) then
{
       sleep 0.1;
       titlecut ["","WHITE IN",2];
       0.5 fadesound 0;
       playsound "PSFX_RINGING";
       setAccTime 0.5;
       sleep 2;
       2 fadesound 1;
       setAccTime 0.75;
       sleep 0.75;
       setAccTime 1;
};

This is the effect, i have created my own while sets of a ringing sound, flashes and slows down time, but in this section you can create any effect you desire, including linking other scripts to it.

Additionally to the script i have included a sound which works with this version's effects, simply place it into your mission folder and update your description.ext.

Additional Additional, there is a short video attachment so you can view this in effect, don't mind the jumpy sound, its just the video quality.

Please tell me if you experience any problems with this script because although it is tested to work, untested modifications might have produced bugs.

Other than everything I have told you, please enjoy this script, starting off by tossing a grenade 10 feet from your current position.



Unbacked Copyrighted by Surdus Priest for the use of ArmA:Armed Assault and Queens Gambet.  Any violation of this decree will be subject for the Middle Finger Electronic Mail signed by the owner of this product.  For your own protection do not use this script for anything other than admiration of the creator and the creator of this script in it's entirety.  For further information on this policy, please speak with Surdus Priest's Solicitor who can be contacted on the dark side of Neptune (telephone number not included), calling times are between 9:00am and 5:00pm except on Bank Holiday Mondays and Boxing Day.

OFPEC DOWNLOAD
« Last Edit: 10 Aug 2009, 19:08:12 by hoz »
Campaigns are hard, I'll stick with scripting for now!

Offline Rommel92

  • Members
  • *
Re: nearExp - Concussion Effects from Explossions (TESTING)
« Reply #1 on: 18 May 2008, 23:35:47 »
Quote
Unbacked Copyrighted by Surdus Priest for the use of ArmA:Armed Assault and Queens Gambet.  Any violation of this decree will be subject for the Middle Finger Electronic Mail signed by the owner of this product.  For your own protection do not use this script for anything other than admiration of the creator and the creator of this script in it's entirety.  For further information on this policy, please speak with Surdus Priest's Solicitor who can be contacted on the dark side of Neptune (telephone number not included), calling times are between 9:00am and 5:00pm except on Bank Holiday Mondays and Boxing Day.
[/size]
 :D

Yeh looks great man, is the 0.01 delay necessary, or can it be made higher to help reduce lag on low end systems or script heavy missions, specially in SP where the player is the server (in a sense).

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: nearExp - Concussion Effects from Explossions (TESTING)
« Reply #2 on: 19 May 2008, 00:01:50 »

you could change the loop speed i you want... i guess.

it depends really, i never tested it over 0.01, im just guessing that most shells (not so much rockets) would fly a bit 2 fast for the script to pick it up if it was anything but 0.01.



No need to quote the whole of the previous post   Planck
« Last Edit: 19 May 2008, 02:19:03 by Planck »
Campaigns are hard, I'll stick with scripting for now!

Offline Rommel92

  • Members
  • *
Re: nearExp - Concussion Effects from Explossions (TESTING)
« Reply #3 on: 19 May 2008, 08:23:51 »
Yes, but there is a delay in the nearObjects calls/functions and it seems to account for about plus or minus a quarter of a second, so usually you'll get a good report with around 0.15 delay, but any more and it can have a lot of cut outs. (Failures to report)

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: nearExp - Concussion Effects from Explossions (TESTING)
« Reply #4 on: 19 May 2008, 16:09:57 »
well, different testers of this script might prefer different delays, so i'll leave it as it is, it is easy enough to change and the script is open to modifications anyway.  the script is more about 'detecting' the explosions.  meaning that it might not necessarily be used for concussion effects.
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
May you attach a basic demo mission including the sound file and the script all in one? Please, add also few comments to the script header with version and usage.

Offline Rommel92

  • Members
  • *
A quick cut-off of a mission of mine using it, its a simple demo for him, was used for MP demonstration, but thought why not show it here.


Edit:
See first post for download
« Last Edit: 10 Aug 2009, 19:08:31 by hoz »