Welcome to the Iron Front Fan Forums!
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
BRS

Captain
Registered:
Posts: 195
Reply with quote  #1 
Play around with that some days but I can't figure it out for now:

How do I adjust the elevation of the gun(barrel) by script.
I know that I can use something like: _unit DoWatch [_x_target, _y_target, 5000 ];
to let it looks like, but that  is not what I want.
I want to know the relationship between that last value (here 5000) and the angle of gun elevation.

For example, the ZIS-3 can aim up and down between -5° to + 37°.

Let's say I need an angle of 20°, how do I calcualte the value for the third param now?

0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #2 

Hi there,
i've just seen your post and as no one has answered maybe i can help.I used this in the sqf file and the second group is the guns init line.They do fire though,i don't know if you just want elevation,if that is so i can't help...sorry.Basically it turns the AT guns into artillery pieces.All thanks to this must go to tay-uk for his tireless help in talking me through it.

SQF
;----------------------------------------------------------------------------------------------------------------------------------
;Created by A.Ryan, AKA Taco3866521
;Usage:
; add this line to any artilary gun and modify to suit the terrain, position, and target area.
;
;[Artilary gun name, "Marker name of the target area", Gun barrel height, Target radius, time elapse from when the gun is fired to when the round hits] exec "D30fire.sqs"
;
;Example:
;[D30_1, "D30Targ_2", 5000, 50, 2] exec "D30fire.sqs"
;
;----------------------------------------------------------------------------------------------------------------------------------


_d30=_this select 0

(gunner _d30) disableAI "AUTOTARGET"

_d30TARG1=_this select 1

_GUNHEIGHT=_this select 2

_Radius=_this select 3

_droptime=_this select 4

_GUNHEIGHT2=_GUNHEIGHT+(Random 20)

_X = GetMarkerpos _d30TARG1 select 0;

_Y = GetMarkerpos _d30TARG1 select 1;

_d30 DoWatch [_X,_Y,_GUNHEIGHT];

~(3+(Random 10))

#start
if (isServer) exitWith {};

_d30 setVehicleAmmo 1;

~3
_X3=_X-(Random 20);
_Y3=_Y-(Random 20);
_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X3,_Y3,_GUNHEIGHT2];

?(not alive gunner _d30): exit

_d30 fire "LIB_Pak40"

~_droptime

_X1 = GetMarkerpos _d30TARG1 select 0;

_Y1 = GetMarkerpos _d30TARG1 select 1;

_X1 = _X1+((Random _Radius)-40);

_Y1 = _Y1+((Random _Radius)-40);

_set = ["lib_sh_82_he", "smokeshell", "lib_sh_82_he","smokeshellgreen","F_40mm_red", "F_40mm_green", "F_40mm_yellow","smokeshellred", "lib_sh_82_he","F_40mm_white","lib_sh_82_he","smokeshellblue"];

_explosion = _set select (floor (random (count _set)));

_Bomb= _explosion CreateVehicle [_X1,_Y1,300];

~(5+(Random 3))
_X2=_X+(Random 20)
_Y2=_Y+(Random 20)
_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X2,_Y2,_GUNHEIGHT2];
~3
goto "start"
;?(not alive gunner _d30): exit

;_d30 fire "LIB_Pak40"

;~_droptime

;_X1 = GetMarkerpos _d30TARG1 select 0;

;_Y1 = GetMarkerpos _d30TARG1 select 1;

;_X1 = _X1+((Random _Radius)-40);

;_Y1 = _Y1+((Random _Radius)-40);

;_Bomb="LIB_SprGr34_KWK40_HE" CreateVehicle [_X1,_Y1,0];

;~(5+(Random 3))

;goto "start"

GUNS INIT LINE

[art8, "TARGET1", 9000, 300, 2] exec "D30FIRE&SMOKE&FLARE.sqs";

The art8 is my 8th gun which was firing smoke...hence the reference to "D30FIRE&SMOKE&FLARE.sqs"; which is what the sqf file must be called.

Hope this helps

0
BRS

Captain
Registered:
Posts: 195
Reply with quote  #3 
Thx santiagojamesaea.
Your example script is called by [D30_1, "D30Targ_2", 5000, 50, 2] exec "D30fire.sqs"
It's that 5000, where does this value come from, how is the relationship between that value and elevation angle.
That's what I'm looking for. Let's say I want an elevation of 16 deg, which value to insert as third param of the dowatch.
It's just for fun, I'm just interessted in.
0
Tayuk

Avatar / Picture

Retired Admin/IFR
Registered:
Posts: 456
Reply with quote  #4 
Hi BS, the 5000 is just a big number to make sure gun is at its highest angle, I have been doing a bit of messing and found that if you use the follwing numbers in a trial and error basis to get different angles.


50 = APPROX 5 DEG
100 = APPROX 10 DEG
200 = APPROX 20 DEG
300 = APPROX 30 DEG
400 = APPROX 40 DEG (MAXIMUM)

So seemingly very roughly 10 = 1 degrees, based on putting a protractor on my screen and measuring it. Very scientific and calibrated with my own eye

When I used the script the 1st time on a Pak40 the number was 5000, when i tried it on a russian gun, 5000 didnt work, so I upped it to 9000 for a Russian gun which worked. Today it works at 400 for a full lift, so no idea what was going on then.

0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #5 
Hi there BS,

Tay-UK has said it all and better than me...i got it from him!!

Hope you have had success with the script.By the way,if you do get it to work could you post it?

Cheers
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.