Air raid - bombing and siren

success! i got it to work via the init file, thanks for the help man! though for some reason i cant seem to get the sirens to play, i scrapped the idea of the original sounds, and re edited the description and uploaded yours but they wont play either., nothing in the RPT file, just shows the AIRRAID start up with no problems
 
success! i got it to work via the init file, thanks for the help man! though for some reason i cant seem to get the sirens to play, i scrapped the idea of the original sounds, and re edited the description and uploaded yours but they wont play either., nothing in the RPT file, just shows the AIRRAID start up with no problems
Alright! Amazing!
Which version are you using? Static 1 location or Random?
If you've copied my sound folder to your mission, I'm not sure why the sounds are not playing. Can you hear the motar sounds?
I've got to retest the static 1 location code to confirm it's working, because I haven't tested it since I wrote it initially. Random should be working correctly now.
Remember, you have to be within 1000m to hear the sounds.
Are you getting all the diags in the RPT? I think the random is more verbose.

I will make an update to the OP later after testing both scripts again.

- oh and my default berezino location is actually the furthest north point on the road, by the industrial building.
 
Any luck with getting the nuke option to work yet?
Hey man, I've been working on it, but the server I'm testing on is semi populated and it's slow going. I guess I should install a local server instance to test on.
So far, I got a particle vehicle container to spawn, but I'm having trouble getting it to look like anything, and there are many classes in the code to look through for each different effect.
Also, triggering seems to be a bit funky - I got it to trigger 3 times on its own, but like 10 times it just wouldn't go. Did a little googling, looks like having a player trigger it is usually part of the code, I'll need to figure out a way around that.
Do you want it to do damage? I still have not been close enough to the bombs in testing my code to know if they kill you, but they definitely send shockwaves that mess you up, haha, guess I care about this character too much.
Two questions:
Does anyone know of something I can use to test code without rebooting my mission.pbo? Even just to see if it compiles or whatever?
Does anyone know of something to highlight arma syntax in notpad++?
 
hey man, i was using the Random loc one, and jsut tossed in some random lcoations around PAnthera, TPd to one of the coords, no i cant hear the mortar when they explode, jsut the explosions themselves, one after another
 
I ran into this earlier. Putting the coords into an object directly doesn't seem to work, you have to call position on a different object.
I updated the random script in the OP. Give it another shot with the new script.

Sent from my gnex during dinner.
 
Implemented this on our server this evening, after testing it throroughly on another server of ours thats not populated. It worked perfectly fine on the test server and when I uploaded it to the main server it (hilariously) targetted all the locations at once.

Kinda funny watching so many die; (only a couple got the sirens). Any thoughts?

I'm using the random version, and I used different coordinates than yours from stock file.
 
I noticed something in the code. For the random versions it WILL randomly target a location, but he made an error so not only does it randomly target a location, but it randomly selects how many locations to target as well. You may get one random location bombed, or you may get all locations bombed. Honestly, I think that error made it better, because you never know when or where it will happen, so the unpredictability makes it more fun and exciting.
 
@FAQdaworld
I'll take a look later tonight. Same map? (Chernarus) If what he said is what's happening to you, the sirens aren't playing because they're probably before the change in position selection. We will figure it out. And great news you got it working on the first server!
One last relevant question, how are you calling the script, and are you using the most updated version?


@Dlcoates1
Would you mind pointing it out? I must have missed something in my edits, hard to see errors after coding all day.
I'll make two versions, one with random number of selections too, don't worry, I think that's a great feature too. I would like to understand it better so I can make the next version even better. Thanks in advance, and thanks for letting me know!

I'm still learning arma scripting so there are bound to be mistakes and inefficiencies, I will work on them.

I'm working on a general script to select from a massive array of locations ["city name",[x,y,z]] using the same floor(random) switch case method, but I've been running into errors on server start (missing a semi colon it says, but I can't say where).

I won't actually be at my machine until later tonight to test guys, I will continue to try to respond on my phone.
 
Didnt realize that you had updated it while I was working on it. I'll try to implement it for the next restart of the server.

It's being called exactly how it was described . I'll take another look at it tonight and let you know what I come up with.
 
Sorry about that, I was a little hasty in posting it and to say the least I found some bugs. My understanding has come a long way today:) Let me know what you come up with
 
@Dlcoates1
Would you mind pointing it out? I must have missed something in my edits, hard to see errors after coding all day.
I'll make two versions, one with random number of selections too, don't worry, I think that's a great feature too. I would like to understand it better so I can make the next version even better. Thanks in advance, and thanks for letting me know!

I'm still learning arma scripting so there are bound to be mistakes and inefficiencies, I will work on them.

I'm working on a general script to select from a massive array of locations ["city name",[x,y,z]] using the same floor(random) switch case method, but I've been running into errors on server start (missing a semi colon it says, but I can't say where).

I won't actually be at my machine until later tonight to test guys, I will continue to try to respond on my phone.

From my current knowledge of C++ and what I have worked on in Garry's Mod on Expression 2 (A dumbed down version of C++ and C# as well as Lua), you need to make 2 separate calls. You are currently using 1 expression to call the amount of locations and the positions of the locations for the bombings.
Code:
_rndLoc=floor(random 6);
_place=
switch (_rndLoc) do
{
case 0: {"Electro"};
case 1: {"Berezino"};
case 2: {"NEAF"};
case 3: {"Stary"};
case 4: {"Vybor"};
case 5: {"Gorka"};
};
diag_log format ["AIRRAID: Random Location: %1 | %2",_rndLoc,_place];
    _position=
    switch (_rndLoc) do
    {
      case 0: {[10480.6, 2217.8, 1.5]};
      case 1: {[12043.9, 9091.3, 1.5]};
      case 2: {[12073.9, 12724.3, 1.5]};
      case 3: {[6143.6, 7721.5, 1.5]};
      case 4: {[3815.1, 8865.0, 1.5]};
      case 5: {[9659.0, 8795.3, 1.5]};
    };

You should separate this into 2 different functions. 1 function will call a random location and attempt to execute the script, while the second will check to see if only one location is checked, and if it turns out that only 1 was called, it will continue the script and the raid will commence.

Sometimes, it is easier to be simple with things. If need be, just dumb it down, no need to do anything extremely complex. ArmA 2's engine can honestly handle the simplest of C++ code.
 
From my current knowledge of C++ and what I have worked on in Garry's Mod on Expression 2 (A dumbed down version of C++ and C# as well as Lua), you need to make 2 separate calls. You are currently using 1 expression to call the amount of locations and the positions of the locations for the bombings.


You should separate this into 2 different functions. 1 function will call a random location and attempt to execute the script, while the second will check to see if only one location is checked, and if it turns out that only 1 was called, it will continue the script and the raid will commence.

Sometimes, it is easier to be simple with things. If need be, just dumb it down, no need to do anything extremely complex. ArmA 2's engine can honestly handle the simplest of C++ code.


Thank you for showing me. I kind of understand what you mean - use a different function to call the bomb function with the parameters. But I don't understand what you mean to split up

Code:
_rndLoc=floor(random 6);            //pick random number 0-5, whole numbers only
_place=
switch (_rndLoc) do
{
case 0: {"Electro"};                            //here I'm simply setting _place as a string to give a diag.
case 1: {"Berezino"};                        //_place string is only used in the next diag_log to make it easy to see where
case 2: {"NEAF"};
case 3: {"Stary"};                                //as I understand it, switch case selects only one of the cases based on the number _rndLoc
case 4: {"Vybor"};
case 5: {"Gorka"};
};
diag_log format ["AIRRAID: Random Location: %1 | %2",_rndLoc,_place];          //display location number choice _rndLoc and name of place _place
    _position=
    switch (_rndLoc) do
    {
      case 0: {[10480.6, 2217.8, 1.5]};          //here I'm setting _position to an array of numbers
      case 1: {[12043.9, 9091.3, 1.5]};          //again, only one set of numbers should be selected by switch case with _rndLoc value
      case 2: {[12073.9, 12724.3, 1.5]};
      case 3: {[6143.6, 7721.5, 1.5]};
      case 4: {[3815.1, 8865.0, 1.5]};
      case 5: {[9659.0, 8795.3, 1.5]};
    };
I've commented the above code to show where I'm confused.

Basically, the two switch case methods should only select one position per loop, based on the value 0-5 that _rndLoc returns. Is there a mistake in the rest of the code that is causing multiple positions to be selected, that I missed? I've been staring at this for hours, but I just had a break so I'm taking another look now. Or is it just something behaving in a way that I didn't realize? And yes, I've tried to go with simplicity, but as an amateur, I'm sure I'm spending some time doing things the long way. Like createvehicle.

By separate into two functions, do you mean completely move the selection code to a new function, calling the second function once it has acceptable parameters?
Something like this, which I have been working on?

Currently it's throwing an error (shown following the code) about a missing ; but I cant for the lift of me figure out where. EDIT: FIXED!

Code:
_loc = ["BalottaAirstrip",1.5,4829.9868,2450.1104];
_city = "BalottaAirstrip";
_x = 4829.9868;
_y = 2450.1104;
_z = 1.5;
_coords = [_x,_y,_z];
_tries = 20;
diag_log format ["RANDOM WORLDSPACE: Initializing... %1 | %2 %3 %4|",_city,_x,_y,_z];
sleep 1;
///////////////////////////////////////////////selector
While {_tries > 1} do {
_rndSel=floor(random 49); //select random number 0-49, then set loc based on the case number
_loc=
switch (_rndSel) do {
case 0: {["BalottaAirstrip",1.5,4829.9868,2450.1104]};
case 1: {["Berenzino",1.5,12954.624,9783.1533]};
case 2: {["Bereznio2",1.5,12043.963,9091.3477]};
case 3: {["BlackMountain",1.5,10276.416,12049.6640]};
case 4: {["Bor",1.5,3320.1643,3938.3496]};
case 5: {["Cherno",1.5,6743.8853,2581.1865]};
case 6: {["DevilsCastle",1.5,6891.9189,11438.73]};
case 7: {["DonsCamp",1.5,7788.2856,12613.048]};
case 8: {["Drozhino",1.5,3442.2849,4955.7129]};
case 9: {["Dubrovka",1.5,10445.011,9868.9912]};
case 10: {["Electro",1.5,10480.69,2217.8027]};
case 11: {["Factory",1.5,13060.078,7094.0596]};
case 12: {["Gorka",1.5,9659.084,8795.334]};
case 13: {["Grishno",1.5,5979.6953,10343.341]};
case 14: {["Guglovo",1.5,8517.8682,6676.3276]};
case 15: {["Gvozdno",1.5,8614.4316,11868.967]};
case 16: {["Kabanino",1.5,5318.8369,8602.6328]};
case 17: {["Kamyshovo",1.5,12127.406,3496.2185]};
case 18: {["Khelm",1.5,12290.833,10904.328]};
case 19: {["Komarovo",1.5,3654.0908,2475.9468]};
case 20: {["Kozlovka",1.5,4483.6777,4616.1675]};
case 21: {["Krastonav",1.5,11212.624,12256.609]};
case 22: {["Lopatino",1.5,2780.3135,10018.82]};
case 23: {["Moglievka",1.5,7544.5845,5148.7822]};
case 24: {["Msta",1.5,11275.323,5495.4053]};
case 25: {["Myshkino",1.5,2019.2487,7327.7178]};
case 26: {["Nadezhdino",1.5,5846.4434,4706.708]};
case 27: {["NEAF",1.5,12073.906,12724.305]};
case 28: {["Nizhnoye",1.5,13002.393,8285.8574]};
case 29: {["NovySobor",1.5,7074.4854,7683.4883]};
case 30: {["NWAF",1.5,4480.0781,10375.544]};
case 31: {["Orlovets",1.5,12146.174,7266.5801]};
case 32: {["Pavlovo",1.5,1693.9392,3845.0657]};
case 33: {["Petrovka",1.5,5014.1143,12493.039]};
case 34: {["Pogorevka",1.5,4473.5957,6411.3198]};
case 35: {["Polana",1.5,10753.393,8132.6606]};
case 36: {["Prigorodki",1.5,7976.5557,3299.5386]};
case 37: {["Pulkovo",1.5,4915.0903,5605.6401]};
case 38: {["Pusta",1.5,9156.2549,3897.7598]};
case 39: {["Pustoshka",1.5,3072.9629,7945.4404]};
case 40: {["Rogovo",1.5,4808.0024,6805.0518]};
case 41: {["Shakhovka",1.5,9654.5244,6555.2583]};
case 42: {["Solnichny",1.5,13454.279,6233.647]};
case 43: {["Soosnovka",1.5,2528.7561,6354.9839]};
case 44: {["Staroye",1.5,10140.659,5434.4302]};
case 45: {["StarySobor",1.5,6143.6167,7721.5176]};
case 46: {["Tulga",1.5,12803.296,4450.7466]};
case 47: {["Vybor",1.5,3815.0635,8865.0938]};
case 48: {["Vyshnoye",1.5,6590.3159,6029.1128]};
case 49: {["Zelenogorsk",1.5,2758.7144,5304.3457]};
};
_city = _loc select 0;
_z = _loc select 1;
_x = _loc select 2;
_y = _loc select 3;
_coords = [_x,_y,_z];
diag_log format ["RANDOM WORLDSPACE: %1 | %2",_city,_coords];
sleep 1;
diag_log format ["RANDOM WORLDSPACE SELECTED: %1 | City: %2 | Coords: %3  %4 |||Try %5",_rndSel,_city,_x,_y,_tries];
_tries = _tries - 1;
};
sleep 2;
diag_log format ["RANDOM WORLDSPACE: %1 | Going to shutdown",_tries];
exit
EDIT: FIXED !
If you're still reading, thank you so much for the help. I have one last question, which I am currently researching. What is the best way to separate these into two files, where the random worldspace code calls the bomb code?
 
Does anyone know the difference between calling it from a vehicle init in the mission sqm, or just calling it from the init.sqf?

One last silly question - there is no way that because of the way it is called, it is running for each client that is connecting separately? No, right?

Trying to figure out why some people are having multiple bombings at once, and how it works with custom map packs that might alter the sounds. (to test your sounds playing at all, add a line for playSound "nam"; or whatever, which will play the sound server wide)
So far, I haven't been able to reproduce your problems.
 
I am thinking something like this (Not exact coding, since I am still learning its the best way for me to express this as an example)

onStart (_randomLocation choose)
{
1
2
3
4
5
}

if (_randomLocation == 0) then
{
bomb pos=[10480.6, 2217.8, 1.5]
};

if (_randomLocation == 1) then
{
bomb pos=[12043.9, 9091.3, 1.5]
};

And so on and so forth. Even though I am a newbie as well, some things are easy to understand, for example, your code where it selects both the number of locations and the location positions in the same string, hence why there are multiple bomb raids at once.
 
Thanks for the help man. Where does my code select number of locations? I can't find that anywhere, and I'm pretty sure I never defined it. Here's a summary of what I believe happens.

My code runs as a loop while repeat > 1, selecting a new random number _rndLoc (this does nothing but is used to select the correct case, unless I've somehow included it somewhere else).

After it generates _position's value (array [x,y,z]) which is the location data, _xpos and _ypos select the first two values (x,y) and then _targetpos is generated from them, with a z of 1.5 (array type again, probably redundant).

Then,we create the target (as in, where to bomb/siren) called _target (vehicle object) - which has it's position generated from a position _loc call. - which has the _targetpos as it's value. (again, roundabout, but it finally worked this way so I've kept it so far).

I compare those values (the diag_log that contains SHOULD MATCH) - position _target and _targetpos, values always match for me.

Then finally, we get to spawning in the siren sounds for a few mins, vehicles created based on position _target. After the sirens run, bombs start to drop, controlled by their own loop while seconds > 1. The bomb vehicle objects are also called from position _target.

After that, it's just loops ending and cleanup. I just don't see where it could be selecting the number of locations.


As for what you are suggesting with the if statements, that is what switch case does.
Read here, I found it informative.
http://community.bistudio.com/wiki/Control_Structures
It would be a pain to do that way for a long list like I intend to create and am working on at the moment (see the last bit of code in my last post) EDIT: see new post (in sig) about random worldspaces - sarge responded with some helpful advice about arrays.
 
Back
Top