Well, here I am asking for help again.
My Ac-130 script works in basic form, but I wanted to add some realism.
So, what has quiet a few smaller numbers, but not a lot of larger ones? I jumped for Exponential. The exp command wouldn't work in Arma 2, I found out after a lot of time trying to get it to work. Next best thing.
I picked Binary. The script is a bit complicated, but experianced coders will make easy sence of it.
Problem is, this script wont fire. At all. The logic seems right, everything goes just fine. With a bit of tweaking, it now only fires on the spot of the target. You'll see if you run it.
Its meant to spread out around the target. Binary adds the proberbility of the number being smaller, as more shots would hit closer to the target than not.
Heres the script, you can try it yourself.
I started with the IED script by Jeevz, as that gave me the idea. But now, it looks nothing like it. I was going to finish off coments ect once i'd finished the work.
EDIT:Code:; **************************************************************** ; Script file for Armed Assault ; Created by: TODO: Author Name ; **************************************************************** ; AC-130 Gunship Script ; By Niel ; Adapted Jeevz IED script ; v0.1 12/13/06 ; This script will simulate a Ac-130 gunship attack. ; It creates an explosion of a ; selected size on any object when called ; The arguments are [objectName, Size of Ammo] ; Explosion Power will be 1 of 3 choices ; 25mm - Gatling Gun - 15 shots -Good for Anti-Personnel use ; 40mm - Will usually disable a Humvee without killing the occupants ; 125mm - Will usually destroy a passing humvee and kill or severly injure all occupants, will disable the tracks and possibly engine on M1A1 ; Huge - Nothing will survive, I mean... it's HUGE :-) ; Example script call --> [theCar, "Small"] exec "IED.sqs" ;start script _theObject = _this select 0 _theExplosion = _this select 1 ;locate the Object to be blown up _bombLoc = GetPos _theObject _bombLocX = _bombLoc select 0 _bombLocY = _bombLoc select 1 _bombLocZ = _bombLoc select 2 ;Reset Shots Fired, binary and Shots _ShotsFired = 0 _binaryX = 1 _binaryY = 1 _count1=0 _count2=0 _shot1 = 0 _shot2 = 0 _shot3 = 0 _shot4 = 0 ; Deterimine the ordinance used to create the explosion ? (_theExplosion == "25mm") : _ammoType = "B_25mm_HE" ? (_theExplosion == "40mm") : _ammoType = "R_57mm_HE" ? (_theExplosion == "125mm") : _ammoType = "Sh_125_HE" AirAttack sidechat "AC-130 Firing" ; Deterimine the shots used to create the explosion ? (_theExplosion == "25mm") : _ShotsNeeded = (random 10) ? (_theExplosion == "40mm") : _ShotsNeeded = (random 5) ? (_theExplosion == "125mm") : _ShotsNeeded = 1 ;Make Small Explosion Shots Fired Random ? (_theExplosion == "25mm") : _ShotsNeeded = _ShotsNeeded+30 ;Kept if needed ? (_theExplosion == "40mm") : _ShotsNeeded+0 ? (_theExplosion == "125mm") : _ShotsNeeded+0 ;Use Different Spreads ? (_theExplosion == "25mm") : _Spread = 10 ? (_theExplosion == "40mm") : _Spread = 7.5 ? (_theExplosion == "125mm") : _Spread = 5 ;Repeating Fire #loop Goto "Binary" #Shot1 _ammoType createVehicle[_bombLocX + _spreadx, _bombLocY + _spreadY, _bombLocZ] ~0.1 _ShotsFired=_ShotsFired+1 _shot1=1 ? _ShotsFired>=_ShotsNeeded : goto "End" Goto "Binary" #Shot2 _ammoType createVehicle[_bombLocX - _spreadx, _bombLocY + _SpreadY, _bombLocZ] ~0.1 _ShotsFired = _ShotsFired+1 _shot2=1 ? _ShotsFired = _ShotsNeeded: Goto "End" Goto "Binary" #Shot3 _ammoType createVehicle[_bombLocX + _spreadX, _bombLocY - _SpreadY, _bombLocZ] ~0.1 _ShotsFired = _ShotsFired+1 _shot3=1 ? _ShotsFired = _ShotsNeeded : Goto "End" Goto "Binary" #Shot4 _ammoType createVehicle[_bombLocX - _spreadx, _bombLocY - _SpreadY, _bombLocZ] ~0.1 _ShotsFired = _ShotsFired+1 _shot4=1 ? _ShotsFired = _ShotsNeeded : Goto "End" Goto "loop" #Binary ;Spread Logic ;? (_theExplosion == "25mm") : _count1 = (random 10) ;? (_theExplosion == "40mm") : _count1 = (random 10) ;? (_theExplosion == "125mm") : _count1 = (random 10) ;? (_theExplosion == "25mm") : _count2 = (random 10) ;? (_theExplosion == "40mm") : _count2 = (random 10) ;? (_theExplosion == "125mm") : _count2 = (random 10) _count1 = 10 _count2 = 10 ;_count1 = round(random 10) ;_count2 = round(random 10) ;Binary Based Random Spread while "_count1 > 0" do {_binaryX=2*_binaryX _count1=_count1-1} while "_count2 > 0" do {_binaryY=2*_binaryY _count2=_count2-1} _spreadx =(_Binaryx / 1000 *_spread) ;_Binaryx =_Binaryx * _spread _spready =(_BinaryY / 1000*_spread) ;_BinaryY =_BinaryY * _spread ;_spreadx = _Binaryx ;_spreadY = _BinaryY ? (_shot1 = 0) : goto "Shot1" ? (_shot1 = 1) : goto "Shot2" ? (_shot2 = 1) : goto "Shot3" ? (_shot3 = 1) : goto "Shot4" ? (_shot4 = 1) : goto "Reset" #Reset _shot1 = 0 _shot2 = 0 _shot3 = 0 _shot4 = 0 Goto "Shot1" #End exit
This script seems scruffy because of the ways I tried to get this to work. A lot of stuff is commented out, after checking it did nothing to help. Once the problem is solved, the randomness will be added back in.
Thanks, any help would be great.
HOME
Reply With Quote


