Home   Help Search Login Register  

Author Topic: Artillery + sound script not working (camcreate explosions..)  (Read 2324 times)

0 Members and 1 Guest are viewing this topic.

Offline Pr0ph3t

  • Members
  • *
Hi all,

Man I haven't played this game since OFP and I'm trying to 'convert' some snippets I used to use..
This is a random explosion generator or 'arty script I guess' there are 2 issues with it:

I get an error message that arty1 doesn't exist. (Description.ext pasted as well below)
None of the arty sounds play. Basically I want it to play one of those 4 sounds randomly before every explosion.. (atmosphere)

None of the explosions appear.

Below you will find description.ext + script.. I read up somewhere to use create vehicle instead, so instead of camcreate you'll see that. Also, I've put brackets instead of accolades since I had a feeling it might be trying to read a double array but no cigar..

NOTE: Although this is meant as an arty barrage, I like to use it to create atmosphere but adding to the spread and having the odd random explosion pop off near you, injure you or kill you even.

DIR STRUCTURE
~~~~~~~~~~
C:\Users\Pr0ph3t\Documents\ArmA 2\missions\fate01.Chernarus
-sounds
-music
Code: [Select]
SCRIPT
~~~~
; _____________________________________________________
;|##########Artillery Script By Steve Molloy:##########|
;--------------------------------------------------------------------------------------

;Due To:

;Mark Palmer's Explosion Script (markpalmer@hotmail.com)
;which was based on script created by David Berka (David.Berka@nmi.at)

;##########################################


;this is the type of shell - LaserGuidedBomb is the most powerful and also creates a visible shell so I'd

stick with it..
;you could experiment with "hellfire" "shell73" and "TOW" to get the result you want

_AmmoType = "Bo_GBU12_LGB"
_unit = _this select 0

;spread is the spread of the x axis and spread2 is for the y axis - use these to make a rectangle impact area

eg. bombing bases to hell
_spread = 140
_spread2 = 180

;this is gettin the position of the unit you put in the exec line
_Explosion = GetPos _unit

;the number of shells
_Shells = 999

;the delay between each shell being droped anything above 5 seems a little to long to me but experimenting is

the key :-D
_delay = 4

;##### there's no need for you to do anything below here #####

_counter=0
~5
#beg
~_delay

sndrnd = random 11
IF (sndrnd >= 1 AND sndrnd <= 4 ) THEN playSound "arty1"
IF (sndrnd >= 5 AND sndrnd <= 8 ) THEN playSound "arty2"
IF (sndrnd >= 9 AND sndrnd <= 10 ) THEN playSound "arty3"
IF sndrnd == 11 THEN playSound "arty4"

_cx = _Explosion select 0
_cy = _Explosion select 1
_cz = _Explosion select 2

_cx = _cx + random _spread
_cy = _cy + random _spread2


;this bit lifts the bomb to a high altitude so you can see it falling
_cz = _cz + 300

_tempObj = _AmmoType createvehicle [_cx, _cy, _cz]
~0.01

_tempObj = objNull

_counter = _counter + 1

?(_counter == _Shells):exit
goto "beg"
Code: [Select]
=-=-=-=--=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
DESCRIPTION.EXT
~~~~~~~~~~~

// This is to turn the debriefing off
debriefing = 0

class CfgMusic
{
tracks[]={molo};

class molo
{
name = "molo";
sound[] = {\music\molo.ogg, db+0, 1.0};
};

};


class CfgSFX
{
sounds[] = {arty1,arty2,arty3,arty4};

class arty1
{
name = "arty1";
sound[] = {\sounds\arty1.ogg, db+30, 1.0};
};

class arty2
{
name = "arty2";
sound[] = {\sounds\arty2.ogg, db+30, 1.0};
};

class arty3
{
name = "arty3";
sound[] = {\sounds\arty3.ogg, db+30, 1.0};
};

class arty4
{
name = "arty4";
sound[] = {\sounds\arty4.ogg, db+30, 1.0};
};

};
« Last Edit: 26 Jul 2009, 12:23:27 by Planck »

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Try class CfgSound instead, it was always the right one for such sounds.
Also the folder name shouldn't be necessary: sound[] = {arty1.ogg, db+30, 1.0};
Of course the folder itself is necessary.

Say with an emitting object would be more appropriate than playsound. The later doesn't provide 3D sound. Although say 3D sound was bugged in ArmA1 in camera cutscenes.


Offline Pr0ph3t

  • Members
  • *
oh this isn't for cutscenes. this is for my amphibious assault mission. these explosions are random and they can kill you. I find it creates a realistic effect because in real life duringa major engagement let's face it you don't know where the shell will come from..

On a side note, in real life, when you can hear the shell wheezing you're fine. When you don't dive, but chances are you're already dead.

Anyway,
Its nothing without the sound of wheezing shells and the explosions. That's what I find has always been wrong with OFP.. Granted major engagements of 500+ units don't take place constantly. But c'mmon put in some fireworks!

The reason I'm not using say is because if you're not close to the sound you won't hear it. I want you to hear the shell wheezing no matter where you are. All this stuff worked in OFP. I just can't remember the little things I used to do to make them work

 but it still doesn't solve the problem that the explosions don't appear. I know the ammotype LGB is too big I want to use something smaller like heat shells or something. But I know the LGB works because I executed it from a trigger. The problem is that the script does not want to execute the command.

I think it has something to do with the fact that it is trying to use an array. Is there any way to take that array and make it a single value or is what I've done there correct?
« Last Edit: 21 Jul 2009, 21:52:46 by Pr0ph3t »

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Regarding createvehicle this is what the new Comref says. Your simple position array for camcreate can't be enough. Don't know if projectiles even inherit from CfgVehicles.

Description:
    Creates a vehicle of the given type (type is the name of the subclass in CfgVehicles). If the markers array contains several marker names, the position of a random one is used. Otherwise, the given position is used. The vehicle is placed inside a circle with this position as center and placement as its radius. Special properties can be: "NONE", "FLY" and "FORM".

Example:
    veh = createVehicle ["Cobra", position player, [], 0, "FLY"]

http://www.arma2.com/comref/comref.html
« Last Edit: 22 Jul 2009, 00:03:50 by Trapper »

Offline Pr0ph3t

  • Members
  • *
So what do I do to simulate random explosions around a given object or gamelogic

Offline F2kSel

  • Members
  • *
This could be used to simulate random bombing, It's one I made earlier.

http://www.armaholic.com/forums.php?m=posts&p=59631&n=last#bottom

Just change the ammo and height, some bomb types drift a bit so you would have to offset the position.

This could easily be fixed by changing the vector of the bomb.

I'm not sure if this is what you after, it would be cool if you could get a sound to work of the falling bomb.

Offline Pr0ph3t

  • Members
  • *
alrighty so the arty script works and now I'm trying to add sound that's where those IF statements come in..

when I do playsound without any IFs it works, it plays the sound before an explosion, however the script in the state it is does even do the explosions at this point. So obviously its something involving the block of IFs for the arty sounds.. Any idea what I'm doing wrong?
Code: [Select]
//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: TODO: Author Name
//////////////////////////////////////////////////////////////////
// Use the following to activate the script.
// nul=[center,size,howmany,delay] execVM "RndExpl.sqf"
// or use
// nul=[this,250,999,4]execVM "RndExpl.sqf" placed in a game logic Init for instant result.
// ///////////////////////////////////////////////////////////////
// 1. Center place an object ot gamelogic where you want the explosions.
// 2. Choose the size of the area in metere.
// 3. Select how many explosions you require
// 4. Select the maximum delay between explosions in seconds.
// 5. minimum delay is 0.5 secs and can be changed in the script.
// 6. If the two // are removed from the "Grenadebase" line a more visible marke is left on the ground.

_pos    = _this select 0;
_area   = _this select 1;
_rounds = _this select 2;
_del    = _this select 3;

_height = 0;// increase this if you want the items to fall from the sky.
_ammo = "Sh_120_HE";// Ammo can be changed for larger effects.

for [{_i = 0},{_i < _rounds},{_i = _i + 1}] do

{
rndnum = random 12
if (rndnum<=3) then {sndtype == 1}
if (rndnum>3) AND (rndnum<=6) then {sndtype == 2}
if (rndnum>6) AND (rndnum><=9) then {sndtype == 3}
if (rndnum>9) AND (rndnum><=12) then {sndtype == 4}

if (sndtype = 1) then {playSound "arty1"}
if (sndtype = 2) then {playSound "arty2"}
if (sndtype = 3) then {playSound "arty3"}
if (sndtype = 4) then {playSound "arty4"}

_newpos = GetPos _pos;
  _posX = _newpos select 0;
   _posY = _newpos select 1;
   _bomb = _ammo createVehicle[(_posX + random _area)-_area/2, (_posY + random _area)-_area/2,_height];
// _bomb = "GrenadeBase" createVehicle [(getpos _bomb select 0),(getpos _bomb select 1),-10];

sleep (random _del)+0.5;// minimum delay 0.5, adjust for best results.
};
« Last Edit: 17 Oct 2009, 13:39:39 by Planck »