Home   Help Search Login Register  

Author Topic: Automatic AI_artillery w. explosion fragments. HELP needed  (Read 1349 times)

0 Members and 1 Guest are viewing this topic.

Offline MakkaraTheMan

  • Members
  • *
  • Moikkuli from Finland :)
    • www.lifeline.fi
Hello there!

Its great to be back, after meny years long vacation from OFP-combat zone...   :good:

I need serious help, and here is one for you super scripters out there  :dunno:


Here is what i'm trying to do here:

1. The great ai_arty_1_0 _artillery script is almost perfect, but the explosion fragments are missing! There is a fragmentation script In the attachment file, but the problem is that, i just can't make the fragment's script to work with this ai_artillery script.

You can test it when you start the mission and throw a handgrenade. It work's! But when you see the observer /artillery firing...NOTHING!!!???

The other attachment file is to show you how it should work: B2_uusi_sirpaletesti.cain Please check it out.

2. The ai_arty's radio chatter "%1" getpos _target GridCoord -stuff is getting error. It cant find the _target.

3. Even if the ai-artillery is generic/w. camcreated rounds, it would be good to have a "Fake" artillery group, so the enemy has a possibility to destroy it. = When artygroup is destroyed, the script should exit. I could't make it work.

4. YES there is the ai_arty_UA_1_0 script/mission, that is based on the CoC artillery addon. That is allso great, but i had serous difficulty to make the fragmentation script to use/find the CoC -ordnance.

5. The ultimate thing with the working explofragments would be Huge waters plashes when the rounds hit water. Actually the water splashes could replace the fragments, to reduce lagging. To my knowledge when hitting water, the fragments would stay mostly under the surface anyway. Here is what i found... i just cant make sense of it:

http://www.ofpec.com/forum/index.php?topic=1408.0

6. How to make the each "script group" to use its own folder. I mean if you have lots of different scripts in the mission folder, it's a mess.



I've searched the forums for a month now... it's hopeless. I can't do this without help.


Chears  :clap:
« Last Edit: 23 Aug 2008, 21:44:10 by MakkaraTheMan »

Offline MakkaraTheMan

  • Members
  • *
  • Moikkuli from Finland :)
    • www.lifeline.fi
Re: Automatic AI_artillery w. explosion fragments. HELP needed
« Reply #1 on: 23 Aug 2008, 22:24:47 »
Ok, this tread doesn't seem to get anywhere...

I don't know if this thing isn't interesting to you guys, or are the attachment files somehow corrupted?

I'll try to copy the scripts here so you can get the picture without downloading anything. I hope that helps a bit. 

AI artillery spotter init
Code: [Select]
;Place this line in the init field of each AI artillery spotter:
;   [this, "enemy array name", "friendly array name", "ammo variable name"] exec "ai_arty_ua.sqs"

Put two triggers covering the whole map:
east present, once, activation east_units = thislist
west present, once, activation west_units = thislist

Here is the ai_arty.sqs
Code: [Select]
_observer = _this select 0
_enemies = _this select 1
_friends = _this select 2
_ammoVar = _this select 3
_ARTY = _this select 4
_artyunits = units _ARTY
_tempVar = 0
_artycount = count _artyunits
_artylead = _artyunits select 0

#Loop
;tähän speedlimitteri observerille
;_observer sidechat "loop"
@(speed _observer > 0)

;loop until enemy detected or unit is killed
? !(alive _observer) : exit
;? count _artyunits < 1 : goto "ARTYDEAD"
? !(alive _artylead) : goto "ATRYDEAD"
? ("Land" countType ([_observer, call _enemies, false] call knownUnits)) > 0 : goto "Next"
goto "Loop"

#Next
;go back if arty is out of rounds, or in use
? (Call _ammoVar) <= 0 : goto "Loop"
_knownEnemies = [_observer, call _enemies, true] call knownUnits
_i = 0
_max = count _knownEnemies

;loop until a target is found with no friendlies nearby
#FindTarget
     _target = _knownEnemies select _i
;    The number below (after _target) is the distance around the target that must be clear of friendlies to call the strike
;    EG: 75 means no strike can be called on that target if any friends are within 75 meters of the target.
;    This number should be increased if the arty you are using covers a larger strike area. If you using this script
;    to call flares, you should reduce this number to 1, or delete the part of the line before the "AND"
     ?  count ([_target, 100, call _friends, false] call findUnits) == 0 AND "Land" countType [_target] == 1 : goto "CallStrike"
     _i = _i + 1
     ? _i < _max : goto "FindTarget"

;if no safe targets, wait, then go back to beginning
~10
goto "Loop"


;----------------------------------------------------------
; EDITABLE PORTION OF SCRIPT BELOW
;----------------------------------------------------------

#CallStrike
;Replace this with the text of your choosing.
;I suggest you use this function to display the actual grid coords of the strike:
; http://www.ofpec.com/editors/funcref.php?filter_func=11 (NOT FOUND)

;Set the ammo counter to zero temporarily, to prevent other observers from using the arty
call format ["_tempVar = %1; %1 = 0", _ammoVar]




;Record position of target for strike
_pos = getpos _target

_observer sidechat format ["REQUESTING FIREMISSION AT GRID %1 FIRE FOR EFFECT", getpos _target call gridcoord]
~10
_artylead sidechat format ["ROGER THAT. SETTING CORDINATES AT GRID %1 ... OVER", getpos _target call gridcoord]


;call GridCoord doesnt work here??? I tried to look from the search, but no luck. WHAT is wrong?
; the artillery rounds are going right there where they should, on _target, so that part works.


~30
_artylead sidechat "FIRST ROUNDS ON THE WAY... OVER"

;Delay representing arty targeting coordinates
~10
;----------------------------------------------------------
;Call the strike. Edit the fields below as you see fit:
;[coords, ordinance type, height to spawn ordinance, # of volleys, # of rounds/volley, delay between volleys, time variation between volleys, time each volley takes, impact radius] exec "g_arty.sqs"
[_pos, "Shell125", 300, 2, 12, 4, 5, 4, 110 + random 60] exec "g_arty.sqs"
;----------------------------------------------------------
~5
_artylead sidechat "ROUNDS ON TARGET... OVER"

;Delay to let the strike complete. Edit this delay according to how long your arty strike takes.
~15
_artylead sidechat "FIREMISSION COMPLETED... OVER"

;Put the ammo counter back to where it should be. Now others can call arty, if there is ammo left.
call format ["%1 = %1 + _tempVar - 1", _ammoVar]
~10
goto "Loop"

;----------------------------------------------------------

#ARTYDEAD
~30
_observer sidechat "REQUESTING FIREMISSION ...OVER"
~5
_observer sidechat "REQUESTING FIREMISSION ...COME IN PLEASE ...OVER"
~10
_observer sidechat "THIS IS FOWARD OBSERVER TO ALL UNITS: MORTAR SUPPORT NOT RESPONDING... OUT"

#EXIT
exit




Here is the g_arty.sqs
Code: [Select]
;//********************
;//**** Parameters ****
;//********************

;// Target Coordinates:
;// This should be an array containing min 2 numbers (X and Y Coord) but a normal
;// GetPos should do (no select 0 etc.)
_coords = _this select 0

;// Type of Ordanance (String Value), look at Weapons and Ammo or Objects Tree for types
_ord = _this select 1

;// Height (numeric) at which Ordanance should be Spawned (150 or so works fine)
_height = _this select 2

;// Number of volley fired by the Artillery
_VolleyNr = _this select 3

;// Number of Shots in each Volley
_ShotNr = _this select 4

;// Time between Volleys
_vTime = _this select 5

;// Time Variation between Volley (the Max deviation from _vtime)
_vTimeVar = _this select 6

;// Time Variation within each Volley
;// (Note: For Time on Target Barrages (ToT) put a 0 here)
_vTimeVol = _this select 7

;// Maximum Distance for shots off the Aimed Point
_radius = _this select 8

;//************************
;//**** Parameters END ****
;//************************


;//Put in Radiochatter here!
;~15
;_artylead sidechat "SECTION FIRING... OVER"

;//**************************
;//**** Main Arty Script ****
;//**************************

_nr = 0

#loop

?(_nr >= _Volleynr):goto "ende"

_volnr = 0

;//inner loop (within volley)
#volley

;// Increment Counter
_volnr = _volnr + 1

;// create ordonance
_ord camCreate [(_coords select 0) + (random _radius) - (_radius / 2), (_coords select 1) + (random _radius) - (_radius / 2), _height]

[_this select 1] call handleri


;_ord addEventhandler ["fired", {_this call handleri}] - just tried this when i couldnt
;cum up with anything else... stupid me
 
;This is the main problem here!!! The created ordonance are not found by the
;prepocessfile "handleri.sqf

;All other grenades under the influence of the eventhandler trigger in the map,
;are found and the explosion fragments are shooting/working well.
 
;In other missions i use the same -call hanleri- script for "fired" evnthandlers.
;Even the Fishions/General Barrons -artillery barrage- script that is using trigger
;created shells, is working well.

;The same fishions/General Barrons script is modified in this ai_arty-10.abel -srcipt.

;Why the hell it doesnt work???? Why it doesnt find the damn -handleri-???





;// wait a random time for the next Shot
;// (note _vTimeVol is the total time a Barrage needs to land, thus devided by the number
;// of shots)

;// wait and avaoid errormessage
?(_shotnr == 0):goto "avoid"
~(Random(_vTimeVol / _Shotnr))
goto "endrnd"
#avoid
~0.1
#endrnd


?(_volnr <= _Shotnr):goto "volley"
;//innerloop end

;// Increase Counter
_nr = _nr + 1

~(_vtime + (Random _vTimeVar ))

goto "loop"


#ende
;//Put in Radiochatter here!


Here is the init.sqs in the mission folder for the explosion fragments to work
Code: [Select]
;Type of resource: Script / function
;Applicability: OFP, i'm not shure if this works w. ARMA too?
;Title of resource: Real (bullet)explosion fragments for different size grenades
;Version: 1.2.
;Author/submitted by: The creator of this script is john smith[FIN]
;The ideas, beta testing and small modifications by: MakkaraTheMan[FIN]
;
;Description:
;This script is tested, and it works with all units and vehicles under the trigger area,
;if they are using ammo, listed in the init.sqs -file
;
;!!!!!For some unknown reason, it doesnt work in the ai_arty_1.0.abel
;
;--------------------------------------------------------------------------------
;Make a trigger covering the whole map size, activated by anybody (present)
;copy (ctrl + c) the script launch code on the triggers activation field:
;
;{_x addEventhandler ["fired", {_this call handleri}]} forEach thisList
;
;Copy all 6 separate script files into your user mission folder:
;b.sqf
;h.sqf
;hj.sqf
;grad.sqf
;init.sqs
;track.sqs
;--------------------------------------------------------------------------------
;This file/code is still unfinnished, but as you can see it's possible to make every single
;nade to make its own individual shrapnell group for different explosions.
;I must study more command references and ammolists for different addons and mods.
;Enyway, if you want to add or change something, be my guest :) But please sen it to me too, ok?
;-------------------------------------------------------------------------------
;Used resources:
;OFPEC Command reference.
;FDF 1.4.
;JAM3
;BAS units & vehicles
;SEB Nam Pack 2
;CoC UA11Docs
;BOH_Doc
;That's all at the moment.


riflegrenades = ["BAS_M4REFLEXM203", "BAS_M4REFLEXSM203", "BAS_M433grenade", "GrenadeLauncher", "JAM_M433grenade", "GrenadeLauncher", "FDF_agsGrenade", "JAM_M433grenade", "JAM_M433Belt", "JAM_M433Vest", "JAM_VOG25grenade", "JAM_VOG25Belt", "JAM_VOG25Vest", "BAS_M433grenade", "BAS_M4ReflexM203Muzzle", "JAM_M576buck"];

handgrenades=[ "GrenadeHand", "GrenadeHand_e", "GrenadeHand_r", "FDF_handgrenade_ammo", "Grenade", "FDF_stickGrenade", "BISGrenadeCamel"];

riflemortars=["FDF_rk95Mortar", "FDF_rk95Mortar2", "JAM_M14Mortar", "JAM_AKMmortar", "sebak47mortar", "sebm16mortar"];

smallmortars=["MortarShell", "sebm19mortar60", "sebmortar60HE", "sebm16mortar", "sebm79he", "sebm79buck", "sebm79HEammobag", "BOHMGUN76"];

mediummortars=["FDF_mortar81", "FDF_mortar81_E", "CoC_mort81DF", "CoC_mort81HE", "CoC_mort81WP", "CoCWGL_mortar81HE", "CoCWGL_mortar82HE"];

bigmortars=["CoC_mort81HEheavy"];

smalltankcannon=["Cannon25HE", "Cannon30AP", "Cannon30HE", "FDF_BMP30HE", "FDF_BMP30AP", "SFPamosHEMag", "SFPamosDFMag", "SFPamosSTRIXMag"];

mediumtankcannon=["FDF_Zsu57Cannon", "FDF_55s55LauncherMag", "Heat73", "FDF_73mm", "FDF_Musti95Okr", "FDF_MustiHeat", "FDF_MustiHE"];

bigtankcannon=["Heat105", "Heat120", "Heat125", "Heat155", "FDF_leo2Sabot", "FDF_leo2heat", "FDF_T55MHVAPDS", "FDF_T55MHeat", "FDF_T55MHE", "FDF_T55MAP", "FDF_t72m1Sabot", "FDF_t72m1Heat", "FDF_t72m1HE", "BOHcannon120_S1","BOHcannon120_S2", "BOH110mmHEAT", "BOHHeat105"];

smallartyshell=["Shell73"];

mediumartyshell=["Shell105", "Shell120", "CoC_Howi130DF", "CoC_Howi130HE", "CoC_Howi105DF", "CoC_Howi105HE", "CoC_Howi105WP", "CoC_Howi105ICM", "BOHShell105"];   

bigartyshell=["Shell125", "Shell155", "CoC_Howi155DF", "CoC_Howi155HE", "CoC_Howi155ICM", "CoC_Howi155DPICM", "CoC_Howi155CLGP", "CoC_Howi155RAAMS", "2CoC_Howi152DF", "CoC_Howi152HE", "CoC_Howi152WP", "CoC_Howi152ICM", "CoC_Howi152DPICM", "CoC_Howi152RAAMS", "CoC_Howi152CLGP"]; 

smallrockets=["Rocket57", "LAW", "RPG", "Rocket57x64", "Rocket57x40Kamov", "FDF_66kes75LauncherMag", "FDF_66kes88LauncherMag", "FDF_Rocket57x96", "FDF_Rocket57x32""9K32", "Ch29T", "AA", "JAM_RPG7Rocket", "JAM_RPG7AARocket", "JAM_RPG7APRocket", "JAM_RPG7ALLRocket", "JAM_CAVS_RPG7Rocket", "JAM_CAVS_RPG7AARocket", "JAM_CAVS_RPG7ALLRocket", "JAM_CAVS_RPG7APRocket", "BASOHzuni7", "BASOHzuni14", "BASOHStingerLauncher1", "BASOHStingerLauncher", "bas_60zuni38", "baszuni14", "baszuni7", "sebuh1zuni48", "sebah1zuni14", "sebah1zuni76", "sebah1zuni38", "seblawrocket", "sebrpgrocket", "sebrpg7rocket", "seb90mmrocket", "sebsa7mag", "CoC_M270MLRSLauncher", "ZuniLauncher38", "BOHzunilauncher_J"]; 

mediumrockets=["AT3", "AT4", "BAS_AT4Launcher", "BAS_AT4Rocket", "Rocket57x192", "FDF_at3StaticLauncher", "FDF_PstOhj82mLauncher_e_v", "FDF_PstOhj82mLauncher", "Zuni", "JAM_AT4Rocket", "JAM_AT4AARocket", "JAM_AT4APRocket", "JAM_AT4ALLRocket", "JAM_CAVS_AT4Rocket", "JAM_CAVS_AT4AARocket", "JAM_CAVS_AT4APRocket", "JAM_CAVS_AT4ALLRocket", "JAM_M72Rocket", "JAM_M724AARocket", "JAM_M72APRocket", "JAM_M72ALLRocket", "JAM_CAVS_M72Rocket", "JAM_CAVS_M72AARocket", "JAM_CAVS_M72APRocket", "JAM_CAVS_M72ALLRocket"];   

bigrockets=["CarlGustav", "Maverick", "Hellfire", "AT5", "AT6", "HellfireApach", "FDF_apilasLauncherMag", "FDF_rocket135mm", "BASOHHellfireLauncher1", "BASOHHellfireLauncher", "bas_ah60helllauncher", "basah6helllauncher", "basah6towlauncher", "sebah1towlauncher", "BOHCarlGustavLauncherShell", "BOHLmatMissile", "BOHSAM2", "BOHFIM92ALauncherShell", "HellfireLauncherCobra", "BOHHeavyMAT", "BOHType91SAMOH", "BOHHellfireRF_JLauncher", "BOHAIM92Launcher", "BOHHellfireRF_JLauncher2", "BOHHellfireRF_USLauncher", "BOHHellfireRF_USLauncher2", "BOHHellfireLauncherWAP"];   

mediumbomb=["FDF_mk81_6"];

bigbomb=["LaserGuidedBomb"];


bigmine=["Mine", "PipeBomb", "TimeBomb", "MineE", "AT Mine", "FDF_kasapanos"];


handlerj = preProcessFile "hj.sqf"

handleri = preProcessfile "h.sqf"

grad = preProcessfile "grad.sqf"

paukku = preProcessfile "b.sqf"

knownUnits = preprocessFile "knownUnits.sqf"

findUnits = preprocessFile "findUnits.sqf"

E_arty_shots = 100

unitcreate = loadFile "unitcreate.sqf"

gridcoord = preprocessfile "gridcoord.sqf"

;-------------------------------------------------------------------------------------------
;Known problems:

; 1. For now, and for some reason unknown to me, the script isn't using all the cassnames in the list above.
;It does a good job finding the basic names, such as: "LAW", and "GrenadeHand", but the rest, i donno why...

; 2. For example, the shells fired from a tank (T72) are so fast, that the shrapnel burst is
;left behind from the impact point, up to 30-50m. That is because the track.sqs is not fast
;enough, yet...That looks odd and can cause irritation among players. If somebody would come up
;with more accurate script to track the grenades,
;Please send that script to e-mail adress:  sami.heino@lifeline.fi

;Examples: bigshelltypes= "Heat105", "Heat120", "Heat125", "Heat155", "FDF_leo2Sabot", ;"FDF_leo2heat", "FDF_T55MHVAPDS", "FDF_T55MHeat", "FDF_T55MHE", "FDF_T55MAP", "FDF_t72m1Sabot", ;"FDF_t72m1Heat", "FDF_t72m1HE", and so on...

; 3. to reduce lagging, you can change the numbers of the fragments,
;by setting lower values to replace fex, 350 (in bigartyshell), but
;in my opinion existing values are the minimum. If you reduce them
;any lower, than the risk of a unit getting hit by a shrapnel,
;is far too low, and the whole script looses it's main point. Realism!
;
;For example: A real attack handgrenade contains about 2000
;shrapnels inside, so as it is now set to 200 in (handgrenade),
;that's allready quite low compared to the real thing.
;Due to the lack of cover in the fields of OFP/ARMA,
;I guess it's ok, to compensate that a little bit.

;This script has been tested with basic PC:
;Processor: AMD64 3200+ 2G
;Memory: 1G
;Graphics card: Nvidia GeForce 6600GT

;Results: OFP Laggs a bit, but playable.
;Of course it depends how meny units and
;smoke effects there are running on the field.
;Not tested w. ARMA?
 
;Cheers!
;MakkaraTheMan. -23.5.2007

b.sqf
Code: [Select]
_v3=(random _extent)+_min;
_cosu=sqrt (_u^2-_v3^2);
_b=random 360;
_v1=_cosu*(sin _b);
_v2=_cosu*(cos _b);
_u1=_v1*_r11+_v2*_r21+_v3*_r31;
_u2=_v1*_r12+_v2*_r22+_v3*_r32;
_u3=_v1*_r13+_v2*_r23+_v3*_r33;
_frag=_fragtype camcreate [(_pos select 0)+_o1, (_pos select 1)+_o2, (_pos select 2)+_o3];
_frag setvelocity [_u1,_u2,_u3];

h.sqf
Code: [Select]

if ((_this select 4) in riflegrenades) then {[nearestObject [_this select 0,_this select 4], 10, 100, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in handgrenades) then {[nearestObject [_this select 0,_this select 4], 20, 200, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in riflemortars) then {[nearestObject [_this select 0,_this select 4], 20, 150, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in smallmortars) then {[nearestObject [_this select 0,_this select 4], 25, 200, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in mediummortars) then {[nearestObject [_this select 0,_this select 4], 30, 250, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in bigmortars) then {[nearestObject [_this select 0,_this select 4], 45, 300, "Bullet12_7"] exec "track.sqs"};

if ((_this select 4) in smalltankcannon) then {[nearestObject [_this select 0,_this select 4], 10, 50, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in mediumtankcannon) then {[nearestObject [_this select 0,_this select 4], 30, 100, "Bullet12_7"] exec "track.sqs"};

if ((_this select 4) in bigtankcannon) then {[nearestObject [_this select 0,_this select 4], 50, 200, "Bullet12_7"] exec "track.sqs"};

if ((_this select 4) in smallartyshell) then {[nearestObject [_this select 0,_this select 4], 30, 200, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in mediumartyshell) then {[nearestObject [_this select 0,_this select 4], 40, 300, "Bullet12_7"] exec "track.sqs"};

if ((_this select 4) in bigartyshell) then {[nearestObject [_this select 0,_this select 4], 80, 350, "Bullet12_7"] exec "track.sqs"};

if ((_this select 4) in smallrockets) then {[nearestObject [_this select 0,_this select 4], 20, 100, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in mediumrockets) then {[nearestObject [_this select 0,_this select 4], 30, 150, "Bullet7_6W"] exec "track.sqs"};

if ((_this select 4) in bigrockets) then {[nearestObject [_this select 0,_this select 4], 40, 200, "Bullet12_7"] exec "track.sqs"};

if ((_this select 4) in mediumbomb) then {[nearestObject [_this select 0,_this select 4], 40, 200, "Bullet12_7"] exec "track.sqs"};

if ((_this select 4) in bigbomb) then {[nearestObject [_this select 0,_this select 4], 80, 350, "Bullet12_7"] exec "track.sqs"};

if ((_this select 4) in bigmine) then {[nearestObject [_this select 0,_this select 4], 40, 200, "Bullet12_7"] exec "track.sqs"};



;"BulletSingle"
;"Bullet7_6E"
;"Bullet7_6W"
;"Bullet12_7"
;"FDF_itkk"
;"Cannon30AP"

hj.sqf
Code: [Select]

private ["_obj","_objtype"];
_obj = _this select 1;
_objtype = _this select 2;

if (_objtype in riflegrenades) then {[_obj, 10, 100, "BulletSingle"] exec "track.sqs"};

if (_objtype in handgrenades) then {[_obj, 20, 200, "BulletSingle"] exec "track.sqs"};

if (_objtype in riflemortars) then {[_obj, 20, 150, "BulletSingle"] exec "track.sqs"};

if (_objtype in smallmortars) then {[_obj, 25, 200, "BulletSingle"] exec "track.sqs"};

if (_objtype in mediummortars) then {[_obj, 30, 250, "BulletSingle"] exec "track.sqs"};

if (_objtype in bigmortars) then {[_obj, 45, 300, "BulletSingle"] exec "track.sqs"};

if (_objtype in smalltankcannon) then {[_obj, 10, 50, "BulletSingle"] exec "track.sqs"};

if (_objtype in mediumtankcannon) then {[_obj, 30, 100, "BulletSingle"] exec "track.sqs"};

if (_objtype in bigtankcannon) then {[_obj, 50, 200, "BulletSingle"] exec "track.sqs"};

if (_objtype in smallartyshell) then {[_obj, 30, 200, "BulletSingle"] exec "track.sqs"};

if (_objtype in mediumartyshell) then {[_obj, 40, 300, "BulletSingle"] exec "track.sqs"};

if (_objtype in bigartyshell) then {[_obj, 80, 350, "BulletSingle"] exec "track.sqs"};

if (_objtype in smallrockets) then {[_obj, 20, 100, "Bullet7_6W"] exec "track.sqs"};

if (_objtype in mediumrockets) then {[_obj, 30, 150, "Bullet7_6W"] exec "track.sqs"};

if (_objtype in bigrockets) then {[_obj, 40, 200, "Bullet12_7"] exec "track.sqs"};

if (_objtype in mediumbomb) then {[_obj, 40, 200, "Bullet12_7"] exec "track.sqs"};

if (_objtype in bigbomb) then {[_obj, 80, 350, "Bullet12_7"] exec "track.sqs"};

if (_objtype in bigmine) then {[_obj, 40, 200, "Bullet12_7"] exec "track.sqs"};


;"BulletSingle"
;"Bullet7_6E"
;"Bullet7_6W"
;"Bullet12_7"
;"FDF_itkk"
;"Cannon30AP"


track.sqs
Code: [Select]
;Type of resource: Script / function
;Applicability: OFP, i'm not shure if this works w. ARMA too?
;Title of resource: Real (bullet)explosion fragments for different size grenades
;Version: 1.2
;Author/submitted by: The creator of this script is john smith[FIN]
;The original idea, testing and small modifications by: MakkaraTheMan[FIN]
;
;Description:
;This script is tested, and it works with all units and vehicles under the trigger area,
;that are using ammo, listed in the init.sqs -file
;Suites in MP-missions too, but the script must be run on the servers battlefield,,, i think...
;--------------------------------------------------------------------------------
;Make a trigger covering the whole map size, activated by anybody (present)
;copy (ctrl + c) the script launch code in to the triggers activation field:
;
;{_x addEventhandler ["fired", {_this call handleri}]} forEach thisList
;
;Copy all 5 separate script files into your user mission folder:
;b.sqf
;grad.sqf
;init.sqs
;track.sqs
;--------------------------------------------------------------------------------

goto "alku"
#fragloop
_j=_lkm
if (_lkm>5) then {_j=5}
while {_j>0} do {call paukku; _j=_j-1}
_lkm=_lkm-5
? (_lkm>0) : goto "fragloop"
exit

#alku
_nade=_this select 0
_pos=getpos _nade
_i=0
_u=_this select 1
;shrap speed

_lkm=_this select 2
;shrap numbers

_fragtype=_this select 3

_o1=0
_o2=0
_o3=0.1


#check
if ((isnull _nade)) then {goto "boom"} else {_pos=getpos _nade}
@true
goto "check"

#boom
@(isnull _nade)
_height=_pos select 2
_min=-_u*(_height+_o3)/4
? (_min<-_u) : _min=-_u
_max=3*9.81/2
;if (_height>=4) then {_min=-1e12; _max=0}
;if (_height>=4) then {_max=0}
? (_max>_u) : _max=_u
_extent=_max-_min
? (_extent<=0) : exit
_lkm=_lkm*(_extent)/(2*_u)
_grad=_pos call grad
_norm=sqrt ((_grad select 0)^2+(_grad select 1)^2)
? (_norm==0) : _r11=1;_r12=0;_r13=0;_r21=0;_r22=1;_r23=0;_r31=0;_r32=0;_r33=1; goto "fragloop"
_x=-(_grad select 1)/_norm
_y=(_grad select 0)/_norm
_t=atan _norm
_sin=sin _t;
_cos1=1-(cos _t);
_r11=(1-_cos1)+_x^2*_cos1;
_r12=_x*_y*_cos1
_r13=_y*_sin
_r21=_x*_y*_cos1;
_r22=(1-_cos1)+_y^2*_cos1;
_r23=-_x*_sin
_r31=-_y*_sin
_r32=_x*_sin
_r33=(1-_cos1)

_o1=_o3*_r31
_o2=_o3*_r32
_o3=_o3*_r33

goto "fragloop"


knownunits.sqf
Code: [Select]
/*knownUnits.sqf v1.1
By General Barron
aw_barron@hotmail.com
8/11/04

This returns a list of units detected by the passed unit. List can be sorted in order of closest to farthest. To call:
[detector, [units to detect from], sort? (true/false)] call knownUnits

Usage example: make a trigger, covering entire map, activation = once, "east present". On activation = "east_units = thisList"
Make another trigger. Condition = "count ([player, east_units, false] call knownUnits) > 0". On activation = "hint "enemy spotted" "
The hint will appear once the player detects one or more east units.
*/

private ["_unit", "_list", "_return", "_numArray","_j","_k","_tempVal","_tempNum","_element"];

_unit = _this select 0;
_list = _this select 1;
_return = [];

{if ((_unit knowsabout _x) > 0.105) then {_return = _return + [_x]}} foreach _list;

/*-----------------------------------------------------------------------------------
Start bubble sort (sort units from closest to farthest)
Code taken from sortBubble.sqf
By bn880 2/24/2003
(slightly modified to fit in this function)
-----------------------------------------------------------------------------------*/
if (_this select 2) then
{
_count = count _return;
_numArray = [];
_numArray resize _count;

// ACQUIRE NUMERIC VALUES FROM EVALUATION
_j = 0;
while {_j < _count} do
{
_element = _return select _j;
_numArray set [_j,_element distance _unit];
_j = _j + 1;
};

_j = 0;
// SORT
while {_j < _count -1} do
{
_k = _j + 1;
while {_k < _count} do
{
if (_numArray select _j > _numArray select _k) then
{
_tempNum = _numArray select _j;
_numArray set [_j,(_numArray select _k)];
_numArray set [_k,_tempNum];

_tempVal = _return select _j;
_return set [_j,(_return select _k)];
_return set [_k,_tempVal];
};
_k = _k + 1;
};
_j = _j + 1;
};
};

_return

gridcoord.sqf
Code: [Select]
private ["_result","_GrandeLettre","_PetiteLettre","_Chiffre", "_Chiffrestring","_Pos","_ArrayMajuscForGrid","_ArrayMinusForGrid " ];

_ArrayMajuscForGrid = ["A","B","C","D","E","F","G","H","I","J"];
_ArrayMinusForGrid = ["a","b","c","d","e","f","g","h","i","j"];

_Pos = _This select 0;
_Chiffrestring ="";
_result = "";
_GrandeLettre = (((_Pos select 0) - ((_Pos select 0) Mod 1280))/1280);                             
_PetiteLettre =((((_Pos select 0) Mod 1280)- (((_Pos select 0) Mod 1280)Mod 128))/128);   
_Chiffre = (99 - ((_Pos select 1) - ((_Pos select 1) Mod 128))/128);         
_Chiffrestring = Format["%1",_Chiffre];
If (_Chiffre < 10) then  {_Chiffrestring = "0" + _Chiffrestring };
_result = ((_ArrayMajuscForGrid select _GrandeLettre) + ( _ArrayMinusForGrid select _PetiteLettre) +_Chiffrestring);

_result

I really hope somebody gets this mess sorted out.

I just had an idea... I've noticed that if the fragment bullets(when working) are fex. "Bullet7_6E" and the grenades hit near east unit. He doesn't get down and radio "UNDER FIRE" even if the bullets hit near. Friendly bullets are not making the unit "UNDER FIRE"

I think the whole fragmentation script should be modified so that east and west should have "their own" artillery grenades... hehheh, that wasn't quite clearly explained, well any way  i'm shure you know what i mean  :D