Comrades in Arms Discussion Board

Full Version: Artillery & car radio
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everybody!

I am working on new missions, and I will publish about 5-10missions (FDF coop) in a pack (someday..).

There is some problems, I need artillery fire inside a trigger or an area in FDF1.4
and I really dont know how to begin. So if you have a god script or idea, i have use for it.

Next problem: I know how to put music in a mission, triger and everybody hear it...
 But I need the music/sound to come from a radio, or inside a car.
For the artillery, you could use the following script (I used it myself in one of my missions; I only edited it in 3 lines or so to make it work in multiplayer):
It's originally from Fishion and modified by General Barron as you can see.
The parameters are well explained so there is not much more to say about it.
Code:
;// Generic Artilly Script
;//
;// by Fishion
;// Modified by General Barron to make a circular impact area instead of a square one.
;//
;// I made this because of the enourmous number of Artillery Scripts
;// which use Men to place bombs, Vehicles to create the illusion of
;// an explosion, or simple in a different from to shoot smoke shells
;//
;// to replace all those Artillery Simulating Scripts this should be sufficient
;// to the needs of most people (evan has sound)
;//
;// big advantage is you can actually choose the ordanace (if you wish you
;// shoot Boats or Car by the Artillery, eventhough this is simply stupid)
;//
;// (c)Aug 2001
;//

;//********************
;//**** Parameters ****
;//********************

;// Target Coordinates:
;// This should be an array containing min 2 numbers (X and Y Coord) but a normal
;// GetPos should do (no select 0 etc.)
_coords = _this select 0

;// Type of Ordanance (String Value), look at Weapons and Ammo or Objects Tree for types
_ord = _this select 1

;// Height (numeric) at which Ordanance should be Spawned (150 or so works fine)
_height = _this select 2

;// Number of volley fired by the Artillery
_VolleyNr = _this select 3

;// Number of Shots in each Volley
_ShotNr = _this select 4

;// Time between Volleys
_vTime = _this select 5

;// Time Variation between Volley (the Max deviation from _vtime)
_vTimeVar = _this select 6

;// Time Variation within each Volley
;// (Note: For Time on Target Barrages (ToT) put a 0 here)
_vTimeVol = _this select 7

;// Maximum Distance for shots off the Aimed Point
_radius = _this select 8

;//************************
;//**** Parameters END ****
;//************************


;//Put in Radiochatter here!


;//**************************
;//**** Main Arty Script ****
;//**************************

_nr = 0

#loop

?(_nr >= _Volleynr):goto "ende"

_volnr = 0

;//inner loop (within volley)
#volley

;// Increment Counter
_volnr = _volnr + 1

;// create ordonance
_tmp = _ord createVehicle [(_coords select 0) + (random _radius) - (_radius / 2), (_coords select 1)
+ (random _radius) - (_radius / 2), _height]
_tmp setDammage 1
~1
_tmp setDammage 0.3
deleteVehicle _tmp

;// wait a random time for the next Shot
;// (note _vTimeVol is the total time a Barrage needs to land, thus devided by the number
;// of shots)

;// wait and avaoid errormessage
?(_shotnr == 0):goto "avoid"
~(Random(_vTimeVol / _Shotnr))
goto "endrnd"
#avoid
~0.1
#endrnd


?(_volnr <= _Shotnr):goto "volley"
;//innerloop end

;// Increase Counter
_nr = _nr + 1

~(_vtime + (Random _vTimeVar ))

goto "loop"


#ende
;//Put in Radiochatter here!
I don't know how this line is supposed to create a circular impact area:

Code:
_tmp = _ord createVehicle [(_coords select 0) + (random _radius) - (_radius / 2), (_coords select 1)
+ (random _radius) - (_radius / 2), _height]

Should be something like this:

Code:
_rdir = random 360
_rrad= random _radius
_tmp = _ord createVehicle [(_coords select 0) + sin(_rdir)*_rrad, (_coords select 1) + cos(_rdir)*_rrad, _height]




For the music from a radio or object, you define it as cfgSounds and it has to be mono. Put the files in sound/ subfolder in the mission directory.

description.ext:
Code:
class CfgSounds
{
    sounds[] =
        {
            mymusic1, mymusic2
        };

    class mymusic1
    
    {
        name = "my music 1";
        sound[] = {"mymusic1.ogg", db-6, 1.0};
        titles[] = {    };
    };

    class mymusic2
    
    {
        name = "my music 2";
        sound[] = {"mymusic2.ogg", db-6, 1.0};
        titles[] = {    };
    };

};

To play from an object:
jeep1 say mymusic1
(04-15-2008, 08:16 AM)Pulverizer link Wrote:I don't know how this line is supposed to create a circular impact area:

Code:
_tmp = _ord createVehicle [(_coords select 0) + (random _radius) - (_radius / 2), (_coords select 1)
+ (random _radius) - (_radius / 2), _height]

Should be something like this:

Code:
_rdir = random 360
_rrad= random _radius
_tmp = _ord createVehicle [(_coords select 0) + sin(_rdir)*_rrad, (_coords select 1) + cos(_rdir)*_rrad, _height]
As I said before it is not my script and it's been ages since I have used trigonometry myself...
But the script seemed to work okay and who cares or even notices that the shells don't fall in a circle but in a rectangle or triangle  Wink
Hola,

although you give good advice here, im still too lousy missioeditor to get it to work.

My piece of description looks like:

class CfgSounds
{
sounds[] =
{amb1,amb2};
class amb1
{
name = "amb1";
sound[] = {"amb1.ogg",db+20,1};
titles[] = {  };
};

class amb2
{
name = "amb2";
sound[] = {"amb2.ogg",db+20,1};
titles[] = {  };
};
};


But i get always an error "Sound amb1 not found". Does anyone see my fault here?

Thx

  Tony
Where do you put the sounds Tony?
I believe they need to be inside a folder named sounds inside mission folder.

You could also try to change name sligthly to avoid confusion
Quote:{
name = "amb1";
sound[] = {"amb1.ogg",db+20,1};
titles[] = {  };
};
to
Quote:{
name = "amb_1";
sound[] = {"amb1.ogg",db+20,1};
titles[] = {  };
};
because (if I read correctly) it's amb1 which isn't found, not amb1.ogg
Hola,

no, wont work. Now it says "Amb_1" not found. I guess my description is nor recognized at all? The Text above is all thats in there. Something more needed?

And yes, i put it in the "Sound" folder in my mission.

description looks like this now:

[Image: descv.th.jpg]
... or alternatively (or even better): How would the sound included as a ambient sound activated via the trigger/effects? Like the frogs and birds and so on. In this way it will become audible from a unique location what would surely be more realistic.

Thx

  Tony
You need to use the correct path, if you have them in a folder called "sound", then write:
sound[] = {"sound/amb1.ogg",db+20,1};

and so on.

I recommend using lowercase letters for everything
By the way: do not - I repeat: do not use WordPad or even MS Word or Open Office Writer or whatever for creating scripts, stringtables, descriptions.ext or any other Ofp/Arma related files (those programs' formatting functions might break your files).

Use at least the normal Windows text editor or better download Notepad++
Didn't notice that in Tony's pic but you're right Zwobot. Could even bet the whole reason why Tony got problem.
ok, that was the Problem, zwobot!

Used Notepad ++ and it works fine :-).

Thx so far!