Jump to content

TheGeneral2899

Member
  • Content Count

    59
  • Joined

  • Last visited

  • Medals

Everything posted by TheGeneral2899

  1. So you wanna make some campaigns or missions? Hopefully this concise guide will help you streamline the process and save you some time. This is the standard process that I tend to follow when creating campaigns or individual missions. Mission / Campaign Concept It's always important to have the basic concept in your head of what you want to do. Whether it's a full on tank battle single mission, or a 7 part campaign based on real world events, it's good to have the ideas flowing in your head. Write them down but be ready for things to change. Here's an example of one I recently wrote: As you can see, this is a very very broad description, however it outlines some key things such as the basic terrain concept, good guys or bad guys, be an official army or guerilla, have top level equipment gear or scavenged etc. Let's start building this campaign out! Choosing a Terrain Now comes the fun part of finding a terrain that works for the concept you have in your mind. Thanks to the huge modding community, players are constantly making custom made terrains for Arma. You can find a huge list from either within the Steam Workshop under the Terrain filter or here: http://www.armaholic.com/list.php?c=arma3_files_addons_islands http://cup-arma3.org/ https://steamcommunity.com/workshop/browse/?appid=107410&requiredtags[]=Terrain Download any and all terrains that might meet your criteria (jungle, water, snow, desert, industrial, rural etc). The more you download and test out, the more ideas and concepts will pop into your idea allowing you to expand on your initial idea. Areas of Interest Once you narrow the terrain choices to 1 or 2, open it up via the Eden 3D Editor and start "flying" around and marking off areas that could be fun to utilize. For example, see a cool compound that you could somehow fit into a mission? Mark it. Mark it with whatever "Cool Compound", "Badass HVT Capture Compound", "Military Base" etc. Do this for the entire map. I will often create a single playable soldier and walk around areas planning out ambush points, areas for roadblocks / checkpoints. It will take a good hour or so, but trust me, it saves you plenty of time in the long run. This also ties into planning a steady "flow" in terms of building out a campaign. Jumping around to opposite sides of the map for each mission is unrealistic. Now you have a basic template for lets say Chernarus Winter with a bank of over 60 areas or villages or even specific buildings that could be used to create some depth for your mission. Here is a screenshot of what I mean. Tutorials If you ever get stuck, you can find a multitude of video tutorials on youtube that are priceless for helping get a step by step visual understanding of how things are done. From simple task creation to complex triggers. I've compiled a list of some of the ones that helped me tremendously when first starting out. Jester814 Video Tutorials - Aside from his incredible recordings of milsim events, Jester has a long list of tutorials on how to achieve just about anything in the Arma Editor. Highly highly recommended. Armaidiot Video Tutorials - Another great collection of how to do some basics such as camera scripting. Feuerex Video Tutorials - I personally used his voice scripting, dialogue and lip syncing tutorials which helped me immensely in creating some top-notch mission dialogues with voice overs. Kylania's Scripts - A random collection of scripts coded for Arma2, however with a little tweaking many of them (some don't need any at all) they will work for Arma3. Scripting Scripting is often the difference between making a basic mission, to creating a masterpiece. I have little to no knowledge of coding, but luckily I’ve been able to understand the majority of scripts from looking at the BIS Wiki or even downloading some of the community made scripts and opening em up. I would highly recommend taking a look at this sticky thread on "Scripting introduction for new scripters". It has a boat load of good information including links to some amazing sites (that I don't have listed here). Another great method to find out how somebody did something you like in a mission is to "reverse engineer" it. A great tutorial found here explains how to extract the .pbo mission file. From there you will be able to open the mission in the Arma editor and also gain access to all the custom scripts used in the mission. This is invaluable when it comes to learning the Arma3 coding syntax. What better way to learn than from looking at other's source code! Conclusion This is a very broad guide that touches on many things, however being a new mission creator myself to the Arma community, I thought I should contribute a bit for those intimidated by mission making. There is nothing better than knowing your squad is approaching an IED on the road, which is followed by a trigger that sends 10 guys charging over a hill to ambush the convoy while they are still in shock. Had to mute my mic to stop myself from giggling like a child. Get down, make missions and fuck with your friends. For some shameless self-promotion, feel free to check out my first attempt at mission making on my 8 part campaign. More to come so keep an eye on my steam workshop.
  2. Hey everyone, I have a trigger 20 x 20 that acts as an area where the players are restricted to stay inside (Note players as it is for multiple playable units). The intention is to check if any of the players on lets say Independent team leave the area, then kill that specific player who left the area. I have this working for a specific unit, however lack the knowledge how to pull the list of all players (something like {_x in thisList} count (playableUnits + switchableUnits) > 0; or something like ({alive _x} count units groupname; ), and then only specifically kill that player who leaves. Any help would be much appreciated!
  3. Hey everyone, The concept is as follows: 1) Multiple teams of 2 with objectives spread across map. 2) These objectives have an addAction attached 3) I want to catch the player who activated the addAction via (_this select 1) 4) Find out what group he is in (right now I have in the init of all the playable units something along the lines of ("this group alpha", "this group bravo") 5) Add a +1 to that groups score (currently a public variable defined already called "alphaScore". For the life of me I have not been successful in getting past steps 3/4. Here is the current block of code: moneyCrate addaction ["<t color='#f0ff00'>Collect Cash",{ _unitGroup = groupId (group (_this select 1)); hint format ["Unit group is : %1", _unitGroup]; deleteVehicle moneyCrate; deleteVehicle money1; deleteVehicle money2; deleteVehicle money3; hint parseText _moneyMissionEndText; } ]; The print out for the hint is "Alpha 1-5" for instance, however doesnt match up with what I set in the unit's init. The only solution I can think of would be to map out a table as such Alpha 1-5 is equal to my bravo and Alpha 2-1 is equal to my charlie etc. etc. Any thoughts / ideas would be greatly appreciated.
  4. @gc8 - Clearly I like to complicate things for myself... thanks bud!
  5. Back for another question! I'm making a form of Radar system for a map I am working. Heres how it should work: 1) Player(s) walk within 4 meters of object to activate 2) Save the player / players into a variable. 3) Run code on this player WHILE they are within range. 4) Remove the players from code once they move away. Here is what I have so far: // Mission Timer (5 minutes) _radarEndTimer = 300; // Start of master while loop to end when timer runs out while {_radarEndTimer > 1} do { while {{player distance radarStation < 3} count allPlayers > 0} do { playersInRange = []; { playersInRange pushBack _x; } forEach nearestObjects [radarStation, [], 3]; sleep 0.5; while { Player is inside the array of players inside the range} do { // Run the code on this guy } }; _radarEndTimer = _radarEndTimer - 1; // hint format ["Time left : %1", _radarEndTimer]; sleep 1; }; Thanks for any help!
  6. TheGeneral2899

    Get Players Within X Distance of Object

    Right. I think the basic structure of it (which was the key here) is where I am struggling. I need to be able to catch once a player has left the area and stop running a script (i.e. delete the markers of player locations). If I were to use an If/Else block as you suggested, I could basically say if player is within the range of the radar, run function that shows players, else remove them ya? I'm going to set it on it a bit more tonight and will update here.
  7. TheGeneral2899

    Get Players Within X Distance of Object

    @Tajin - Super interesting concept... Didn't even think of spawning the trigger on top of the radar station and use that. More importantly though, in regards to the code you pasted above: 1) Once the player is no longer in range, the code will stop performing non them correct? It's basic purpose is to illustrate enemy players on map (via markers) once they are inside the range, however once they leave the range, remove the markers / end the code. 2) Didn't grasp the forEach radarStations part. I imagine radarStations is an array where I can populate radar1, radar2 etc. If I just wanted one though (which is the plan)? Appreciate the responses!
  8. I've searched on the forums and have tried several solutions with no avail. Have tried the fullCrew, count, !alive driver etc. Here is the code used to spawn in the vehicle / crew: // SPAWNS VEHICLE IN AND SETS ITS DIRECTION // CHANGE TO HUMMER MAYBE? _veh = "B_Quadbike_01_F" createVehicle getMarkerPos "weaponObjStart"; createVehicleCrew _veh; _dirVeh = markerDir "weaponObjStart"; _veh setDir _dirVeh; // SETS GROUP OF THE DRIVER _vehgrp = group driver _veh; Here is the if dead check (I would also be totally cool with checking if the driver is dead or the vehicle has been abandoned). Its an AI controlled vehicle and want to know if the players have disabled the wheels, thus forcing the AI to get out or if they just flat out shoot the guy. c if (count (fullCrew [_veh, "driver"]) == 0) then { //"vehObjective" setMarkerPos getPos debug; hint parseText _gearVehicleEndText; }; Any help would be appreciated. Can't seem to find a decent way to do this (that works). Thanks!
  9. Yea I basically overcomplicated the whole thing. Here is the solution: // SPAWNS VEHICLE IN AND SETS ITS DIRECTION gearVeh = "rhsusf_m1025_d" createVehicle getMarkerPos "weaponObjStart"; gearDriver moveInDriver gearVeh; _dirVeh = markerDir "weaponObjStart"; gearVeh setDir _dirVeh; // SPAWNS VEHICLE DRIVER WITH NAME "gearDriver" _gearGroup = Creategroup WEST; "B_RangeMaster_F" createUnit [getMarkerPos "weaponObjStart", _gearGroup, "gearDriver = this"]; Here is the check: // Notification of mission ended if (!alive gearDriver) then { // CODE };
  10. Afraid neither of those work. This is such a simple idea to check yet somehow not working no matter what method I'm using.
  11. So after about 3-4 days of messing around with this, I've come to the conclusion that I have no idea how to make it work / I suspect the "selectRandomWeighted" function doesnt work as it should. Script: It creates boxes all over the map and then should populate the boxes with gear according to weighted arrays. What Works: 1) Boxes spawn 2) Pistols and Rifles get added to the boxes no problem. Issues: 1) The weights of the selectRandomWeighted do not properly reflect what I have written in the arrays. Not even close. Went according to the wiki for it (https://community.bistudio.com/wiki/selectRandomWeighted) 2) Occasionally (on line 138) with the Debug Hint function, I am getting the word "Any" appearing for one of the gear results print outs. What I am unclear about is why this is happening? I suspect its due to something with the way I constructed this whole thing? 3) In certain arrays ("_rifles") for instance there is a nested array with the gun and magazine class name, however I have certain arrays (such as "grenades") that only have one element in the array. How can I check up to see if there is no 2nd element and bypass it? I have attempted this at around line 143. 4) Backpacks will not get created in the "AddItemCargo" no matter what I try, despite me seeing their class name and all via the debug hint. I really hope I commented my code well enough so that ppl can understand. Also, if any more experienced coders look at what I did and want to facepalm, please any and all advice would be great! Thank you in advance! // By TheGeneral // Script to spawn crates and a random weighted type of gear / ammo in each one. // Array of all scrate spawn positions marked as pencils //_prefix = "cratespawn_"; _prefix = "test_"; _len = count _prefix; _crateLocs = allMissionObjects "" select { vehicleVarName _x select [ 0, _len ] == _prefix }; // Get Number of Available pen locations for while loop _numOfCrateLocs = count _crateLocs; // Declaring which items are in each gear type and their relevant weights /////////////////// // GEAR TYPE # 1 // /////////////////// _rifles = [ ["rhs_weap_m16a4","30Rnd_556x45_Stanag"], 0.18, ["rhs_weap_m4", "30Rnd_556x45_Stanag"], 0.16, ["rhs_weap_ak74n_npz","rhs_30Rnd_545x39_AK_green"] ,0.19, ["rhs_weap_m24sws","rhsusf_5Rnd_762x51_m62_Mag"], 0.05, ["rhs_weap_sr25_d", "rhsusf_20Rnd_762x51_m62_Mag"] ,0.07, ["rhs_weap_ak74mr","rhs_30Rnd_762x39mm"], 0.17, ["rhs_weap_svdp", "rhs_10Rnd_762x54mmR_7N1"], 0.08, ["rhs_weap_aks74u", "rhs_45Rnd_545X39_7N10_AK"], 0.23, ["rhs_weap_m4a1_blockII_d", "30Rnd_556x45_Stanag"], 0.14 ]; _mgs = [ ["rhsusf_weap_MP7A2_desert","rhsusf_mag_40Rnd_46x30_FMJ"] ,0.27, ["rhs_weap_pp2000", "rhs_mag_9x19mm_7n21_20"], 0.28, ["rhs_weap_m590_5RD", "rhsusf_5Rnd_00Buck"], 0.18, ["rhs_weap_m249", "rhsusf_100Rnd_556x45_M855_soft_pouch"], 0.08, ["smg_02_f", "30Rnd_9x21_Mag_SMG_02"], 0.23 ]; _vests = [ ["V_EOD_olive_F"] , 0.09, ["V_EOD_coyote_F"] , 0.09, ["V_Press_F"] , 0.15, ["V_TaCVest_brn"] , 0.2, ["V_Chestrig_khk"] , 0.25, ["V_Chestrig_oli"] , 0.25, ["V_PlateCarrier_Kerry"] , 0.12 ]; /////////////////// // GEAR TYPE # 2 // /////////////////// _backpacks = [ ["Rhsusf_assault_eagleaiii_ucp"] , 0.2, ["rhsusf_falconii_mc"] , 0.2, ["B_FieldPack_cbr"] , 0.1, ["B_LegStrapBag_black_F"] , 0.4 ]; _helmets = [ ["rhsusf_ach_bare_tan"] , 0.12, ["rhsusf_ach_helmet_ocp"] , 0.12, ["rhsusf_ach_helmet_camo_ocp"] , 0.12, ["H_PASGT_basic_white_f"] , 0.12, ["rhsusf_hgu56p_visor_mask_Empire_black"] , 0.12, ["H_HelmetB_light_desert"] , 0.12, ["rhsusf_mich_bar_alt_semi"] , 0.12, ["H_PASGT_neckprot_blue_press_F"] , 0.07, ["H_ShemagOpen_khk"] , 0.2, ["H_ShemagOpen_olive"] , 0.2, ["H_ShemagOpen_tan"] , 0.2, ["H_Booniehat_tan"] , 0.2, ["rhs_booniehat2_marpatd"] , 0.2 ]; _grenades = [ ["rhs_magazine_rhs_mag_m67"] , 0.15, ["SmokeShell"] , 0.15, ["SmokeShellRed"] , 0.15, ["SmokeShellGreen"] , 0.15, ["SmokeShellBlue"] , 0.15, ["SmokeShellYellow"] , 0.15 ]; /////////////////// // GEAR TYPE # 3 // /////////////////// _pistols = [ ["rhsusf_weap_m9","rhsusf_mag_15Rnd_9x19_FMJ"], 0.33, ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], 0.19, ["hgun_Pistol_heavy_01_F","11Rnd_45ACP_Mag"] ,0.19, ["hgun_Rook40_F","16Rnd_9x21_Mag"], 0.19 ]; _medical = [ ["ACE_morphineItem"] , 0.25, ["ACE_fieldDressing"] , 0.4, ["ACE_epinephrine"] , 0.15 ]; _accessories = [ ["rhsusf_acc_m8541_low_wd"] , 0.07, ["rhsusf_acc_EOTECH"] , 0.22, ["rhsusf_acc_ACOG"] , 0.16, ["rhs_acc_pso1m21"] , 0.1, ["optic_aco"] , 0.35, ["optic_SOS"] , 0.12 ]; // ARRAYS FOR CATEGORIES OF GEAR TO BE DECIDED AND THEIR WEIGHTS. THE CODE WILL SELECT 2 OF THE 3 "GEARTYPES" TO BE SELECTED AND USED TO ADD TO CRATES _gearType_1 = [_rifles, 0.18, _mgs, 0.24, _vests, 0.25]; _gearType_2 = [_backpacks, 0.10, _helmets, 0.10, _grenades, 0.95]; _gearType_3 = [_pistols, 0.15, _medical, 0.15, _accessories, 0.10]; _gearTypes = [_gearType_1, _gearType_2,_gearType_3]; // STARTING LOOP TO CREATE CRATES AND DO CHECKS while {_numOfCrateLocs > 0} do { // Selects random marker pos _equipmentCrate = _crateLocs call BIS_fnc_selectRandom;; _equipmentCratePos = getPosATL _equipmentCrate; // Created Ammo crate at the marker location _crate = createVehicle ["Box_NATO_Ammo_F", _equipmentCratePos, [], 0, "CAN_COLLIDE"]; clearMagazineCargo _crate; clearWeaponCargo _crate; // Choose which 2 gear types are going to be used: _gearRandom_All = _gearTypes; _gearRandom_1 = selectRandom _gearRandom_All; _gearRandom_All = _gearRandom_All - [_gearRandom_1]; _gearRandom_2 = selectRandom _gearRandom_All; // INTENTION IS TO SELECT THE SPECIFIC GEAR FROM THE RANDOMED GEAR TYPE _gearResult_1 = selectRandomWeighted (_gearRandom_1 select 0); _gearResult_2 = selectRandomWeighted (_gearRandom_2 select 0); hint format ["GEAR RESULT 1: %1 . GEAR RESULT 2: %2", _gearResult_1, _gearResult_2]; // VARIABLE TO DETERMING RANDOM AMOUNT OF MAGS TO ADD IF ITEM IS A GUN / NADE / MEDIC GEAR _rndMagCount = selectRandom [2,3,4]; if ([_medical] in _gearRandom_1 || [_grenades] in _gearRandom_1) then { _crate addItemCargo [(_gearResult_1 select 0),_rndMagCount]; } else { _crate addItemCargo [(_gearResult_1 select 0),1]; }; if (isNil {_gearResult_1 select 1}) then { } else { _crate addItemCargo [(_gearResult_1 select 1),_rndMagCount]; }; if ([_medical] in _gearRandom_2 || [_grenades] in _gearRandom_2) then { _crate addItemCargo [(_gearResult_2 select 0),_rndMagCount]; } else { _crate addItemCargo [(_gearResult_2 select 0),1]; }; if (isNil {_gearResult_2 select 1}) then { } else { _crate addItemCargo [(_gearResult_2 select 1),_rndMagCount]; }; // OLD CODE KEEPING HERE FOR TESTING // _result = selectRandomWeighted _rifles; // _crate addItemCargo [(_result select 1),1]; // _crate addItemCargo [(_result select 0),1]; // REMOVE CRATE POSITION ALREADY DONE FROM ARRAY _crateLocs = _crateLocs - [_equipmentCrate]; _numOfCrateLocs = _numOfCrateLocs - 1; sleep 4; };
  12. TheGeneral2899

    [SOLVED]Gear Randomization Script

    @Larrow - Duuuuuuddeeee! First of all, thank you so much for taking the time to look and help. Second, appreciate you as a more experienced coder seeing and correcting with explanations. 1) I completely overlooked the forEach and used a while loop. Appreciate that. 2) I will be bisecting each line to understand as I have never used (more misunderstood) the BIS_fnc_itemType function. Again thank you, tested and works. EDIT: Full script here so others can see how it was done: // By TheGeneral // Script to spawn crates and a random weighted type of gear / ammo in each one. // Declaring which items are in each gear type and their relevant weights /////////////////// // GEAR TYPE # 1 // /////////////////// _rifles = [ ["rhs_weap_m16a4","30Rnd_556x45_Stanag"], 0.18, ["rhs_weap_m4", "30Rnd_556x45_Stanag"], 0.16, ["rhs_weap_ak74n_npz","rhs_30Rnd_545x39_AK_green"] ,0.19, ["rhs_weap_m24sws","rhsusf_5Rnd_762x51_m62_Mag"], 0.05, ["rhs_weap_sr25_d", "rhsusf_20Rnd_762x51_m62_Mag"] ,0.07, ["rhs_weap_ak74mr","rhs_30Rnd_762x39mm"], 0.17, ["rhs_weap_svdp", "rhs_10Rnd_762x54mmR_7N1"], 0.08, ["rhs_weap_aks74u", "rhs_45Rnd_545X39_7N10_AK"], 0.23, ["rhs_weap_m4a1_blockII_d", "30Rnd_556x45_Stanag"], 0.14 ]; _mgs = [ ["rhsusf_weap_MP7A2_desert","rhsusf_mag_40Rnd_46x30_FMJ"] ,0.27, ["rhs_weap_pp2000", "rhs_mag_9x19mm_7n21_20"], 0.28, ["rhs_weap_m590_5RD", "rhsusf_5Rnd_00Buck"], 0.18, ["rhs_weap_m249", "rhsusf_100Rnd_556x45_M855_soft_pouch"], 0.08, ["smg_02_f", "30Rnd_9x21_Mag_SMG_02"], 0.23 ]; _vests = [ ["V_EOD_olive_F"] , 0.09, ["V_EOD_coyote_F"] , 0.09, ["V_Press_F"] , 0.15, ["V_TaCVest_brn"] , 0.2, ["V_Chestrig_khk"] , 0.25, ["V_Chestrig_oli"] , 0.25, ["V_PlateCarrier_Kerry"] , 0.12 ]; /////////////////// // GEAR TYPE # 2 // /////////////////// _backpacks = [ ["Rhsusf_assault_eagleaiii_ucp"] , 0.2, ["rhsusf_falconii_mc"] , 0.2, ["B_FieldPack_cbr"] , 0.1, ["B_LegStrapBag_black_F"] , 0.4 ]; _helmets = [ ["rhsusf_ach_bare_tan"] , 0.12, ["rhsusf_ach_helmet_ocp"] , 0.12, ["rhsusf_ach_helmet_camo_ocp"] , 0.12, ["H_PASGT_basic_white_f"] , 0.12, ["rhsusf_hgu56p_visor_mask_Empire_black"] , 0.12, ["H_HelmetB_light_desert"] , 0.12, ["rhsusf_mich_bar_alt_semi"] , 0.12, ["H_PASGT_neckprot_blue_press_F"] , 0.07, ["H_ShemagOpen_khk"] , 0.2, ["H_ShemagOpen_olive"] , 0.2, ["H_ShemagOpen_tan"] , 0.2, ["H_Booniehat_tan"] , 0.2, ["rhs_booniehat2_marpatd"] , 0.2 ]; _grenades = [ ["rhs_magazine_rhs_mag_m67"] , 0.10, ["SmokeShell"] , 0.15, ["SmokeShellRed"] , 0.16, ["SmokeShellGreen"] , 0.17, ["SmokeShellBlue"] , 0.18, ["SmokeShellYellow"] , 0.19 ]; /////////////////// // GEAR TYPE # 3 // /////////////////// _pistols = [ ["rhsusf_weap_m9","rhsusf_mag_15Rnd_9x19_FMJ"], 0.33, ["hgun_Pistol_heavy_02_F", "6Rnd_45ACP_Cylinder"], 0.19, ["hgun_Pistol_heavy_01_F","11Rnd_45ACP_Mag"] ,0.19, ["hgun_Rook40_F","16Rnd_9x21_Mag"], 0.19 ]; _medical = [ ["ACE_morphineItem"] , 0.25, ["ACE_fieldDressing"] , 0.4, ["ACE_epinephrine"] , 0.15 ]; _accessories = [ ["rhsusf_acc_m8541_low_wd"] , 0.07, ["rhsusf_acc_EOTECH"] , 0.22, ["rhsusf_acc_ACOG"] , 0.16, ["rhs_acc_pso1m21"] , 0.1, ["optic_aco"] , 0.35, ["optic_SOS"] , 0.12 ]; // ARRAYS FOR CATEGORIES OF GEAR TO BE DECIDED AND THEIR WEIGHTS. THE CODE WILL SELECT 2 OF THE 3 "GEARTYPES" TO BE SELECTED AND USED TO ADD TO CRATES _gearType_1 = [_rifles, 0.18, _mgs, 0.24, _vests, 0.25]; _gearType_2 = [_backpacks, 0.10, _helmets, 0.10, _grenades, 0.95]; _gearType_3 = [_pistols, 0.15, _medical, 0.15, _accessories, 0.10]; _gearTypes = [_gearType_1, _gearType_2,_gearType_3]; // Array of all scrate spawn positions marked as pencils //_prefix = "cratespawn_"; _prefix = "test_"; _crateLocs = allMissionObjects "" select { vehicleVarName _x select [ 0, count _prefix ] == _prefix }; // Get Number of Available pen locations for while loop _numOfCrateLocs = count _crateLocs; // STARTING LOOP TO CREATE CRATES AND DO CHECKS { // Selects random pos _equipmentCratePos = getPosATL ( _crateLocs deleteAt ( floor( random count _crateLocs ))); // Created Ammo crate at the marker location _crate = createVehicle ["Box_NATO_Ammo_F", _equipmentCratePos, [], 0, "CAN_COLLIDE"]; clearBackpackCargoGlobal _crate; clearItemCargoGlobal _crate; clearMagazineCargo _crate; clearWeaponCargo _crate; // Choose which 2 gear types are going to be used: _gearRandom_1 = selectRandom _gearTypes; _gearRandom_2 = selectRandom ( _gearTypes - [ _gearRandom_1 ] ); { { _x call BIS_fnc_itemType params[ "_itemType", "_itemSubType" ]; switch ( toUpper _itemType ) do { case "MINE"; case "MAGAZINE" : { _crate addMagazineCargoGlobal [ _x, selectRandom [2,3,4] ]; }; case "ITEM" : { if ( [ _x ] in _medical ) then { _crate addItemCargoGlobal [ _x, selectRandom [2,3,4] ]; }else{ _crate addItemCargoGlobal [ _x, 1 ]; }; }; case "WEAPON" : { _crate addWeaponCargoGlobal [ _x, 1 ]; }; case "EQUIPMENT" : { if ( _itemSubType == "backpack" ) then { _crate addBackpackCargoGlobal [ _x, 1 ]; }else{ _crate addItemCargoGlobal [ _x, 1 ]; }; }; }; }forEach _x; //[ _item, _mag( possible ) ] }forEach [ // INTENTION IS TO SELECT THE SPECIFIC GEAR FROM THE RANDOMED GEAR TYPE //select weighted ( _rifles, _mgs, _vests ) then again select weighted of result ( _rifles ) selectRandomWeighted selectRandomWeighted _gearRandom_1, selectRandomWeighted selectRandomWeighted _gearRandom_2 ]; }forEach +_crateLocs;
  13. Amazing. I believe I got it working and appreciate the insight. Happy to bring back the thread after 5 years =) Here is the code I used for anybody who needs in the future: _rifles = [ ["rhs_weap_m16a4","30Rnd_556x45_Stanag"], 0.18, ["rhs_weap_m4", "30Rnd_556x45_Stanag"], 0.16, ["rhsusf_weap_MP7A2_desert","rhs_ammo_46x30_FMJ"] ,0.27, ["rhs_weap_m24sws","rhsusf_5Rnd_762x51_m62_Mag"], 0.05, ["rhs_weap_sr25_d", "rhsusf_20Rnd_762x51_m62_Mag"] ,0.07, ["rhs_weap_ak74mr","rhs_30Rnd_762x39mm"], 0.17, ["rhs_weap_pp2000", "rhs_mag_9x19mm_7n21_20"], 0.28, ["rhs_weap_svdp", "rhs_10Rnd_762x54mmR_7N1"], 0.08, ["rhs_weap_aks74U", "rhs_30Rnd_762x39mm"], 0.23, ["rhs_weap_mk416d10", "30Rnd_556x45_Stanag"], 0.14, ["rhs_weap_m590_5RD", "rhsusf_5Rnd_00Buck"], 0.18 ]; _result = selectRandomWeighted _rifles; _equipmentCrate addMagazine (_result select 1); _equipmentCrate addWeapon (_result select 0);
  14. @MrSanchez - Hah I'm amazed you responded! I looked into that function but I don't understand if the weighted values are given directly the relevant. For example: _values = [0,1,2,3,4,5,6,7,8,9]; _weights = [0.109,0.65,0.01,1.01,1.24,0,1.59,0.09,1.15,0.55]; _result = _values selectRandomWeighted _weights; Is the first value in the values array (0), given the first value in the weights array (0.109)? If not, how can I give a direct weight value to a specific value?
  15. @MrSanchez - I am currently working on the same concept of a random loot spawner with weights. Any chance you can share your code that you used? I am getting horribly stuck on this! Much thanks in advance
  16. Once again, I have a best practices question. Here is the situation: I have a series of objects (over 100) spread through the map to dictate where the crates will spawn and call it in an array: _crateSpawns = [cratespawn_1, cratespawn_2, cratespawn_3, cratespawn_4, cratespawn_5, cratespawn_6, cratespawn_7, cratespawn_8, cratespawn_9, cratespawn_10]; Is there a way to save myself time of writing out 100 of these cratespawn_x and just populate the array with all objects that contain "cratespawn_" for instance? Not sure if even possible, but I have a feeling a more experienced coder would know. Thanks!
  17. You're trying to get it to find a marker, but the first parameter is asking for an object. Try changing to: _randPos = [getMarkerPos mrk_l , 0, 100, 12, 0, 0.3, 0] call BIS_fnc_findSafePos; Just a guess from an initial glance. I think the mrk_1 variable is storing a marker right? So you'd need to getMarkerPos.
  18. @Tajin - Ahhhhhhhh!!! That makes sense now! Thank you! Just to confirm, the entire array will be filled with all the objects that contain the same prefix as defined, however with their full name correct? Meaning the array wont append the prefix or anything so the array will just be filled with [1,2,3,4,5,6,] but rather the full [cratespawn_1, cratespawn_2] etc. I ask because I want to run a while loop in order to populate all of the object locations such as: _prefix = "spawncrate_"; _len = count _prefix; _crateSpawns = allMapMarkers select { (_x select [0, _len]) isEqualTo _prefix }; while {#WhateverImChecking} do { // Selects random crate location _rndCrate = selectRandom _crateSpawns; #Whatever code I want to run in each loop // Removes the completed crate location from array _crateSpawns = _crateSpawns - _rndGroup; }; Technically, that would work right? For reference this will all be sitting in a function being called in a script. Not sure if its important to note or not.
  19. Oh bless you all for the amazing answers. @Grumpy Old Man - I was referring to objects in the post, but markers would have been a follow-up question. @Tajin - Looks straight forward, what I am not clear about is the [0, _len] part. If the _len variable is catching the number of characters in the string _prefix (which would be 11), wouldn't the array be empty as I am saying isEqualTo? For instance, all the markers in this case would be "cratespawn_(11Here)12(Character#12)". Thus not equal to anything? Maybe I'm misunderstanding! @Larrow - Sorry I will be more specific! I am referring to pencils placed down in locations so not units or gameLogics, but good to know! I will try all these methods when I get home and see which works. Appreciate as always the awesome community here and try to give back as much as I can as well!
  20. @wozzsta - You can look into the Liberation game mode (https://forums.bistudio.com/forums/topic/202711-mpcti-coop-liberation-continued/) which has a form of base building that you can extract / learn from.
  21. @mcnools - I use this for a training map I designed for my squad to allow them to teleport to different training areas. Works like a charm and keeps it very very simple. I wasn't at home, but here is the exact code I used: 0 = this addaction ["Start Area",{(_this select 1) setpos (markerpos "homebase")}];
  22. Hey McNools - it's pretty straightforward approach: In the object you want to have the scroll wheel action (Similar to Open Door) place the following code in the init: this addAction ["Enter Nuclear Bunker", {player setPos (getPos object)}] Replace the "object" with the name of the object with the object to where the player will be teleported to. Alternatively if you want to teleport them to a marker position, you can do it as such: this addAction ["Enter Nuclear Bunker", {player setPos (getMarkerPos "markername")}] Hope this helps!
  23. Hello All, To keep it as brief as possible, I have a script which is being run at the mission start which is a while loop. There are several blocks of code that are repeated on specific "rounds" of the while loop as such: if ( _i == 7 || _i == 12 || _i == 17 || _i == 21 || _i == 23 || _i == 26 || _i == 30 || _i == 35 || _i == 39 || _i == 42 || _i == 47 || _i == 54) then { #BLOCK CODE #1 }; if ( _i == 9 || _i == 15 || _i == 22 || _i == 27 || _i == 34 || _i == 40 || _i == 54) then { BLOCK CODE #2 }; Everything works fine currently, however I am wondering if I can replace the blocks of code to some external script in order for better management and not have it be one giant script with all code in each while loop if check. More importantly have a "BlockCode1.sqf" and "BlockCode2.sqf" scripts which are being called in the main script. For reference the code basically does some selectRandom checks and then spawns some AI / vehicles and moves them to designated waypoints. As I've understood it would be either via spawn, execVM or call, however I am not sure which would be best here. Any experienced coders advice would be great!
  24. @HazJ - Awesome that is also what I am looking for. I know there are more efficient ways of doing things, in terms of code amount / functions and that perfectly illustrates what I am after. Much appreciated to both of you @HazJ and @Grumpy Old Man
  25. Awesome! That is exactly what I needed and will have a read. Cant believe I didnt find this myself... As for performance issues, I image it was more because of the mass of AI that is being spawned in.
×