OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect on 08 Jan 2009, 00:39:27

Title: Old Flashpoint script
Post by: The-Architect on 08 Jan 2009, 00:39:27
Can any of you guys figure this out? I want to be able to use this old OFP script in ArmA but when I try it does nothing. I know you have to change the ammo to ArmA ammo but that didn't work either. Where's Macguba when you need him?

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: Old Flashpoint script
Post by: Mandoble on 08 Jan 2009, 00:51:31
camCreate -> createVehicle
Title: Re: Old Flashpoint script
Post by: The-Architect on 08 Jan 2009, 03:49:25
Sweet that worked a treat.

Now, I tested this with three enemy groups and a fire time of 60 seconds. After about 10 tries I got an average death rate of about 4 bad guys per minute. How can I get that up? I presume I could change the angle so that the rounds were flying almost horizontally, thus covering more ground before they hit anything.

Unfortunatley I have no Idea what I'm doing and tampering with the script caused some undesirable side effects.

Any ideas on how to increase the body count? Reducing the target area isn't really an option.

EDIT: I decided to just use bigger rounds. I dug up some AC130A literature and found that they had 20mm bofors so using 20mm rounds from ArmA isn't a bad thing.

Here's the next problem.

How do I edit this script to be able to use onmapsingleclick?
Title: Re: Old Flashpoint script
Post by: Tyger on 09 Jan 2009, 16:37:36
Code: [Select]
; minigun.sqs
; Syntax:
; [position from map click,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 = (_this select 0) Select 0
_strikey = ((_this select 0) 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

The map click command would then be:
Code: [Select]
onMapSingleClick "[_pos,myTime,myRadius,myROF] exec 'minigun.sqs'"
where myTime, myRadius, and myROF are the values you wish to insert. _pos is a variable passed by the onMapSingleClick command.

If you wish to disable the map click after it's been executed, use this command instead:
Code: [Select]
onMapSingleClick "[_pos, myTime, myRadius, myROF] exec 'minigun.sqs'; onMapSingleClick ' ';"

[EDIT] That should work - if it doesn't I'll give it a run when I can play in ArmA.
Title: Re: Old Flashpoint script
Post by: The-Architect on 09 Jan 2009, 22:41:19
Cool. This is pretty awsome. Here is what I changed to make it ArmA compatible. Thanks to those above. Give it a try.

Code: [Select]
; minigun.sqs
; Syntax: onMapSingleClick "[_pos,myTime,myRadius,myROF] exec 'minigun.sqs'"
; [position from map click,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 = (_this select 0) Select 0
_strikey = ((_this select 0) 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 = "B_30mm_HE" createvehicle [_strikex + (_radius * Sin _angle),_strikey + (_radius * Cos _angle),3]
; _strike = "B_30mm_HE" createvehicle [_strikex + (_radius * Sin _angle),_strikey + (_radius * Cos _angle),3]
_strike SetVelocity [0,500,-300]
~_delay
?(time > _stoptime): exit
Goto "fire"

exit

Now, wouldn't it be cool if it were a fully operational script with added chatter to get fully immersive? How would I have it so that when the map was clicked, a radio message would pop up giving the grid square I'd just clicked on? and then another message confirming the grid square click? Sorry to pick your brains.