Jump to content
Sign in to follow this  
Blitzen

Artillery and Deployment scripts Questions

Recommended Posts

http://forums.bistudio.com/newthread.php?do=postthread&f=26

Greetings!

I have used the Chain of Command's Unified Artillery system since I first started playing OFP. Though I really, really, really love the system, I find that it seems to be for player use only. I know that you can use the CoCIFCallFire command to intiate AI artillery, but it often times comes too late. Therefore, I've been looking to more basic artilley scripts to simulate enemy fire. Here is a pretty simple yet good one that I found on OFPEC:

; _____________________________________________________
;|##########Artillery Script By Steve Molloy:##########|
;--------------------------------------------------------------------------------------

;Due To:

;Mark Palmer's Explosion Script (markpalmer@hotmail.com)
;which was based on script created by David Berka (David.Berka@nmi.at)
;##########################################


;this is the type of shell - LaserGuidedBomb is the most powerful and also creates a visible shell so I'd stick with it..
;you could experiment with "hellfire" "shell73" and "TOW" to get the result you want
_AmmoType = "CoC_M252MortarShellHeavy"

_unit = _this select 0

;spread is the spread of the x axis and spread2 is for the y axis - use these to make a rectangle impact area eg. bombing bases to hell
_spread = 100
_spread2 =80

;this is gettin the position of the unit you put in the exec line
_Explosion = GetPos _unit

;the number of shells
_Shells = 20

;the delay between each shell being droped anything above 5 seems a little to long to me but experimenting is the key :-D
_delay = 1.4

;##### there's no need for you to do anything below here #####

_counter=0
~5
#beg
~_delay

_cx = _Explosion select 0
_cy = _Explosion select 1
_cz = _Explosion select 2

_cx = _cx + random _spread
_cy = _cy + random _spread2
;this bit lifts the bomb to a high altitude so you can see it falling
_cz = _cz + 1

_tempObj = _AmmoType camCreate[_cx, _cy, _cz]
~0.01
_tempObj = objNull

_counter = _counter + 1

?(_counter == _Shells):exit
goto "beg"

I edited the ammo type to be that of a CoC mortar. However, when the round impacts it dosent have the huge dust and smoke cloud that normal CoC rounds kick up. Im assuming that CoC rounds add this effect via additional scripts?? If so, how can you incorporate those effects into a script like this?

I am also wondering if anyone has a working deployment/movement script for crew served weapons (.50 cal machinegun, etc.)? I found one on OFPEC but I couldnt find a download link.

Thanks a bunch for the help,

Blitzen

Share this post


Link to post
Share on other sites

hi,

Here's a little script I wrote real quickly to move a mortar or any object by addAction. It is SP/MP compatible.

init.sqs

;*************************************************************
;Move crew served weapon Script by Nikiller v0.9b
;Allow the player to move M2 or mortar at his current position
;Note: Doesn't work for AI if you order them
;contact: nikillerofp@hotmail.fr
;Place a mortar named mortar1 somewhere on the map
;*************************************************************
nik_am=mortar1
[] exec "check_menu.sqs"

exit

check_menu.sqs

;*************************************************************
;Move crew served weapon Script by Nikiller v0.9b
;Allow the player to move M2 or mortar at his current position
;Note: Doesn't work for AI if you order them
;contact: nikillerofp@hotmail.fr
;*************************************************************
if (local player) then {} else {goto "ende"}

_ac=false
_d=5

#wait1
~_d
if (vehicle player!=player) then {goto "wait1"}

nik_ac_deploy=player addAction ["Deploy mortar","mortar_deploy.sqs"]; _ac=true

#wait2
~_d
if (vehicle player==player) then {goto "wait2"}
if _ac then {player removeAction nik_ac_deploy; _ac=false}
goto "wait1"

#ende

exit

mortar_deploy.sqs

;*************************************************************
;Move crew served weapon Script by Nikiller v0.9b
;Allow the player to move M2 or mortar at his current position
;Note: Doesn't work for AI if you order them
;contact: nikillerofp@hotmail.fr
;*************************************************************
if (vehicle player!=player) then {exit}
player GroupChat "Deploy mortar here!"
[nik_am,player] exec "place_mortar.sqs"

exit

place_mortar.sqs

_o = _this select 0
_u = _this select 1

_upos=getPos _u
_uposx= _upos select 0
_uposy=_upos select 1
_uposz=_upos select 2
_udir=getDir _u

if (_udir<45) then {_offy = +1; _offx=+1}

if ((_udir>=45) && (_udir<90)) then {_offy=0; _offx=+1}

if ((_udir>=90) && (_udir<135)) then {_offy=-1; _offx=+1}

if ((_udir>=135) && (_udir<180)) then {_offy=-1; _offx=0}

if ((_udir>=180) && (_udir<225)) then {_offy=-1; _offx=-1}

if ((_udir>=225) && (_udir<270)) then {_offy=0; _offx=-1}

if ((_udir>=270) && (_udir<315)) then {_offy=+1; _offx=-1}

if ((_udir>=315) && (_udir<=360)) then {_offy=+1; _offx=0}

titleCut ["","BLACK OUT",1]
~1
_o setDir _udir 
_o setPos [_uposx+_offx,_uposy+_offy,_uposz]
titleCut ["","BLACK IN",1]

exit

cya.

Nikiller.

Edited by Nikiller
code improvment

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  

×