Jump to content
Sign in to follow this  
Grinman

Limiting Static Defenses to certain Fields of fire

Recommended Posts

Hi guys

I need a way to keep something like an M119 firing in a certain area, so that it doesn't swing out into its gun emplacement / follow helicopters going overhead/turn right round

so that basically its rotation would be limited a certain amount in each direction, like this

\ /

\ / < Field of fire

\ /

m119

Share this post


Link to post
Share on other sites

Ah but herin lies the problem: The gun will swing through the hole in the wall, so that the barrel will just ghost through the wall

Basically I want to limit the range of movement so it cannot just go 'through' solid objects

Share this post


Link to post
Share on other sites

Hmm, thats not strictly true.

I have something which will help you on your quest:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;watch script for searchlights 0.2

;written by Blanco

_unit = _this select 0

_dis = 200

#loop

?!alive _unit : exit

_dir = random 360

_steps = random 350 + 10

_steps = _steps - _steps %1

~2

_x = 0

_i = -1

_maxheight = 360

_minheight = 2

_inc = -0.2

_height = (5 + random 55)

~1

?random 2 < 1 : _i = 1

?random 2 < 1 : _inc = 0.2

#steps

?!alive gunner _unit : goto "unitdied"

_dir = _dir + _i

?_dir < 0: _dir = _dir +360

?_dir > 360: _dir = _dir -360

_upos = getpos _unit

_cposx = _upos select 0

_cposy = _upos select 1

_cposz = _upos select 2

_height = (_height - _inc)

?(_height > _maxheight) : _inc = 0.2

?(_height < _minheight) : _inc = -0.2

?alive _unit : _unit doWatch [_cposx + ((sin _dir) * _dis), _cposy + ((cos _dir) * _dis),(_height - _inc)]

~0.2

_steps = _steps - 1

?_steps > 0 : goto "steps"

goto "loop"

#unitdied

_gl = "logic" createvehicle [0,0,0]

_gl moveingunner _unit

@!alive _unit

deletevehicle _gl

exit

That is designed for searchlights, they spin slowly and randomly around a 360 axis. You could modify it, so that your static positions revolve around a few degrees only....thats what I did.

Share this post


Link to post
Share on other sites

Ah, slight issues

I can't get the script to run without errors

Plus one small question, would it be possible to make a gun rotate, then, when a trigger is activated by opfor, it follows a set fire plan of rotating, firing, reloading, setting new angle, and rotating again so that it walks a barrage forward? Ofcourse the angle would need to be tweaked to suit wherever the gun is placed but would it be possible?

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  

×