Jump to content
Sign in to follow this  
Rivers

Artillery

Recommended Posts

First of all I have read the previous discussions, I have downloaded and tested scripts about artillery, but it hasn`t done what I had expected to be done.

My wish is for a certain unit, in this case mortar or cannon (I have this ww2 stuff) to simply shell a certain area. The best I can achieve is that for example my mortar fires using command mortar dofire enemy.

It only works when my mortar actually sees the target.

So my aim is that my mortar can shell the area I want from distance without seeing it. In this case the dofire command doesn`t work properly.

I`m sure it can be achieved, but the scripts I have checked use different methods.

I hope you understood my issue.

Share this post


Link to post
Share on other sites

Hi,

there's a lot of scripts around that kind of trouble, from invisible targets scripts to GenB indirect fire etc.

I'm using simple things that are effective :

(1) Put some triggers on the map, for example activable by West, spotted by East, repeatable.

(2) Write this in the on activation line of the triggers :

{[_x,"Name_Of_the_canon/mortar",getpos (thislist select 0)] exec "fireAtTarget.sqs"} foreach [sh1,sh2,sh3,sh4,sh5]

where you must replace "Name_Of_the_canon/mortar" by the config name on your weapons (which should also be the name of the magazine fired by the canon, if not the script should be adapted) ; sh1...sh5 are the name of mortars in this example.

(3) Copy and paste the following script, and name it FireAtTarget.sqs :

id="CODE">_shooter = _this select 0
_mag = _this select 1
_target = _this select 2
_t = 0
_toShoot = "logic" camcreate [0,0,0]
_toShoot setpos _target
~random 10

#loopy
dostop _shooter
_shooter dowatch getpos _toShoot
_shooter reveal _toShoot
~random 0.5
_shooter reveal _toShoot
_shooter dotarget _toShoot
_shooter fire [_mag,_mag]
_t = _t + 1
~9
? (_t < 5): goto "loopy"
deletevehicle _toshoot
exit 

(4) Once a unit is spotted by enemy (snipers for example) in the trigger, mortars begin to fire at the position where it was spotted, 5 times.

(5) If mortars or canons refuse to shoot, you may adapt the height of the game logic created (replace :

_toShoot = "logic" camcreate [0,0,0]

by

_toShoot = "logic" camcreate [0,0,5] for example).

Edited by W0lle

Share this post


Link to post
Share on other sites

So I can also make it possible for different conditions dor them to fire? LIke using radio, or when I enter area etc..?

I`ll try and give feedback wink_o.gif

Share this post


Link to post
Share on other sites

Do I need to edit anything else in the script, or just adapt the height? They refuse to shoot, so I have to adapt the height, right?

The cannon turns to the palce where they should shoot, but no shot is fired...I guess it`s height which makes them not to shoot, right?

Share this post


Link to post
Share on other sites

Yes, it depends on the elevation capacity of the gun.

The other trouble maybe the canon magazine name, so the fire command does not work. To check this, if you duno canon magazine name, put the canon on a map and write this in the init line of it :

hint format["magazine name : %1", magazines this]

Put the name of the magazine in the script launcher, i mean replace :

{[_x,"Name_Of_the_canon/mortar",getpos (thislist select 0)] exec "fireAtTarget.sqs"} foreach [sh1,sh2,sh3,sh4,sh5]

by

{[_{[_x,"Name_Of_the_magazine",getpos (thislist select 0)] exec "fireAtTarget.sqs"} foreach [sh1,sh2,sh3,sh4,sh5]

Edited by W0lle

Share this post


Link to post
Share on other sites

OMG huh.gif It works smile_o.gif

Thank you so much. The trouble was with the magazien name...I thought it was FGLak 36, while actually it wasn`t smile_o.gif

Thnx a lot, you really helped me a lot. smile_o.gif

The only thing is they shoot a bit too close. Just about halfway where I want. I suppose I have to edit the height now, right?

I found the prob: There were some mountains in front of my cannons. Now I will try with mortars

Thnx a lot. More or less it all works liek I want it to be working...

Share this post


Link to post
Share on other sites

Happy that it works. It's not perfect but quite easy to use. I've never been happy with more complicated scripts...

What's nice is that artillery doesn't shoot precisely but try to aim then is ordered to fire. You can also randomize the position of the game logic, so that it's placed "randomly around" the place that was first spotted, to simulate some artillery errors.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×