OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Ding on 27 May 2006, 08:20:30

Title: Bullets hitting the ground
Post by: Ding on 27 May 2006, 08:20:30
Ive wondered about this for a while, is it possible to make a script which creates a bullets which hits the ground? so that you dont have to have some AI doing it with a gun, Im asking because I wanted to make a mission which had a greater atmosphere with bullets hitting the ground all over :)
Title: Re: Bullets hitting the ground
Post by: The-Architect on 27 May 2006, 08:26:02
Code: [Select]
; minigun.sqs
; Syntax:
; [marker object,time in seconds,radius in metres,rate of fire in rounds per min] Exec "minigun.sqs"

; notes
; bullets 'fired' at 30 degree angle to maximise chance of hitting something,
; point of aim is offset from target object to compensate.
; _radius = random _strikeradius - linear distribution
; _radius = _strikeradius * (random 1)^2 - concentrates fire on point of aim
; _radius = _strikeradius * sqrt (random 1) - even spread across area



_markerobj = _this Select 0
_firetime = _this Select 1
_strikeradius = _this Select 2
_rateoffire = _this Select 3

_strikex = GetPos _markerobj Select 0
_strikey = (GetPos _markerobj Select 1) - 6
_delay = 60 / _rateoffire

_stoptime = time + _firetime


#fire
; POI
_angle = random 360
; _radius = random _strikeradius
; swap with either to taste:
; _radius = _strikeradius * (random 1)^2
 _radius = _strikeradius * sqrt (random 1)


_strike = "Bullet12_7W" CamCreate [_strikex + (_radius * Sin _angle),_strikey + (_radius * Cos _angle),3]
; _strike = "Bullet7_6W" CamCreate [_strikex + (_radius * Sin _angle),_strikey + (_radius * Cos _angle),3]
_strike SetVelocity [0,500,-300]
~_delay
?(time > _stoptime): exit
Goto "fire"

exit

Title: Re: Bullets hitting the ground
Post by: Ding on 27 May 2006, 11:03:30
Thanks I'll give it a go and see if I can get anywhere with it :D

thanks alot it works perfectly
Title: Re: Bullets hitting the ground
Post by: The-Architect on 27 May 2006, 11:29:40
I usually bump the rounds per minute up to about 100 000.