Home   Help Search Login Register  

Author Topic: Realistic artillery-script  (Read 6602 times)

0 Members and 1 Guest are viewing this topic.

Offline skickahit10

  • Members
  • *
  • I'm a llama!
Realistic artillery-script
« on: 27 Sep 2007, 22:46:13 »
"It is time..."

After some hard work I've written a pretty well working script for artillery fire!!! I originally posted it over at BI:s official forum (http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?act=ST;f=70;t=68597), but someone adviced me to post it here as well. So here we go:

This is no bullshit where shells will appear out of nowhere, this is the actual guns (M119s) in ArmA aiming and firing their weapons. All you have to do is click on the map and you'll have artillery shells raining down there within a minute or so!

Download from: here.

Then extract to \My Documents\ArmA\missions\

A complete walk through (read it before using the script) can be found here (included in the zip-file as well)

I'm very proud of this script - try it out and let me know what you think!  :P

Screenshot 1

Screenshot 2
« Last Edit: 28 Sep 2007, 00:01:51 by skickahit10 »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Realistic artillery-script
« Reply #1 on: 27 Sep 2007, 22:53:38 »
That's great, but the place for this is the beta submissions forum. Sure someone will move it there in the very, very near future and then we can test it properly and hopefully be able to host it for you!
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: Realistic artillery-script
« Reply #2 on: 27 Sep 2007, 22:57:14 »
I moved it for you. Nice script btw.
Xbox Rocks

Offline skickahit10

  • Members
  • *
  • I'm a llama!
Re: Realistic artillery-script
« Reply #3 on: 27 Sep 2007, 22:58:48 »
That's great, but the place for this is the beta submissions forum. Sure someone will move it there in the very, very near future and then we can test it properly and hopefully be able to host it for you!

*doh*

ok  :P

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Realistic artillery-script
« Reply #4 on: 27 Sep 2007, 23:32:50 »
Is there an addon required for this?  I got the message "You cannot play/edit this mission, it is dependent on downloadable content that has been deleted:map_misc"   It does look very cool by the way  :)
« Last Edit: 27 Sep 2007, 23:34:51 by LeeHunt »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Realistic artillery-script
« Reply #5 on: 27 Sep 2007, 23:33:17 »
Didnt test the script but checked the code and seems a creative attempt but with some serious limitations. As I understand, you place a vehicle where you want the shell to land and then forces the gun to fire, check where the shell lands and correct the position of the vehicle to fire again if there is a deviation, right? If so, think about the following posibility:
0 - You select a target position.
1 - You calculates the needed initial velocity and dir to reach the target with a "know" shell type of your choice.
2 - knowing the needed initial velocity vector you already know at which distance from the gun the shell should start its descension. You makes the gun to "watch" this position "in the air".
3 - You generates a sound and some nice firing effects with particles.
4 - You creates a real shell and give it the calculated direction and velocity vector.
5 - if the calculation was accurate enough, bullseye  ;)
6 - if not, apply some adjustments.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Realistic artillery-script
« Reply #6 on: 27 Sep 2007, 23:44:09 »
Aha, first comments and suggestions for you from having played around in the demo:

1) Remove the line
Code: [Select]
"map_misc",
from the mission.sqm file.

The script doesn't require the MAP_misc addon, so it shouldn't be required for the demo (did an old version of the script use MAP_misc invisible targets, perhaps?). When I first tried to run the demo is wouldn't work since I don't have the MAP_misc addon installed, but I just removed that line and the demo seemed to be worked fine.

2) There is nothing to stop me spamming artillery requests on the map. I managed to grind the game to a virtual halt by requesting artillery about 20 times in one second. May be a known issue, but as it wasn't mentioned in the readme, I thought I'd mention it here. When I waited for all the fire missions to complete, the game seemed to keep being slow, so I wonder if the scripts aren't terminating properly? (I was still getting a tenth my normal FPS a couple of minutes after the last shell explosion/chat message).

3) I'm not sure if this would work, but if you are limited to 5km range because the shells time-out, have you considered deleting and recreating the shells every 4km? Again, I'll state that I don't know whether this is feasible, but someone else might be able to say so.

Don't think I'm being negative; I think it is great that someone is modelling real physics for deviation rather than the normal "_x = _x + (random30) - (random 30)" dispersion technique ;P Good luck with this in the future!
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Realistic artillery-script
« Reply #7 on: 27 Sep 2007, 23:49:19 »
Look for Planck's ammo life-times here. Having life-times for 20 secs, the "shell" automatically removed by ArmA effect should not be a problem for shots longer than 5km.

Offline skickahit10

  • Members
  • *
  • I'm a llama!
Re: Realistic artillery-script
« Reply #8 on: 28 Sep 2007, 00:07:10 »
Aha, first comments and suggestions for you from having played around in the demo:

1) Remove the line
Code: [Select]
"map_misc",
from the mission.sqm file.

The script doesn't require the MAP_misc addon, so it shouldn't be required for the demo (did an old version of the script use MAP_misc invisible targets, perhaps?). When I first tried to run the demo is wouldn't work since I don't have the MAP_misc addon installed, but I just removed that line and the demo seemed to be worked fine.

2) There is nothing to stop me spamming artillery requests on the map. I managed to grind the game to a virtual halt by requesting artillery about 20 times in one second. May be a known issue, but as it wasn't mentioned in the readme, I thought I'd mention it here. When I waited for all the fire missions to complete, the game seemed to keep being slow, so I wonder if the scripts aren't terminating properly? (I was still getting a tenth my normal FPS a couple of minutes after the last shell explosion/chat message).

3) I'm not sure if this would work, but if you are limited to 5km range because the shells time-out, have you considered deleting and recreating the shells every 4km? Again, I'll state that I don't know whether this is feasible, but someone else might be able to say so.

Don't think I'm being negative; I think it is great that someone is modelling real physics for deviation rather than the normal "_x = _x + (random30) - (random 30)" dispersion technique ;P Good luck with this in the future!


1. didn't notice that. thought that that part was removed from the sqm-file when all mapfact-objects were deleted from the mission. fixed that now though and updated the links.

2. nope, true. I could solve it with an ugly solution using another bunch of invisible objects. should I? or will that make the mission map to cluttered?

3. no haven't tried that. also, like I stated, the drag would make the shell come to a stop anyway after some 5-6 km so that wouldn't help in this case. furthermore my intention from the beginning was to make a script that played by the default ArmA-rules.

Offline skickahit10

  • Members
  • *
  • I'm a llama!
Re: Realistic artillery-script
« Reply #9 on: 28 Sep 2007, 00:15:18 »
Didnt test the script but checked the code and seems a creative attempt but with some serious limitations. As I understand, you place a vehicle where you want the shell to land and then forces the gun to fire, check where the shell lands and correct the position of the vehicle to fire again if there is a deviation, right? If so, think about the following posibility:
0 - You select a target position.
1 - You calculates the needed initial velocity and dir to reach the target with a "know" shell type of your choice.
2 - knowing the needed initial velocity vector you already know at which distance from the gun the shell should start its descension. You makes the gun to "watch" this position "in the air".
3 - You generates a sound and some nice firing effects with particles.
4 - You creates a real shell and give it the calculated direction and velocity vector.
5 - if the calculation was accurate enough, bullseye  ;)
6 - if not, apply some adjustments.

nope, a vehicle is placed in the air above the cannon, so the cannon will aim at the right direction.
for calculating where the shell hits an invisble target is placed on the ground.
the reason why an invisble target isn't placed in the air is because the gun won't aim at it for some reason (and that's when I tried mapfacts' invisble targets as well without any succes).

I don't want to make another "cheat script" by creating shells here and there....I rather have the cannons fire the shells.
what I really want is an invisble target that the gun will aim at. ain't found none yet though...

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Realistic artillery-script
« Reply #10 on: 28 Sep 2007, 00:22:20 »
First, please, dont double-post, use your last post to reply as long as your last post is the last one in a thread.
Second, please, dont quote entire post to reply, with the nick of the person you are replying is more than enough.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Realistic artillery-script
« Reply #11 on: 28 Sep 2007, 00:23:10 »
@ skickahit10
2) I'm not sure why invisible objects would prevent request spamming or stop the scripts which seem to run forever (or at least as long as I was watching). To prevent spamming, just do something like this at the top of the script called when you click on the map:
Code: [Select]
? isNil "lastRequest" : lastRequest = -30
? ((time - lastRequest) < 30) : exit
lastRequest = time

As far as making the scripts exit properly, I assume you are failing to break out of a loop when something has finished. No idea though if that is even the problem, but I only noticed the lag when I requested a lot of fire missions. I'd assume if I requested just one fire mission then there would still be a permanent slowdown, but you wouldn't notice it.

3) Sorry, my mistake.

Quote from: skickahit10
for calculating where the shell hits an invisble target is placed on the ground.
the reason why an invisble target isn't placed in the air is because the gun won't aim at it for some reason (and that's when I tried mapfacts' invisble targets as well without any succes).
What do you mean by "invisible target", since they don't exist in ArmA, only in addons?
« Last Edit: 28 Sep 2007, 00:53:36 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline skickahit10

  • Members
  • *
  • I'm a llama!
Re: Realistic artillery-script
« Reply #12 on: 28 Sep 2007, 00:39:05 »
@ skickahit10

2. I could use the invisible objects to represent different values by moving them to different positions on the map. moving them to [1,0,0] could mean the script is running and moving them to [0,0,0] meaning the script is not running. that's what I meant with an ugly solution.
concerning your solution - isn't a new instance of the script created each time the map is clicked meaning that whatever variables that are set for one instance are reset when another instance start?

I believe the lag is because numerous cpu-heavy caluclations are running at the same time.
you are welcome to check the code for infinte loops though...

3. invisible object/target = helipad ("HeliHEmpty")

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Realistic artillery-script
« Reply #13 on: 28 Sep 2007, 00:49:12 »
Ah, there is absolutely no reason to use objects in the way that you describe to hold state information. Any variable starting with an underscore (e.g. _frog) is local to the current script, but any variable which doesn't have an underscore (e.g. fish) is global to all scripts run on that machine (but not across a network in MP games). Of course, the example I gave uses underscore when it shouldn't, so you can tell me I'm a complete noob :-[ I was too busy worrying about the SQS, which I don't usually use, rather than the commands I was using (I've corrected the example in that previous post now, so not as to confuse anyone in the future).

Quote from: skickahit
you are welcome to check the code for infinte loops though...
Not sure that is my job :whistle:
« Last Edit: 28 Sep 2007, 00:54:21 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline skickahit10

  • Members
  • *
  • I'm a llama!
Re: Realistic artillery-script
« Reply #14 on: 28 Sep 2007, 00:55:41 »

Ah....I'm enlightened....back to work!  :cool2: