Home   Help Search Login Register  

Author Topic: How to?  (Read 782 times)

0 Members and 1 Guest are viewing this topic.

GI-YO

  • Guest
How to?
« on: 03 Feb 2005, 22:44:22 »
I want to simulate minigun fire from a spooky gunship (Nam era). I was thinking of placing a gamelogic and camcreating bullets on that, I would want to have the bullets in a circul about 30 meters around the GL with a bullets made every 1/4 of a meter. How could this be scripted or done? Hope you can understand what I mean. Thanks in advance.

GI-YO

Offline rhysduk

  • Former Staff
  • ****
Re:How to?
« Reply #1 on: 03 Feb 2005, 23:42:18 »
Cant help with the scripting.. ask one of the pro's

But this might be off help to you.

You can camcreate the bullets, if possible, and set their direction and velocity towards the unit.

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

GI-YO

  • Guest
Re:How to?
« Reply #2 on: 04 Feb 2005, 13:38:40 »
thanks rhysduk, maybe its me being stupid but I cant see which script your pointing out to me, is it Easy AI Artillery (UA Compatible) by General Barron?
Thanks for the help.

GI-YO

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:How to?
« Reply #3 on: 04 Feb 2005, 14:28:25 »
Untested, but maybe a step towards what you're looking for:

Code: [Select]
; [marker object,time (seconds),radius (metres),rate of fire (rounds per min)] Exec "minigun.sqs"

_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
_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 = "Bullet7_6W" CamCreate [_strikex  + (_radius * Sin _angle),_strikey  + (_radius * Cos _angle),2]
_strike SetVelocity [0,0,-500]
~_delay
?(time > _stoptime): exit
Goto "fire"

exit

These are for random scatters - might look wrong if it's too geometric (also more maths and loops).

Use GetMarkerPos if you mark with markers instead of objects.

Bullets appear 2m above ground so they have a chance of killing something if that's required.
« Last Edit: 05 Feb 2005, 18:23:42 by ACF »

GI-YO

  • Guest
Re:How to?
« Reply #4 on: 04 Feb 2005, 14:36:29 »
Awesome i'll have a play and see what it looks like, thanks ACF! :wave:

GI-YO

EDIT  :help:
Im getting the error "_strike = "Bullet7_6W" CamCreate [_strikex  + (_radius Sin _angle),_strikey  + (_radius Cos _angle),2]: error unkown operator Sin"

Im calling the script like this [target, (30), (40), (1000)] Exec "minigun.sqs" and target is an empty jeep.
Im know scripter so i cant see whats wrong with this, any ideas? Thanks for the script and any help recieved.
« Last Edit: 04 Feb 2005, 14:54:42 by GI-YO »

Offline rhysduk

  • Former Staff
  • ****
Re:How to?
« Reply #5 on: 04 Feb 2005, 15:03:03 »
Sorry GIYO,

The "chain" snippet/script by Igor Drukov is what i was pointing you too.

Never call a script like this:

[target, (30), (40), (1000)] Exec "minigun.sqs".. Instead use quotation marks like so:

[target, "30", "40", "1000"] Exec "minigun.sqs"

Seeing as they are numbers, i dont think you need teh quotation marks there. Theres a certain value you need to quotate, like a string for example.

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:How to?
« Reply #6 on: 04 Feb 2005, 15:09:35 »
Ah-ha (sorry!)

Missed out the "*" in:

Code: [Select]
_strike = "Bullet7_6W" CamCreate [_strikex  + (_radius * Sin _angle),_strikey  + (_radius * Cos _angle),2]

Had my trig head on.

Regarding the execution:

[myjeep, 30, 40, 1000] Exec "minigun.sqs"

Sorry - brackets in the comment were to state the units.  Calkling a jeep 'target' might be a problem in itself as I think it's a class name.

Any better?

GI-YO

  • Guest
Re:How to?
« Reply #7 on: 04 Feb 2005, 15:32:15 »
Thanks for all the help I'll have to check this out tomorow now cause i have to go to work soon :(. But thanks again!

GI-YO

GI-YO

  • Guest
Re:How to?
« Reply #8 on: 05 Feb 2005, 17:10:33 »
right then i'm getting another error now :

'_strikex =  _markerobj Select 1[ # ]':error select: type object, expected array

Can anyone see whats happening with this? Thanks for all the help so far this script looks awesome!:thumbsup:

GI-YO
« Last Edit: 05 Feb 2005, 17:11:15 by GI-YO »

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:How to?
« Reply #9 on: 05 Feb 2005, 18:22:54 »
_strikex =  GetPos _markerobj Select 0
_strikey =  GetPos _markerobj Select 1

Really should eat my lunch OR script, not try to multitask!

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:How to?
« Reply #10 on: 05 Feb 2005, 19:00:16 »
To atone for my sins - a tested version reposted for clarity:

Code: [Select]
; minigun.sqs

_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

; 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

If 7.62 doesn't cut the mustard, swap with the 12.7!  As it's posted it defaults to a concentrated burst.  Just remember troops won't react to camcreated rounds.

GI-YO

  • Guest
Re:How to?
« Reply #11 on: 05 Feb 2005, 19:32:06 »
:thumbsup: eggselent stuff :thumbsup:. You should put this script into the ed department if you havent already, the world needs this kind of thing, especialy those 'Nam missions. Keep up the good work.

GI-YO

EDIT
just given this a test. one word. awesome just what i was looking for. i recomend this script to anyone who wants addon free gunship support.
« Last Edit: 05 Feb 2005, 21:00:07 by GI-YO »