bLAcKmAgE87 13 Posted January 10, 2022 Spoiler //-----------------------------------------------trigonometery dix = (getDir player ) ; dix1 = (getDir player) ; dix = (dix) ; dix = ((360 - (dix)) + 90) ; countx = 0 ; county = 0 ; bump = 20 ; bumpx = bump * (cos(dix)) ; bumpy = bump * (sin(dix)) ; private _count = 0 ; private _blam = "" ; unitsNato = 30 ; unitsOp = 30 ; leg = 120 ; gap = 100; legb = 100 ; rati = gap / leg ; ratiB = gap / legB ; angForm = atan rati ; angFormB = atan ratiB ; angForm1 = atan rati ; angForm1B = atan ratiB ; angOp = (dix + ( angForm)) ; angOp1 = (dix + ( angFormB)) ; angNato = (dix - ( angForm1)) ; angNato1 = (dix - ( angForm1B)) ; hyp = abs((gap) / (sin (angForm ) ) ) ; hypB = abs((gap) / (sin (angFormB ) ) ) ; hyp1 = abs((gap) / (sin (angForm1 ) ) ) ; hypB1 = abs((gap) / (sin (angForm1B) ) ) ; hypx = (hyp) * ( cos (angOp)); hypy = (hyp) * ( sin (angOp)) ; hypxB = (hypB) * ( cos (angOp1)) ; hypyB = (hypB) * ( sin (angOp1)) ; hypx1 = (hyp1) * ( cos (angNato) ); hypy1 = (hyp1) * ( sin (angNato) ) ; hypxB1 = (hypB1) * ( cos (angNato1)); hypyB1 = (hypB1) * ( sin (angNato1)) ; diox = hypxB ; dioy = hypyB ; dioxF = hypx ; dioyF = hypy ; dio1x = hypxB1 ; dio1y = hypyB1 ; dio1xF = hypx1 ; dio1yF = hypy1 ; //------------------------------------------------Add Marker Data _pos1 = [( getpos player select 0) + (diox) , ( getpos player select 1) + (dioy) , ( getpos player select 2)]; _pos2 = [( getpos player select 0) + (dioxF) , ( getpos player select 1) + (dioyF) , ( getpos player select 2)]; _pos3 = [( getpos player select 0) + (dio1x) , ( getpos player select 1) + (dio1y) , ( getpos player select 2)]; _pos4 = [( getpos player select 0) + (dio1xF), ( getpos player select 1) + (dio1yF), ( getpos player select 2)]; //------------------------------------------------Add Markers mark1 = createMarker ["nmeSpawnment",_pos1 ]; mrk1 = mark1 ; mark1 setMarkerType "mil_triangle"; mark1 setMarkerShape "ICON"; mark2 = createMarker ["loadVec1", _pos2 ]; mrk2 = mark2 ; mark2 setMarkerType "hd_destroy"; mark2 setMarkerShape "ICON"; mark3 = createMarker ["nmeSpawnment_1", _pos3 ]; mrk3 = mark3 ; mark3 setMarkerType "mil_dot"; mark3 setMarkerShape "ICON"; mark4 = createMarker ["loadVec1_1", _pos4 ]; mrk4 = mark4 ; mark4 setMarkerType "mil_circle"; mark4 setMarkerShape "ICON"; //------------------------------------------------Spawn OPFOR private _namr = "pop_" ; private _group = "" ; private _namee = "mole" ; _group = missionNamespace getVariable [_group, objNull]; _group = createGroup east; _group setGroupId ["_namee"]; _namee = missionNamespace getVariable [_namee, objNull]; private _posQ = markerPos "nmeSpawnment"; for [{private _i=1},{_i <= unitsOp },{_i = _i + 1}] do { countx = (countx ) - bumpx ; county = (county ) - bumpy ; _count = _count + 1; _blam = _namr + (str _count); whatx = (_posQ select 0) + (countx) ; whaty = (_posQ select 1) + (county) ; whatz = (_posQ select 2) ; private _posNew = [(whatx),(whaty),(whatz)] ; "O_Urban_Sharpshooter_F" createUnit [_posNew, (_group), (_blam + " = this") ]; _blam = missionNamespace getVariable [ _blam , objNull]; (_blam) spawn bis_fnc_tracebullets ; _blam = "" ; }; _group addWaypoint [markerPos "loadVec1", 0]; [_group,1] setWaypointFormation "FILE"; _group setFormDir dix1 ; //------------------------------------------------Spawn NATO private _namr1 = "dop_" ; private _group1 = "" ; private _namee1 = "dole" ; _group1 = missionNamespace getVariable [_group1, objNull]; _group1 = createGroup west; _group1 setGroupId ["_namee1"]; _namee1 = missionNamespace getVariable [_namee1, objNull]; private _posQ1 = markerPos "nmeSpawnment_1"; countx1 = 0 ; county1 = 0 ; private _count1 = 0 ; private _blam1 = "" ; for [{private _i=1},{_i <= unitsNato },{_i = _i + 1}] do { countx1 = (countx1 ) - bumpx ; county1 = (county1 ) - bumpy ; _count1 = _count1 + 1; _blam1 = _namr1 + (str _count1); whatx = (_posQ1 select 0) + (countx1) ; whaty = (_posQ1 select 1) + (county1) ; whatz = (_posQ1 select 2) ; private _posNew = [(whatx),(whaty),(whatz)] ; "B_HeavyGunner_F" createUnit [_posNew, (_group1), (_blam1 + " = this") ]; }; _group1 addWaypoint [markerPos "loadVec1_1", 0]; dop_1 setFormDir dix ; [_group1,1] setWaypointFormation "FILE"; //------------------------------------------------Loadouts NATO { removeAllWeapons _x; removeAllItems _x; removeAllAssignedItems _x; removeUniform _x; removeVest _x; removeBackpack _x; removeHeadgear _x; removeGoggles _x; _x addWeapon "arifle_MX_GL_F"; _x addPrimaryWeaponItem "optic_AMS_snd"; _x addPrimaryWeaponItem "30Rnd_65x39_caseless_mag"; _x addPrimaryWeaponItem "1Rnd_HE_Grenade_shell"; _x addWeapon "hgun_P07_F"; _x addHandgunItem "16Rnd_9x21_Mag"; _x forceAddUniform "U_O_V_Soldier_Viper_F"; _x addVest "V_PlateCarrierSpec_rgr"; _x addBackpack "B_AssaultPack_blk"; _x addItemToUniform "FirstAidKit"; _x addItemToUniform "Chemlight_green"; _x addItemToUniform "HandGrenade"; for "_i" from 1 to 2 do {_x addItemToVest "16Rnd_9x21_Mag";}; _x addItemToVest "SmokeShell"; _x addItemToVest "SmokeShellGreen"; _x addItemToVest "Chemlight_green"; for "_i" from 1 to 3 do {_x addItemToVest "30Rnd_65x39_caseless_mag";}; for "_i" from 1 to 3 do {_x addItemToVest "1Rnd_HE_Grenade_shell";}; for "_i" from 1 to 4 do {_x addItemToBackpack "30Rnd_65x39_caseless_mag";}; for "_i" from 1 to 3 do {_x addItemToBackpack "1Rnd_HE_Grenade_shell";}; _x addHeadgear "H_HelmetB"; _x addGoggles "G_Combat"; _x linkItem "ItemMap"; _x linkItem "ItemCompass"; _x linkItem "ItemWatch"; _x linkItem "ItemRadio"; _x linkItem "B_UavTerminal"; _x linkItem "NVGogglesB_blk_F"; }forEach units (group dop_2) ; //------------------------------------------------Loadouts OPFOR { removeAllWeapons _x; removeAllItems _x; removeAllAssignedItems _x; removeUniform _x; removeVest _x; removeBackpack _x; removeHeadgear _x; removeGoggles _x; _x addWeapon "arifle_ARX_hex_F"; _x addPrimaryWeaponItem "muzzle_snds_65_TI_hex_F"; _x addPrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "optic_Arco"; _x addPrimaryWeaponItem "30Rnd_65x39_caseless_green"; _x addWeapon "launch_RPG32_F"; _x addSecondaryWeaponItem "RPG32_F"; _x addWeapon "hgun_Rook40_F"; _x addHandgunItem "muzzle_snds_L"; _x addHandgunItem "16Rnd_9x21_Mag"; _x forceAddUniform "U_O_V_Soldier_Viper_hex_F"; _x addBackpack "B_ViperHarness_hex_LAT_F"; _x addItemToUniform "FirstAidKit"; for "_i" from 1 to 2 do {_x addItemToUniform "Chemlight_red";}; for "_i" from 1 to 5 do {_x addItemToBackpack "30Rnd_65x39_caseless_green";}; for "_i" from 1 to 2 do {_x addItemToBackpack "10Rnd_50BW_Mag_F";}; for "_i" from 1 to 2 do {_x addItemToBackpack "16Rnd_9x21_Mag";}; for "_i" from 1 to 2 do {_x addItemToBackpack "MiniGrenade";}; _x addItemToBackpack "SmokeShell"; _x addItemToBackpack "SmokeShellRed"; for "_i" from 1 to 2 do {_x addItemToBackpack "RPG32_F";}; _x addHeadgear "H_HelmetO_ViperSP_hex_F"; _x addGoggles "G_Sport_Red"; _x linkItem "ItemMap"; _x linkItem "ItemCompass"; _x linkItem "ItemWatch"; _x linkItem "ItemRadio"; _x linkItem "ItemGPS"; }forEach units (group pop_1) ; //------------------------------------------------Add Cool 3D Markers to each lead on each side while {alive player} do { sleep (.5); //------------------------------------------------Draw on OPFOR private _spac = player distance (getpos pop_1) ; spac = player distance (getpos pop_1) ; private _whale = [_spac," mi"] joinString "" ; addMissionEventHandler ["Draw3D", { drawIcon3D [ "a3\ui_f\data\igui\rsccustominfo\sensors\sectors\sector15_ca.paa", [1,0,0,.5], (ASLToAGL getPosASL pop_1 ), 11, 11, ( getDirVisual player ), (str spac) + "mi", 2, .2, "LCD14" ]; }]; //------------------------------------------------Draw on NATO private _spac1 = player distance (getpos dop_1) ; spac1 = player distance (getpos dop_1) ; private _whale1 = [_spac1," mi"] joinString "" ; addMissionEventHandler ["Draw3D", { drawIcon3D [ "a3\ui_f\data\igui\rsccustominfo\sensors\sectors\sector15_ca.paa", [0,0,.8,.5], (ASLToAGL getPosASL dop_1 ), 11, 11, ( getDirVisual player ), (str spac1) + "mi", 2, .2, "LCD14" ]; }]; }; //------------------------------------------------End Also notice that they get to their waypoints and don't really retain their formation direction... you have to put it in once they get there...which works with .... (pop_1 setFormDir dix1); but doesn't work because it doesn't wait... also spawn bullets usually doesn't work perfectly... but that's a performance issue Share this post Link to post Share on other sites
bLAcKmAgE87 13 Posted January 10, 2022 Just copy and paste the code into a text file.. save it as init.sqf and add that to your mission folder... the units will spawn in whatever direction you face... Stuff I'll need to do in the meantime: I am not very good at making files for functions that my init uses... how do I do that? I want less code on each file sheet. I have not ever used the config.cpp file type in my missions...how do I do that? i.e. Create a class that counts how many kills each dude got or more simply a position or ammo count. A place to save and do arrays. The hardest part yet is adding a sub-menu option that lets me select how many units and where I should I put them relative my player or spawning reference. I want to add a menu that pops up and lets me select from a list of objects on my map. Then spawn from there using the objects direction.. or just pick my own. Select some units from a config reference list...as well as some weapons... maybe not just out of any weapon, but suppose I create sets to choose from.... etc. ...just keep working on SaB V.3 Share this post Link to post Share on other sites
Harzach 2517 Posted January 10, 2022 One topic is enough. Also, again: 5 1 Share this post Link to post Share on other sites
Maff 251 Posted January 11, 2022 10 hours ago, bLAcKmAgE87 said: I am not very good at making files for functions that my init uses... how do I do that? I want less code on each file sheet. I have not ever used the config.cpp file type in my missions...how do I do that? i.e. Create a class that counts how many kills each dude got or more simply a position or ammo count. A place to save and do arrays. The hardest part yet is adding a sub-menu option that lets me select how many units and where I should I put them relative my player or spawning reference. I want to add a menu that pops up and lets me select from a list of objects on my map. Then spawn from there using the objects direction.. or just pick my own. Select some units from a config reference list...as well as some weapons... maybe not just out of any weapon, but suppose I create sets to choose from.... etc. ...just keep working on SaB V.3 1. CfgFunctions. 2. config.cpp is used inside an addon / mod. 3. Sounds like you want to create a mod. 4. You want to create a mod... 5. Do not create a separate thread called "spawn a battle v.3.0". Keep it all in the same post. Your Professor may not always be right. But when it comes to using code blocks; They are very much right. 5 1 Share this post Link to post Share on other sites
bLAcKmAgE87 13 Posted January 11, 2022 figured about as so... this was mostly a comeback over a thread asking about 4 or 5 sided games... which gets to be impossible because the AI needs to decide which enemy to attack/is attacking first... just to prove that is crazy... I made a two sided fight.. if you were the AI stuck exactly in the middle how would make your decisions with enemies on 4 sides? Knowing that the computer isn't sure who is closer? Knowing even that how does it attack more than one target in sequence without getting shot back at in time. How does it avoid friendly fire? Anyways these are completely different scripting subjects that goes on into pure mathematics and deserves some respect... A good point. No really ... starting another thread means starting another subject... I would rather post a mod... but you get my idea.. . Imagine SAB v3 or 4 with like 5 different files, 2 directories, a published mod, and like 50 pages of code. I just wanted to show other players how to get one started. The actual question: Thanks for the input... lets get on making mods and accessing the data from config files for regular mission scripts. Share this post Link to post Share on other sites
Maff 251 Posted January 11, 2022 26 minutes ago, bLAcKmAgE87 said: How does it avoid friendly fire? Good one! 😂 Anyway. Mathematics, AI... Sounds like someone I know.EDIT: I haven't tested the code in your initial posts. I'm having a hard time reading it and don't understand What you're using trigonometry for? Please don't read that as "Why are you using trigonometry". 1 1 Share this post Link to post Share on other sites
opusfmspol 282 Posted January 11, 2022 while {alive player} do { _trg = createTrigger ["EmptyDetector", markerPos "marker_2"]; _trg setTriggerArea [ 500 , 500 , 0 , false]; _trg setTriggerActivation ["EAST", "PRESENT", true]; _trg setTriggerStatements ["this", "", ""]; funx = _trg ; sleep (.5); What's the purpose of these neverending triggers being created, with same variable name reassigned each time, until player dies? Am I missing something? 1 1 Share this post Link to post Share on other sites
bLAcKmAgE87 13 Posted January 11, 2022 lol yea my bad... i left that there just for code later on... it doesn't do anything except prove that you can name a trigger with just a variable for control... I hard the hardest time learning that lol so i left there get on with later on... at least for the trigger parts... those are extras and should be removed if not used... if I made a mod I'd remove that... but leave the sleep(.5) part so that the cpu doesn't overclock when looking up the units... if you use a faster loop...it will slow you down Share this post Link to post Share on other sites
bLAcKmAgE87 13 Posted January 11, 2022 11 hours ago, Harzach said: One topic is enough. Also, again: Ok I put it into SQL format so that it doesn't pick up any html characters that keep you from running it. I'll save any other posts for another topic after I make my formations mod...then I'll have trench fight or what not... or just some marching around...farmers farming Share this post Link to post Share on other sites
bLAcKmAgE87 13 Posted January 11, 2022 On 1/11/2022 at 2:57 AM, bLAcKmAgE87 said: lol yea my bad... i left that there just for code later on... it doesn't do anything except prove that you can name a trigger with just a variable for control... I hard the hardest time learning that lol so i left there get on with later on... at least for the trigger parts... those are extras and should be removed if not used... if I made a mod I'd remove that... but leave the sleep(.5) part so that the cpu doesn't overclock when looking up the units... if you use a faster loop...it will slow you down https://community.bistudio.com/wiki/unitReady https://community.bistudio.com/wiki/Modules https://community.bistudio.com/wiki/missionNamespace https://community.bistudio.com/wiki/enableAI Share this post Link to post Share on other sites