anton_st 1 Posted August 31, 2015 G'day, I've been on the hunt for a script like the one used in ArmA 3 Epoch to add loot to trash piles & bins etc but can't find anything similar. I'm new to editing & scripting so if anyone could help point me in the right direction I would greatly appreciate the help. This is what I am looking to add to my missions... Trash Nodes Outside List of objects that can be looted To loot a pile or object outside of a building stand on top of or next to it and press "i"(or inventory key) and again to open gear. http://epochmod.gamepedia.com/A3Epoch:Arma_3_Epoch#Explore_.26_Loot Share this post Link to post Share on other sites
Ranwer135 308 Posted September 1, 2015 This reply has been deleted because the script was wrong and I had made a hasty reply. I will, however, keep an eye on this thread. 1 Share this post Link to post Share on other sites
Larrow 2822 Posted September 1, 2015 Also, Users like "DreadedEntity", please don't comment on my script if its wrong, this is all by memory, so please accept what I have.If its wrong , its wrong. Why shouldn't people comment on miss information? Ive bit my tounge on many of your post as you always seem to complain when people point out your mistakes. If you can not post correct code due to you being on your phone , either wait until you get to your PC or just explain that it may not be correct and you will correct it later but dont go calling people out just because they may try to help correct you mistakes. BTW your code dont work. 5 Share this post Link to post Share on other sites
anton_st 1 Posted September 1, 2015 Thanks for the reply, I tried pasting that code in my mission but i'm not sure what it did, the trash still isn't "lootable" If there are any corrections that could be made please let me know. My level of scripting is comparable to a 2 year olds level of reading... i'm still working on it, big time. Is there any way I could extract the Epoch trash loot files and add them to my missions (in mod or script)? I love pretty much all the ways Epoch make loot available but I don't have the skills to make a similar mod. I have no idea how they make parts of the map lootable... that's what I really would like. Share this post Link to post Share on other sites
mindstorm 8 Posted September 1, 2015 Can't you just spawn an container item on top/inside of the bin and then call hideObjectGlobal true on the object? Share this post Link to post Share on other sites
anton_st 1 Posted September 1, 2015 Can't you just spawn an container item on top/inside of the bin and then call hideObjectGlobal true on the object? lol i've done that without even hiding the crates since A2 but now I see in A3 looting garbage piles & bins etc makes it seem that there's no placing crates, you loot the trash that's originally on the map by destroying it then loot just spawns on the ground.It adds that much more immersion imo. Same with chopping trees with an axe and getting wood to craft fires etc with. I just wish I could have some kind of module or script to add those things to pretty much all my personal missions. Share this post Link to post Share on other sites
dreadedentity 278 Posted September 1, 2015 Also, Users like "DreadedEntity", please don't comment on my script if its wrong, this is all by memory, so please accept what I have. rofl, you get my first "like". This is too good. 1 Share this post Link to post Share on other sites
Ranwer135 308 Posted September 1, 2015 *sigh* :p At least I answered his question with an idea of what he needs to do... The script looks to be fine, but I am unsure about it randomizing. If I had "BIS_fnc_SelectRandom" with the array, it would only randomize it once and the player would get the same thing. (The problem in my solution is it may grab a random item for each script command that has that variable) The only possible way I can think of for a mission-based custom ammo box, is that function I wrote up above. And if I was haste in that comment, probably globaly now, then I'm sorry. (I make mistakes, we all make mistakes. Scripting is all about trial and error, unless you have a table of script commands) Share this post Link to post Share on other sites
Ranwer135 308 Posted September 1, 2015 If its wrong , its wrong. Why shouldn't people comment on miss information? Ive bit my tounge on many of your post as you always seem to complain when people point out your mistakes.If you can not post correct code due to you being on your phone , either wait until you get to your PC or just explain that it may not be correct and you will correct it later but dont go calling people out just because they may try to help correct you mistakes.BTW your code dont work.Actually, that is wrong. I have been polite to many of my reply's, unless the forums is dealing with a piracy thread.Okay, maybe I might have stepped over the line when calling names out, but I had some sense that some person was going to reply about my script. (And I would be happy to learn and accept that reply, but sometimes you just feel like you want to help them out, regardless on what device you are on and if your script is wrong) The script was wrong, fine, at least you guys know what I was trying to do here. (I will get rid of my first reply.) Share this post Link to post Share on other sites
anton_st 1 Posted September 1, 2015 Thanks for your help Ranwer135 I appreciate it. So that code you wrote should allow objects on the map to spawn loot? I'm not sure what it did. rofl, you get my first "like". This is too good. Hi Dreadedentity, since you seem pretty popular around here and made an appearance is there anything you can add that might help me loot the garbage bins on the map? :) Share this post Link to post Share on other sites
Ranwer135 308 Posted September 2, 2015 With regards to the script, here was how it should work: 1. You get near the trash/junk and an action is displayed. 2. You click on it, then it fires off the function. 3. It randomizes how many it should give you, and what items that you will receive. 4. Finishes function and waits until your near another one. There were 2 arrays that obviously looked wrong, and the items inside were just to display what type of classnames you should put in, and how to use it. If the "addAction" syntax was corrected, and your custom classnames are in the array, no doubt that it should have worked. :) You could also change: _chance = 5 (random 5)to: _chance = [1, 2, 3, 4, 5] call BIS_fnc_SelectRandom; Even now, since the activity above, I doubt that this would help. :( Share this post Link to post Share on other sites
Larrow 2822 Posted September 2, 2015 Heres a little something to mess around with. LARs_lootClasses = [ "Land_GarbagePallet_F", "Land_ToiletBox_F", "Land_CratesShabby_F", "Land_CratesWooden_F", "Land_BarrelSand_F", "Land_GarbageBags_F", "Land_Sacks_goods_F", "Land_CratesPlastic_F", "Land_Basket_F", "Land_BC_Basket_F", "Land_JunkPile_F", "Land_Sack_F", "Land_MetalBarrel_empty_F", "Land_Sacks_heap_F" ]; LARs_lootModels = [ "garbagepallet_f.p3d", "toiletbox_f.p3d", "cratesshabby_f.p3d", "crateswooden_f.p3d", "barrelsand_f.p3d", "garbagebags_f.p3d", "sacks_goods_f.p3d", "cratesplastic_f.p3d", "basket_f.p3d", "junkpile_f.p3d", "sack_f.p3d", "metalbarrel_empty_f.p3d", "sacks_heap_f.p3d" ]; LARs_loot = ["FirstAidKit","30Rnd_65x39_caseless_mag","Chemlight_green","16Rnd_9x21_Mag","SmokeShell","SmokeShellGreen","Chemlight_green","HandGrenade","B_AssaultPack_blk","arifle_MX_ACO_pointer_F","hgun_P07_F"]; player setVariable [ "LARs_searchObjectID", player addAction [ "Search #", { nul = [] spawn { player playAction "Crouch"; _wh = createVehicle [ "GroundWeaponHolder", getPosATL player, [], 0, "CAN_COLLIDE" ]; for "_i" from 0 to floor( random 5 ) do { _item = LARs_loot call BIS_fnc_selectRandom; _itemType = _item call BIS_fnc_itemType; switch ( _itemType select 0 ) do { case "Equipment" : { if ( _itemType select 2 isEqualTo "Backpack" ) then { _wh addBackpackCargoGlobal [ _item, 1 ]; }else{ _wh addItemCargoGlobal [ _item, 1 ]; }; }; case "Item" : { _wh addItemCargoGlobal [ _item, 1 ]; }; case "Weapon" : { _wh addWeaponCargoGlobal [ _item, 1 ]; }; case "Magazine" : { _wh addMagazineCargoGlobal [ _item, 1 ]; }; }; }; player action [ "Gear", _wh ]; waitUntil{ count ( getPosATL _wh nearEntities [ "MAN", 15 ] ) isEqualTo 0 }; deleteVehicle _wh; }; }, [], 1, true, true, "", " if !( isnil 'LARs_searchObject' ) then { player setUserActionText [ player getvariable 'LARs_searchObjectID', format [ 'Search %1', LARs_searchObject] ]; true }; " ] ]; EH = addMissionEventHandler ["Draw3D",{ _objs = lineIntersectsObjs [ATLToASL positionCameraToWorld [0,0,0], ATLToASL positionCameraToWorld[0,0,4], player, objNull, true, 32]; if ( count _objs > 0 ) then { _obj = _objs select (( count _objs ) -1 ); if ( !( typeOf _obj isEqualTo "" ) && { typeOf _obj in LARs_lootClasses } ) then { LARs_searchObject = getText( configFile >> "CfgVehicles" >> typeOf _obj >> "displayname" ); }else{ _obj = (( str _obj splitString " " ) select 1); if ( _obj in LARs_lootModels ) then { LARs_searchObject = _obj select [ 0, ( count _obj ) - 6 ]; }; }; }else{ LARs_searchObject = nil; }; }]; 1 Share this post Link to post Share on other sites
anton_st 1 Posted September 2, 2015 Heres a little something to mess around with. LARs_lootClasses = [ "Land_GarbagePallet_F", "Land_ToiletBox_F", "Land_CratesShabby_F", "Land_CratesWooden_F", "Land_BarrelSand_F", "Land_GarbageBags_F", "Land_Sacks_goods_F", "Land_CratesPlastic_F", "Land_Basket_F", "Land_BC_Basket_F", "Land_JunkPile_F", "Land_Sack_F", "Land_MetalBarrel_empty_F", "Land_Sacks_heap_F" ]; LARs_lootModels = [ "garbagepallet_f.p3d", "toiletbox_f.p3d", "cratesshabby_f.p3d", "crateswooden_f.p3d", "barrelsand_f.p3d", "garbagebags_f.p3d", "sacks_goods_f.p3d", "cratesplastic_f.p3d", "basket_f.p3d", "junkpile_f.p3d", "sack_f.p3d", "metalbarrel_empty_f.p3d", "sacks_heap_f.p3d" ]; LARs_loot = ["FirstAidKit","30Rnd_65x39_caseless_mag","Chemlight_green","16Rnd_9x21_Mag","SmokeShell","SmokeShellGreen","Chemlight_green","HandGrenade","B_AssaultPack_blk","arifle_MX_ACO_pointer_F","hgun_P07_F"]; player setVariable [ "LARs_searchObjectID", player addAction [ "Search #", { nul = [] spawn { player playAction "Crouch"; _wh = createVehicle [ "GroundWeaponHolder", getPosATL player, [], 0, "CAN_COLLIDE" ]; for "_i" from 0 to floor( random 5 ) do { _item = LARs_loot call BIS_fnc_selectRandom; _itemType = _item call BIS_fnc_itemType; switch ( _itemType select 0 ) do { case "Equipment" : { if ( _itemType select 2 isEqualTo "Backpack" ) then { _wh addBackpackCargoGlobal [ _item, 1 ]; }else{ _wh addItemCargoGlobal [ _item, 1 ]; }; }; case "Item" : { _wh addItemCargoGlobal [ _item, 1 ]; }; case "Weapon" : { _wh addWeaponCargoGlobal [ _item, 1 ]; }; case "Magazine" : { _wh addMagazineCargoGlobal [ _item, 1 ]; }; }; }; player action [ "Gear", _wh ]; waitUntil{ count ( getPosATL _wh nearEntities [ "MAN", 15 ] ) isEqualTo 0 }; deleteVehicle _wh; }; }, [], 1, true, true, "", " if !( isnil 'LARs_searchObject' ) then { player setUserActionText [ player getvariable 'LARs_searchObjectID', format [ 'Search %1', LARs_searchObject] ]; true }; " ] ]; EH = addMissionEventHandler ["Draw3D",{ _objs = lineIntersectsObjs [ATLToASL positionCameraToWorld [0,0,0], ATLToASL positionCameraToWorld[0,0,4], player, objNull, true, 32]; if ( count _objs > 0 ) then { _obj = _objs select (( count _objs ) -1 ); if ( !( typeOf _obj isEqualTo "" ) && { typeOf _obj in LARs_lootClasses } ) then { LARs_searchObject = getText( configFile >> "CfgVehicles" >> typeOf _obj >> "displayname" ); }else{ _obj = (( str _obj splitString " " ) select 1); if ( _obj in LARs_lootModels ) then { LARs_searchObject = _obj select [ 0, ( count _obj ) - 6 ]; }; }; }else{ LARs_searchObject = nil; }; }]; Wow! it worked like a charm, thanks!!!Just wondering, is there a chance nothing will spawn? It seems like every garbage pile has something in it. I could just add a note in the briefings about how wasteful the locals are I guess :) Thanks again! Share this post Link to post Share on other sites
Ranwer135 308 Posted September 3, 2015 _chance = round (random 5); if (_chance > 3) exitWith {titleCut ["You have found nothing", "PLAIN DOWN"]}; On PC, btw.. Share this post Link to post Share on other sites
anton_st 1 Posted September 3, 2015 _chance = round (random 5); if (_chance > 3) exitWith {titleCut ["You have found nothing", "PLAIN DOWN"]}; On PC, btw.. thanks Ranwer that was quick! After trying it with a chance of no loot I decided it didn't make much sense to find nothing at all in a pile of trash so I just increased the chances of finding trash like empty cans and things that have no use. Since there's no limit to looting one pile it kind of makes sense to loot over and over and find way more trash than loot. Also added a 5 second animation so I don't spam the loot button. It seriously is starting to look awesome, especially with RickB's inventory items and survival modules. It's like a whole new game for me thanks to you guys. Thanks a million times for all the help guys, i'm so impressed! :D Share this post Link to post Share on other sites
Larrow 2822 Posted November 26, 2015 A fellow forum user LaurenTyler got intouch to ask if i could add some enhancements to my script in this thread. DOWNLOAD Here are a list of the settings that can now be changed and can be found in "\LARs_searchLoot.Stratis\LARs\LARs_searchLoot\LARs_lootSettings.sqf". //Class types that can be looted LARs_lootClasses = [ "Land_GarbagePallet_F", "Land_ToiletBox_F", "Land_CratesShabby_F", "Land_CratesWooden_F", "Land_BarrelSand_F", "Land_GarbageBags_F", "Land_Sacks_goods_F", "Land_CratesPlastic_F", "Land_Basket_F", "Land_BC_Basket_F", "Land_JunkPile_F", "Land_Sack_F", "Land_MetalBarrel_empty_F", "Land_Sacks_heap_F" ]; //Model types that can be looted LARs_lootModels = [ "garbagepallet_f.p3d", "toiletbox_f.p3d", "cratesshabby_f.p3d", "crateswooden_f.p3d", "barrelsand_f.p3d", "garbagebags_f.p3d", "sacks_goods_f.p3d", "cratesplastic_f.p3d", "basket_f.p3d", "junkpile_f.p3d", "sack_f.p3d", "metalbarrel_empty_f.p3d", "sacks_heap_f.p3d", "barrelwater_f.p3d" ]; //Loot that can be found LARs_loot = ["FirstAidKit","30Rnd_65x39_caseless_mag","Chemlight_green","16Rnd_9x21_Mag","SmokeShell","SmokeShellGreen","Chemlight_green","HandGrenade","B_AssaultPack_blk","arifle_MX_ACO_pointer_F","hgun_P07_F"]; LARs_lootMaxFoundItems = 2; //Max number of items that could be found per search LARs_lootChanceFail = 75; //Percent chance a search finds nothing LARs_lootAnimations = [ "" ]; //ARRAY of animations to play when searching, a random one is chosen else player just crouches LARs_lootSearchTime = 3; //Overall delay between initiating search and items being displayed LARs_lootDisplayEmpty = true; //Show 'empty' action for area that have already been searched LARs_lootEmptyStrings = [ "You find nothing of interest", "Looks like someones already serached here", "Nothing but junk!" ]; //**Fine tuning** LARs_lootWHCleanUpDistance = 15; //Old loot piles are cleaned up once there is no player/switchable within this distance to the pile LARs_lootWHCleanUpDelay = 30; //Time in seconds between checks for loot pile clean ups LARs_searchDistance = 1.5; //distance you have to be from the object you are looking at to be able to search it LARs_searchRadius = 1.5; //Area around player deemed as searched LARs_searchCleanUpDelay = 300; //time in seconds, before you can re-search an area LARs_searchCleanUpDistance = 500; //distance in meters, if a searched area becomes this far from the player we can likely forget about it You now have a limit amount of tries at looting objects. Each search places an area for a configurable time and size that if you are looking at the same type of object whilst in it will disable searching. It works out rather well as the smaller the object the less tries you get, yet for the big rubbish piles if your careful with your searches you can maximise your returns :). I have not updated the objects or models and the loot list is the same old crap from before, ive left these for the end user to handle. If there are any vanilla models that you feel should be in the default list leave a post here and ill update them as and when i get to it. 2 Share this post Link to post Share on other sites
brunohxcx 21 Posted September 23, 2016 hello... is this still working? cuz i downloaded the LARs_searchLoot.Stratis sample mission, and it wont work.. Share this post Link to post Share on other sites
Larrow 2822 Posted September 24, 2016 I just tried the sample mission and its working ok for me. What is not working for you? Is it not working at all for you, as in no action when looking as objects please elaborate? Share this post Link to post Share on other sites
das attorney 858 Posted September 24, 2016 Hi Larrow, if you use 3rd person, it won't pick up any objects because it's scanning 1.5m from the camera position (which is something like 3 or 4m behind the player). If you use eyePos instead, it should work ok. (Plus also you might want to update it to lineIntersectsSurfaces) :) 1 Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted September 24, 2016 Hi Larrow, if you use 3rd person, it won't pick up any objects because it's scanning 1.5m from the camera position (which is something like 3 or 4m behind the player). If you use eyePos instead, it should work ok. (Plus also you might want to update it to lineIntersectsSurfaces) :) Those pesky 3rd person casuals don't deserve such a fine script in the first place. Cheers 2 1 Share this post Link to post Share on other sites
Larrow 2822 Posted September 24, 2016 Aye the camera position is something thats been mentioned before and is on the todo list. lineIntersectsSurfaces is a good shout. Thanks Das. Actually, done seeing as its a very quick fix. Woohooo Larrows fixed one of his many broken scripts :D Those pesky 3rd person casuals don't deserve such a fine script in the first place.hehe 1 Share this post Link to post Share on other sites
das attorney 858 Posted September 24, 2016 Larrows fixed one of his many broken scripts Makes a change from you fixing everyone else's broken scripts! :) 2 Share this post Link to post Share on other sites
brunohxcx 21 Posted October 8, 2016 I just tried the sample mission and its working ok for me. What is not working for you? Is it not working at all for you, as in no action when looking as objects please elaborate? lol sry... its working, but only on first person like das attorney said.. nice work btw ++ it is possible to separate the loot? like on tire piles i find tires or industrial itens, or at luggages i can find clothes and bags.. etc. ? a sound effect would be nice too :) Share this post Link to post Share on other sites
damsous 329 Posted September 17, 2019 On 11/26/2015 at 5:27 PM, Larrow said: A fellow forum user LaurenTyler got intouch to ask if i could add some enhancements to my script in this thread. DOWNLOAD Here are a list of the settings that can now be changed and can be found in "\LARs_searchLoot.Stratis\LARs\LARs_searchLoot\LARs_lootSettings.sqf". //Class types that can be looted LARs_lootClasses = [ "Land_GarbagePallet_F", "Land_ToiletBox_F", "Land_CratesShabby_F", "Land_CratesWooden_F", "Land_BarrelSand_F", "Land_GarbageBags_F", "Land_Sacks_goods_F", "Land_CratesPlastic_F", "Land_Basket_F", "Land_BC_Basket_F", "Land_JunkPile_F", "Land_Sack_F", "Land_MetalBarrel_empty_F", "Land_Sacks_heap_F" ]; //Model types that can be looted LARs_lootModels = [ "garbagepallet_f.p3d", "toiletbox_f.p3d", "cratesshabby_f.p3d", "crateswooden_f.p3d", "barrelsand_f.p3d", "garbagebags_f.p3d", "sacks_goods_f.p3d", "cratesplastic_f.p3d", "basket_f.p3d", "junkpile_f.p3d", "sack_f.p3d", "metalbarrel_empty_f.p3d", "sacks_heap_f.p3d", "barrelwater_f.p3d" ]; //Loot that can be found LARs_loot = ["FirstAidKit","30Rnd_65x39_caseless_mag","Chemlight_green","16Rnd_9x21_Mag","SmokeShell","SmokeShellGreen","Chemlight_green","HandGrenade","B_AssaultPack_blk","arifle_MX_ACO_pointer_F","hgun_P07_F"]; LARs_lootMaxFoundItems = 2; //Max number of items that could be found per search LARs_lootChanceFail = 75; //Percent chance a search finds nothing LARs_lootAnimations = [ "" ]; //ARRAY of animations to play when searching, a random one is chosen else player just crouches LARs_lootSearchTime = 3; //Overall delay between initiating search and items being displayed LARs_lootDisplayEmpty = true; //Show 'empty' action for area that have already been searched LARs_lootEmptyStrings = [ "You find nothing of interest", "Looks like someones already serached here", "Nothing but junk!" ]; //**Fine tuning** LARs_lootWHCleanUpDistance = 15; //Old loot piles are cleaned up once there is no player/switchable within this distance to the pile LARs_lootWHCleanUpDelay = 30; //Time in seconds between checks for loot pile clean ups LARs_searchDistance = 1.5; //distance you have to be from the object you are looking at to be able to search it LARs_searchRadius = 1.5; //Area around player deemed as searched LARs_searchCleanUpDelay = 300; //time in seconds, before you can re-search an area LARs_searchCleanUpDistance = 500; //distance in meters, if a searched area becomes this far from the player we can likely forget about it You now have a limit amount of tries at looting objects. Each search places an area for a configurable time and size that if you are looking at the same type of object whilst in it will disable searching. It works out rather well as the smaller the object the less tries you get, yet for the big rubbish piles if your careful with your searches you can maximise your returns :). I have not updated the objects or models and the loot list is the same old crap from before, ive left these for the end user to handle. If there are any vanilla models that you feel should be in the default list leave a post here and ill update them as and when i get to it. Wouah thats really an awsome script, larrow i find so much cool thing you made for Arma 3, but its always lost somewhere in a thread 😉 I got a question, the script work fine, but its possible to remove the tiny red arrow that moving in the middle of the screen ? Share this post Link to post Share on other sites
Larrow 2822 Posted September 17, 2019 4 hours ago, damsous said: I got a question, the script work fine, but its possible to remove the tiny red arrow that moving in the middle of the screen ? Open the seting file. \LARs\LARs_searchLoot\LARs_lootSettings.sqf and at the bottom set LARs_searchDebug to false. Share this post Link to post Share on other sites