LordRampantHump

Loot Search Exile

102 posts in this topic

@Diddl3s

 

I installed a clean copy of exile  and I have this working right out of the box. The ONLY exception is that i am now using it on Tanoa and had to add the textures of the Garbage Piles/Trees I wanted to search.

I have uploaded the mission HERE

In this mission i set the player pos to an area of GeorgeTown, there you will see a Garbage Container.

The Garbage Container is not lootable but the pile of trash right beside it is.

 

This is because I added the modal of the Trash Pile (garbageheap_02_f.p3d) to the Config (LARs_lootSettings.sqf) but NOT the Garbage container

 

How do I find the modal of the map object?

I cheat! I use infistar and when looking at the item in game i press Delete, this asks me if im sure i want to delete garbageheap_02_f.p3d

Bingo!

 

If you need any more info, let me know

Edited by LordRampantHump
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement
8 minutes ago, Razor77 said:

Thank you will give this a go now, cheers

Remember, this is not a finished script, but should be working enough for anyone to tweek it to their desire. Now that I have set it up solo on a test server i will look at it over the weekend

  • Like 1

Share this post


Link to post
Share on other sites

Sorry to chime in so late, after being the one to ask @LordRampantHump to share the code he mentioned. I did get the code he shared to work. I followed his instructions, with the exception of adding the following code to the description.ext.

class CfgFunctions
{
	#include "LARs\LARs_searchLoot\functions.cpp"
};

With that being said, I only ever plan to use this code to search apples trees. So, I started thinning out and tweaking the code to suit my specific needs. I can't help but think, after looking at the code, that there has to be a way to greatly simplify the code.

I could be way off on how I am trying to simplify the script and how and I am calling to it. I've broken the "Apple Picking" scripting into two files, as shown below. and am calling to it from the initplayerlocal.sqf with:

[] execVM "addons\ApplePicker\fn_applepicker.sqf";

fn_applepicker.sqf

Spoiler

/**
 * Exile Apple Picking Script
 * fn_applepicker.sqf
 *
 * For use with LordRampantHump's "Items Pack for Arma 3"
 * http://steamcommunity.com/sharedfiles/filedetails/?id=1082756693
 * 
 * Based on Larrow's Epoch looting script
 * https://forums.bistudio.com/forums/topic/184456-looting-trash-piles-bins/?do=findComment&comment=2942397
 */

if ( !hasInterface ) exitWith {};
waitUntil {!isNull player};
waitUntil {!isNull findDisplay 46};
uiSleep 10;    

Apples = [ "items_pack_apple_red", "items_pack_apple" ];
AppleTrees = [ "t_malus1s.p3d" ];

player setVariable ["canloot",true];

player addAction ["Search For Apples", "addons\ApplePicker\Search_For_Apples_Action.sqf", [], 0, false, true, "", "cursorObject in AppleTrees", 5];
 

Search_For_Apples_Action.sqf

Spoiler

/**
 * Exile Apple Picking Script
 * Search_For_Apples_Action.sqf
 *
 * For use with LordRampantHump's "Items Pack for Arma 3"
 * http://steamcommunity.com/sharedfiles/filedetails/?id=1082756693
 * 
 * Based on Larrow's Epoch looting script
 * https://forums.bistudio.com/forums/topic/184456-looting-trash-piles-bins/?do=findComment&comment=2942397
 */

if !(player getVariable "canloot") exitWith {["ErrorTitleOnly", ["You can't pick apples right now!"]] call ExileClient_gui_toaster_addTemplateToast;};
if !(alive player) exitWith {};
player setVariable [ "canloot",false];
player playMove "AinvPknlMstpSlayWrflDnon_medic";
waitUntil {animationState player != "AinvPknlMstpSlayWrflDnon_medic" || !alive player};
if (random 100 > 25) then {
    ["SuccessTitleOnly", ["You found something to eat!"]] call ExileClient_gui_toaster_addTemplateToast;
    for "_i" from 0 to floor( random 5 ) do {
        _item = Apples call BIS_fnc_selectRandom;
        player addMagazine [ _item, 1 ];
    };
    player setVariable ["canloot",true];
}
else
{
    ["ErrorTitleOnly", ["You had trouble reaching them apples! Try again!"]] call ExileClient_gui_toaster_addTemplateToast;
    player setVariable ["canloot",true];
};

I've not been able to get the action to show up when looking at the apple tree, using the code above. I'm hoping someone can't point to what I'm doing incorrectly and/or whether this will work at all.

Share this post


Link to post
Share on other sites
2 hours ago, Kurewe said:

I've not been able to get the action to show up when looking at the apple tree, using the code above. I'm hoping someone can't point to what I'm doing incorrectly and/or whether this will work at all.

hey man... try this:

player addAction ["Search For Apples", "addons\ApplePicker\Search_For_Apples_Action.sqf", [], 0, false, true, "", "getModelInfo cursorObject select 0 in AppleTrees", 5];

 as far a s I know "getModelInfo" &  "cursorObject" are new(ish) functions in the Arma engine

the original LarsLoot script is from long before we were able to use these functions.

Your improvements look great and I will certainly be advising any of my mod users to get on it!

You will have a few things to overcome such as removing the action and stopping abuse

Edited by LordRampantHump

Share this post


Link to post
Share on other sites
19 minutes ago, LordRampantHump said:

hey man... try this:


player addAction ["Search For Apples", "addons\ApplePicker\Search_For_Apples_Action.sqf", [], 0, false, true, "", "getModelInfo cursorObject select 0 in AppleTrees", 5];

 as far a s I know "getModelInfo" &  "cursorObject" are new(ish) functions in the Arma engine

the original LarsLoot script is from long before we were able to use these functions.

Your improvements look great and I will certainly be advising any of my mod users to get on it!

You will have a few things to overcome such as removing the action and stopping abuse

I will definitely give that a try in just a minute. I just tried what I showed above, without the "condition" in the action and it definitely works to pick apples. However, as you can imagine, you always have the action available. So, the condition is most definitely the part that is causing me the problems. I'll post again in a few minutes to let you know what happened.

Share this post


Link to post
Share on other sites

@LordRampantHump

That worked perfectly! I'm adjusting a couple things with the code.

1. In it's current state, it notifies whether you did or did not find apples before you've finished the animation (ALREADY FIXED)

2. When your inventory is full, it does not drop the extra apples on the ground. I've already got the code in mind and am working on it.

As soon as I have that piece of code done and I'm satisfied that there's nothing else that needs immediate attention, I will post exactly what I have.

  • Like 2

Share this post


Link to post
Share on other sites
9 minutes ago, Kurewe said:

@LordRampantHump

That worked perfectly! I'm adjusting a couple things with the code.

1. In it's current state, it notifies whether you did or did not find apples before you've finished the animation (ALREADY FIXED)

2. When your inventory is full, it does not drop the extra apples on the ground. I've already got the code in mind and am working on it.

As soon as I have that piece of code done and I'm satisfied that there's nothing else that needs immediate attention, I will post exactly what I have.

Good job man... may also want to check things like  distance from tree, death and respawn.

Look forward to your results!

Share this post


Link to post
Share on other sites

@LordRampantHump 

Ok, I tested it and everything seems to be working properly, even after committing suicide and respawning.
- You have the ability to change the failure rate of the search. (Noted in the Search_For_Apples.sqf")
- You have the ability to change the maximum number of apples found during the search. (Noted in the Search_For_Apples.sqf")
- You can change which apples you want to find (Noted in the Search_For_Apples.sqf")
- Found apples will be automatically put into any available inventory space. If the is no space in your inventory, they will be placed on the ground.
- While this is specifically for picking apples, you should be able to easily modify this for your specific needs. For example, if you're running Tanoa, you can adjust the code for finding bananas instead of apples.

Here is what I've put together. It's requires an override.

1st: Add the following code to the "CfgExileCustomCode" section of your mission config.cpp.

	//Apple Picking
	ExileClient_object_player_initialize = "overrides\ExileClient_object_player_initialize.sqf";

2nd: Copy the text from the spoiler below, paste it to your text editor and save it to your overrides folder as ExileClient_object_player_initialize.sqf

Spoiler

/**
 * ExileClient_object_player_initialize
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_newPlayerObject", "_oldPlayerObject"];
_newPlayerObject = _this;
_oldPlayerObject = player;
player reveal [_newPlayerObject, 4];
selectPlayer _newPlayerObject;
if (_oldPlayerObject isKindOf "Exile_Unit_GhostPlayer") then 
{
    deleteVehicle _oldPlayerObject;
};
player setVariable ["ExileXM8IsOnline", (profileNamespace getVariable ["ExileEnable8GNetwork", false]), true];

// Apple Picking Start
AppleTrees = [ "t_malus1s.p3d" ];
player setVariable ["canloot",true];
player addAction ["Search For Apples", "custom\ApplePicker\Search_For_Apples.sqf", [], 0, false, true, "", "getModelInfo cursorObject select 0 in AppleTrees", 2];
// Apple Picking End

enableSentences false;
enableRadio false;
player setVariable ["BIS_noCoreConversations", true];
player disableConversation true;
player setSpeaker "NoVoice";
showSubtitles false;
[] call ExileClient_object_player_event_hook;
ExileGasMaskNextSoundAt = diag_tickTime;
if (ExileClientGasMaskVisible) then 
{
    false call ExileClient_gui_gasMask_toggle;
};
[] call ExileClient_object_player_stats_reset;
[] call ExileClient_gui_postProcessing_reset;
[] call ExileClient_system_breathing_event_onPlayerSpawned;
[] call ExileClient_system_snow_event_onPlayerSpawned;
[] call ExileClient_system_radiation_event_onPlayerSpawned;
ExileClientIsWaitingForInventoryMoneyTransaction = false;
true

3rd: In the root of your mission folder, create a folder named "custom" (if it doesn't already exist). Then, create a folder named "ApplePicker" inside the "custom" folder.

4th: Copy the text from the spoiler below. Paste it into your text editor and then save the file to the "ApplePicker" folder as "Search_For_Apples.sqf"

Spoiler

/**
 * Exile Apple Picking Script
 * Search_For_Apples.sqf
 *
 * By Kurewe
 * CantankerousOldGoats.com
 *
 * For use with LordRampantHump's "Items Pack for Arma 3"
 * http://steamcommunity.com/sharedfiles/filedetails/?id=1082756693
 * 
 * Based on Larrow's Epoch looting script
 * https://forums.bistudio.com/forums/topic/184456-looting-trash-piles-bins/?do=findComment&comment=2942397
 */

private["_canAdd"];

// *** CHANGE WHICH APPLE(S) YOU WANT TO FIND BY CHANGING THE ARRAY TO ONE APPLE OR THE OTHER APPLE OR BOTH APPLES ***
Apples = [ "items_pack_apple_red", "items_pack_apple" ];

if !(player getVariable "canloot") exitWith {["ErrorTitleOnly", ["You can't pick apples right now!"]] call ExileClient_gui_toaster_addTemplateToast;};
if !(alive player) exitWith {};
player setVariable [ "canloot",false];
player playMove "AinvPknlMstpSlayWrflDnon_medic";
uiSleep 6;
// *** CHANGE (RANDOM 100 > 25) TO WHATEVER FAILURE RATE YOU WOULD LIKE ***
// *** I.E. (RANDOM 100 > 50) FOR A 50% FAILURE RATE FOR EACH SEARCH ***
if (random 100 > 25) then {
    _wh = createVehicle ["GroundWeaponHolder", getPosATL player, [], 0, "CAN_COLLIDE"];
    ["SuccessTitleOnly", ["You found something to eat!"]] call ExileClient_gui_toaster_addTemplateToast;
    // *** CHANGE ( RANDOM 5 ) TO HOWEVER MANY POSSIBLE APPLES YOU WANT PLAYER TO FIND ***
    // *** I.E. ( RANDOM 2 ) FOR FINDING A MAX OF 2 APPLES FROM EACH SEARCH ***
    for "_i" from 0 to floor( random 5 ) do { 
        _item = Apples call BIS_fnc_selectRandom;
        _canAdd = [player, _item] call ExileClient_util_playerCargo_canAdd;
        if (_canAdd) then {
            player addMagazine [ _item, 1 ];
        }
        else
        {
            _wh addItemCargoGlobal [ _item, 1];
        };
    };
    player setVariable ["canloot",true];
}
else
{
    ["ErrorTitleOnly", ["You had trouble reaching them apples! Try again!"]] call ExileClient_gui_toaster_addTemplateToast;
    player setVariable ["canloot",true];
};

 

  • Like 3

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.