Shadow.D. ^BOB^
Offline
|
 |
« on: 16 Feb 2009, 13:41:50 » |
|
Hey guys, i was hoping someone would be able to help me develop an IDF Attack simulation. Basically i have a recording of an IDF Alarm, i would like to try and simulate an attack for my Afghan Village template. The idea would be to have the alarm sound at random times throughout the day/night from a certain point, then have a spawned shells (possibly grenades) drop randomly in say a 500m radius around that point or another defined point (game logic or whatever). Having the attack last for say 1-5 minutes, i know there would be alot of random variables in this and I hope that it makes sense. I think it would really add something different for people making missions based on current military operations. I'm a complete noob when it comes to making scripts, if anyone could help me with this i would be very very very  grateful. Thankyou in advance for any help.
|
|
|
|
« Last Edit: 16 Feb 2009, 13:48:18 by Shadow.D. ^BOB^ »
|
Logged
|
|
|
|
laggy
Offline
"Behold a pale horse"
|
 |
« Reply #1 on: 16 Feb 2009, 15:19:53 » |
|
Hi, Made a simple .sqs file, could make a .sqf, but since I'm slower with that...  This script is so simple that .sqf won't make a performance difference anyway. Solution: An object called speaker (in my mission a roadcone). A gameLogic called attackcenter. A Radio alpha trigger that sets varable IDFattack to "true". If you want to alter the "area size" being attacked, just change the "+ 50 - random 100" numbers to i.e "+ 500 - random 1000". init.sqs[] exec "IDF.sqs" IDF.sqs#start
@ IDFattack
speaker say "IDFalarm"
? ! (isServer) : IDFattack = false; goto "start"
_attacklength = 60 + random 240 _time = 0
#loop
? _time >= _attacklength : goto "end" _delay = 5 + random 5 ~ _delay _boom = "Sh_120_HE" createVehicle [(getpos attackcenter select 0) + 50 - random 100,(getpos attackcenter select 1) + 50 - random 100, 50] _time = _time + _delay goto "loop"
#end
IDFattack = false goto "start" Use the trigger and see the effect. If you really want to have random attack times all through the day you could easily accomplish that with a looping script that sets IDFattack = true at random times. Don't forget to use publicVariable if you want it to work in MP. Since I don't have a sound called "IDFalarm" you get an error message, but I hope you know how to define sounds in .ext and sound folder. Example mission included. Hope it's good enough  Laggy
|
|
|
« Last Edit: 16 Feb 2009, 15:29:32 by laggy »
|
Logged
|
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.
|
|
|
Shadow.D. ^BOB^
Offline
|
 |
« Reply #2 on: 16 Feb 2009, 15:59:45 » |
|
M8 the fact that you have taken the time to do this, is just a prime example of the OFP/ArmA community.  Thanks alot, i will try this out asap. EDIT:- This is near perfect Laggy, just a couple of questions. How exactly would i go about making this MP compatible and looping randomly throughout the day? Also could it be activated via the init.sqf at mission start, rather that on a radio trigger? Fantastic job tho m8, wish i could get me head around scripting. 
|
|
|
|
« Last Edit: 16 Feb 2009, 16:17:38 by Shadow.D. ^BOB^ »
|
Logged
|
|
|
|
laggy
Offline
"Behold a pale horse"
|
 |
« Reply #3 on: 16 Feb 2009, 16:32:11 » |
|
init.sqs[] exec "IDF.sqs"
? ! (isServer) : exit
#loop _timetowait = 3600 + random 3600 ~ _timetowait IDFattack = true publicVariable "IDFattack" goto "loop"
Unless I'm stupid (quite busy right now) this should make it start every 1-2 hours, ( 3600 sec = 1 hour) and work in MP. EDIT:  6000 sec != 1 hour  Also about scripting, It's not much more complicated than triggers as long as you study what all the commands can do, vacuum clean the COMREF! I am not a really good scripter (suck at math and logic), have to bother this forum a lot with my questions, but you learn a lot from copying and pasting as well as starting of with smaller self made scripts, where you work on them until they work as you want them to. Look at scripts that you like and try to figure out how they work. I am just starting off with .SQF and find myself as a newbee, compared to working in .SQS, so just get started mate. Laggy
|
|
|
|
« Last Edit: 16 Feb 2009, 17:29:47 by laggy »
|
Logged
|
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.
|
|
|
Shadow.D. ^BOB^
Offline
|
 |
« Reply #4 on: 16 Feb 2009, 17:40:29 » |
|
First of all let me reiterate what i said about this community being the best.  Laggy this script works perfectly, just what i was looking for. I have tested it with a lower time randomness and it all seems great. Will do some more testing in MP once its implemented into my template, but i cannot thank you enough for this. I will definatly look into scripting a bit more, like u say its spending the time and starting small. (All my free time is going into making missions atm.) Once again thankyou for this, i will make sure you are credited once the template is complete.
|
|
|
|
« Last Edit: 16 Feb 2009, 17:44:34 by Shadow.D. ^BOB^ »
|
Logged
|
|
|
|
laggy
Offline
"Behold a pale horse"
|
 |
« Reply #5 on: 16 Feb 2009, 17:47:30 » |
|
 Mission making is really what it's all about Eh?  Script making is just one way of trying to make better missions. In OFPres the original missions didn't include many complicated scripts, but were still some of the best missions to play in my opinion. Laggy
|
|
|
|
|
Logged
|
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.
|
|
|
|
|
laggy
Offline
"Behold a pale horse"
|
 |
« Reply #7 on: 16 Feb 2009, 19:12:58 » |
|
Not a very slimmed solution, but quick to implement, is to have a third script: init.sqs[] exec "IDF.sqs" [] exec "alarmsound.sqs"
? ! (isServer) : exit
#loop _timetowait = 3600 + random 3600 ~ _timetowait IDFattack = true publicVariable "IDFattack" goto "loop"
IDF.sqs#start ? ! (isServer) : exit
@ IDFattack
_attacklength = 60 + random 240 _time = 0
#loop
? _time >= _attacklength : goto "end" _delay = 5 + random 5 ~ _delay _boom = "Sh_120_HE" createVehicle [(getpos attackcenter select 0) + 50 - random 100,(getpos attackcenter select 1) + 50 - random 100, 50] _time = _time + _delay goto "loop"
#end
IDFattack = false publicvariable "IDFattack" goto "start"
alarmsound.sqs#loop ? IDFattack : speaker say "IDFalarm" ~12 goto "loop"
Just make sure the ~ delay in alarmsound.sqs is not shorter than your soundfile, as that might "pile up" your sounds, so that it continues to play long after the attack is over. At least I believe so. Like I said, not beautiful, but should work well  Some .SQF master could make a much more elegant solution
|
|
|
|
« Last Edit: 16 Feb 2009, 19:29:07 by laggy »
|
Logged
|
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.
|
|
|
|
|
laggy
Offline
"Behold a pale horse"
|
 |
« Reply #9 on: 16 Feb 2009, 19:15:35 » |
|
 I'm trying for heavens sake...
|
|
|
|
|
Logged
|
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.
|
|
|
Shadow.D. ^BOB^
Offline
|
 |
« Reply #10 on: 16 Feb 2009, 19:39:01 » |
|
Laggy i could kiss you  (Maybe not, lol). How about a night with my missus instead?  Working like a charm, gives a fantastic atmosphere. Still need to do a bit of tweaking with the sound file, but here's an example mission, i've shortened the time to 1/2 minutes for testing. Once again m8, thankyou so much.
|
|
|
|
« Last Edit: 17 Feb 2009, 00:04:34 by Shadow.D. ^BOB^ »
|
Logged
|
|
|
|
laggy
Offline
"Behold a pale horse"
|
 |
« Reply #11 on: 16 Feb 2009, 19:53:01 » |
|
Cool, keep up the good work mate  Maybe add some sound of the shells whizzing through the air before impact too  I'm too busy packing right now though, travelling for a week without PC 
|
|
|
|
« Last Edit: 16 Feb 2009, 20:01:39 by laggy »
|
Logged
|
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.
|
|
|
|
|
|
|
|
|
|