Jump to content

[Release] Use a Trader to get a mission


juandayz

Recommended Posts

U can pick any trader and add option to get a mission.

*Mission spawn 4 diferents random crates whit 4 diferents random locations for each crate. once per time.

*Mission have a item requiere to start

*Mission have a 20 min after same player call it again.

*Players needs to find the crate in 15 min or this crate will be deleted.

INSTALL:

1-copy  any kind of trader ID from your server_trader.sqf or server_traders_cherno_11.sqf for coins system. for example : Dr_Annie_Baker_EP1

2-open your custom fn_selfaction.sqf and add this add very bottom:

Spoiler

////////////QUEST//
private["_playerPos","_nearquest"];

_playerPos = getPosATL player;
_nearquest = count nearestObjects [_playerPos, [YOUR TRADER ID//FOR THIS EXAMPLE//" Dr_Annie_Baker_EP1 "], 3] > 0;
 
if (_nearquest) then {
        if (s_player_quest < 0) then {
            s_player_quest = player addaction[("<t color=""#3399cc"">" + ("ASK FOR MISSIONS") +"</t>"),"custom\quest\quest.sqf"];
        };
    } else {
        player removeAction s_player_quest;
        s_player_quest = -1;
    };
////////////////end of quest///

3-Create a new sqf file save as "quest.sqf " into  custom\quest\      folder    and paste this inside:

Spoiler

private ["_playerPos","_neartalker","_hasitem","_random","_LastUsedTime","_Time"];

call gear_ui_init;
_playerPos = getPosATL player;
_neartalker = count nearestObjects [_playerPos, [YOUR TRADER ID//FOR THIS EXAMPLE//" Dr_Annie_Baker_EP1"], 3] > 0;
_random = round(random(4));
_hasitem = "FoodchickenCooked" in magazines player;    
_LastUsedTime = 1200;                                                                  
_Time = time - lastuse;

if (!_hasitem) exitWith {cutText [format["I like chickens giveme a FoodchickenCooked and we can talk"], "PLAIN DOWN"];};
sleep 5;

if(_Time < _LastUsedTime) exitWith {
    cutText [format["You already have a mission whait anothers %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};

if (_neartalker && _hasitem) then {
    lastuse = time;
    player removeMagazine "FoodchickenCooked";   //changeme if you put another  _hasitem
    
    switch (_random) do {    
        case 0 :{

            
            titleText ["Coords //16 up 79 left// have 15 minutes ", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 5;
            _positionArray=[[1677.587, 7417.2876],[1682.7095, 7416.1377],[1638.1494, 7402.5869, 0],[1614.4928, 7447.8296, -0.032172654],[1688.9667, 7443.4146, 0],[1672.4465, 7364.9146, -9.1552734e-005]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
    
               
                _crate1 = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicWeapons_EP1", _position, [], 0, "CAN_COLLIDE"];
                _crate1 = _this;
                 clearWeaponCargoGlobal _crate1;
                 clearMagazineCargoGlobal _crate1;  
                _crate1 addWeaponCargoGlobal ["ItemToolbox", 2];
                _crate1 addWeaponCargoGlobal ["ItemSledge", 1];
                _crate1 addWeaponCargoGlobal ["ItemShovel", 1];    
                _crate1 addWeaponCargoGlobal ["M24_des_EP1", 2];
                _crate1 addWeaponCargoGlobal ["SCAR_H_LNG_Sniper", 1];
                _crate1 addmagazinecargoglobal ["bulk_ItemWire",2];
                _crate1 addmagazinecargoglobal ["ItemAntibiotic",2];
                _crate1 addmagazinecargoglobal ["ItemBriefcase100oz",1];
                _crate1 addmagazinecargoglobal ["forest_large_net_kit",2];
                _crate1 addmagazinecargoglobal ["bulk_ItemSandbag",2];
                _crate1 addmagazinecargoglobal ["CinderBlocks",10];
                _crate1 addmagazinecargoglobal ["Skin_GUE_Commander_DZ",1];
                _crate1 addmagazinecargoglobal ["20Rnd_762x51_B_SCAR",3];
                _crate1 addmagazinecargoglobal ["20Rnd_762x51_DMR",3];
                                
            };
             sleep 900;
                deleteVehicle _crate1;  
        };
        case 1 :{
            titleText ["Coords //79 up - 77 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 5;
            _positionArray=[[7990.2954, 7658.2842, -6.1035156e-005],[7946.6958, 7657.1748, -0.00015258789],[7904.582, 7580.2603, -0.00039672852],[7995.6387, 7562.2183, -9.1552734e-005]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
    
               
                _crate2 = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicWeapons_EP1", _position, [], 0, "CAN_COLLIDE"];
                _crate2 = _this;
                 clearWeaponCargoGlobal _crate2;
                 clearMagazineCargoGlobal _crate2;  
                _crate2 addWeaponCargoGlobal ["Binocular_Vector", 2];
                _crate2 addWeaponCargoGlobal ["ItemEtool", 1];
                _crate2 addWeaponCargoGlobal ["SVD_des_EP1", 1];    
                _crate2 addWeaponCargoGlobal ["M14_EP1", 2];
                _crate2 addWeaponCargoGlobal ["SCAR_H_LNG_Sniper", 1];
                _crate2 addmagazinecargoglobal ["50Rnd_127x107_DSHKM",1];
                _crate2 addmagazinecargoglobal ["100Rnd_762x51_M240",1];
                _crate2 addmagazinecargoglobal ["ItemBriefcase100oz",1];
                _crate2 addmagazinecargoglobal ["forest_large_net_kit",2];
                _crate2 addmagazinecargoglobal ["bulk_ItemSandbag",2];
                _crate2 addmagazinecargoglobal ["Skin_TK_INS_Warlord_EP1_DZ",1];
                _crate2 addmagazinecargoglobal ["10Rnd_762x54_SVD",3];
                _crate2 addmagazinecargoglobal ["20Rnd_762x51_B_SCAR",3];
                _crate2 addmagazinecargoglobal ["20Rnd_762x51_DMR",3];
                                
            };
             sleep 900;
                deleteVehicle _crate2;
        };
        case 2 :{
            titleText ["Coords //86 up - 114 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 5;
            _positionArray=[[8693.7461, 3957.5413, 3.0517578e-005],[8603.2891, 3869.7571, -0.00012207031],[8643.4014, 3915.6455, -3.0517578e-005],[8667.9189, 3862.4624, -0.00012207031]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
    
               
                _crate3 = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicWeapons_EP1", _position, [], 0, "CAN_COLLIDE"];
                _crate3 = _this;
                 clearWeaponCargoGlobal _crate3;
                 clearMagazineCargoGlobal _crate3;  
                _crate3 addWeaponCargoGlobal ["ItemFishingPole", 2];
                _crate3 addWeaponCargoGlobal ["ItemSledge", 1];
                _crate3 addWeaponCargoGlobal ["ItemShovel", 1];    
                _crate3 addWeaponCargoGlobal ["ItemEtool", 2];
                _crate3 addWeaponCargoGlobal ["Mk_48_DZ", 1];
                _crate3 addmagazinecargoglobal ["ItemEmerald",1];
                _crate3 addmagazinecargoglobal ["ItemCanvas",4];
                _crate3 addmagazinecargoglobal ["ItemVault",1];
                _crate3 addmagazinecargoglobal ["forest_large_net_kit",2];
                _crate3 addmagazinecargoglobal ["ItemLockbox",1];
                _crate3 addmagazinecargoglobal ["ItemTankTrap",5];
                _crate3 addmagazinecargoglobal ["Skin_GUE_Commander_DZ",1];
                _crate3 addmagazinecargoglobal ["FoodbaconCooked",3];
                _crate3 addmagazinecargoglobal ["100Rnd_762x51_M240",3];
                                
            };
             sleep 900;
                deleteVehicle _crate3;
        };
        case 3 :{
            titleText ["Coords //105 up - 06 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 5;
            _positionArray=[[10536.205, 14738.917, -0.00012207031],[10503.95, 14728.156, 3.0517578e-005],[10597.102, 14675.437, -0.00031280518],[10594.756, 14750.181, -0.0005569458]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
    
               
                _crate4 = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicWeapons_EP1", _position, [], 0, "CAN_COLLIDE"];
                _crate4 = _this;
                 clearWeaponCargoGlobal _crate4;
                 clearMagazineCargoGlobal _crate4;  
                _crate4 addWeaponCargoGlobal ["ItemToolbox", 2];
                _crate4 addWeaponCargoGlobal ["ItemSledge", 1];
                _crate4 addWeaponCargoGlobal ["ItemShovel", 1];    
                _crate4 addWeaponCargoGlobal ["M24_des_EP1", 2];
                _crate4 addWeaponCargoGlobal ["SCAR_H_LNG_Sniper", 1];
                _crate4 addmagazinecargoglobal ["100Rnd_127x99_M2",1];
                _crate4 addmagazinecargoglobal ["ItemSodaOrangeSherbet",5];
                _crate4 addmagazinecargoglobal ["ItemComboLock",1];
                _crate4 addmagazinecargoglobal ["ItemSandbagExLarge5X",5];
                _crate4 addmagazinecargoglobal ["ItemBloodbag",5];
                _crate4 addmagazinecargoglobal ["100Rnd_762x54_PK",4];
                _crate4 addmagazinecargoglobal ["Skin_GUE_Commander_DZ",1];
                _crate4 addmagazinecargoglobal ["20Rnd_762x51_B_SCAR",3];
                _crate4 addmagazinecargoglobal ["20Rnd_762x51_DMR",3];
                                
            };
             sleep 900;
                deleteVehicle _crate4;
        };        
    };
};

 

*Now launch your server, go infront of Dr_Annie_Baker_EP1 for this example , use scroll menu and pick "ASK FOR MISSIONS".   done.

 

Configs in quest.sqf :

Spoiler

--------------------------------------------------------------------------------------------------------------------------------------------

Change time before another mission can be launched:   _LastUsedTime = 1200;     (in seconds)

--------------------------------------------------------------------------------------------------------------------------------------------

Change requiere items:  _hasitem = "FoodchickenCooked" in magazines player;

                                                player removeMagazine "FoodchickenCooked";

--------------------------------------------------------------------------------------------------------------------------------------------

Change time before mission must be deleted: sleep 900;   (change for each crate case)

--------------------------------------------------------------------------------------------------------------------------------------------

 

Link to comment
Share on other sites

Heres another way to call the carepackage of "matt L"

also u can use to call this traders missions if u want.

**Allow players to repair the radio of HMMWVWrecks  and call a supply air drop.

in bottom of fn_selfactions.sqf

Spoiler

////////////supply radio//
private["_playerPos","_nearwreck"];

_playerPos = getPosATL player;
_nearwreck = count nearestObjects [_playerPos, ["HMMWVWreck"], 3] > 0;
 
if (_nearwreck) then {
        if (s_player_rad < 0) then {
            s_player_rad = player addaction[("<t color=""#3399cc"">" + ("REPAIR RADIO") +"</t>"),"custom\radio\suplyradio.sqf"];
        };
    } else {
        player removeAction s_player_rad;
        s_player_rad = -1;
    };
////////////////

into your custom\radio\   folder  create a new sqf, call it  suplyradio.sqf and paste inside:

Spoiler

 // Carepackage script by Matt L
//Special thanks to Infinistar for helping with mag selection for the weapons

private ["_cost","_hasBriefs","_display","_distance","_boxtype","_unit","_getPos","_position","_box","_chute","_smoke","_var","_textt","_tools","_items","_weapon","_weapon2","_weapon3","_weapon4","_weapon5","_weapon6","_giveWep","_possibleMags","_mag","_whichBuild","_crateItems","_text"];

_cost = 1;
_hasBriefs = {"ItemTinBar" == _x} count (magazines player);
_LastUsedTime = 3600;


_Time = time - lastpack;


if(_Time < _LastUsedTime) exitWith { // If cooldown is not done then exit script
    cutText [format["Already call a air supply crate whait anothers %1 seconds before to try again !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"]; //display text at bottom center of screen when players cooldown is not done
};


if (_hasBriefs >= _cost) then {

for "_i" from 0 to _cost - 1 do {
player removeMagazine "ItemTinBar";
};

disableSerialization;
_display = findDisplay 24;
(_display) closeDisplay 0;

_distance = 500;
_boxtype = "USVehicleBox_EP1";
_unit = player;
_getPos = getPos _unit;
_position = [_getPos select 0, _getPos select 1, 25];
_box = _boxtype createVehicle _position;
_box setVariable ["Mission",1,true];
_box setVariable ["permaLoot",1,true];
_box setVariable ["ObjectID",""];
_chute = createVehicle ["ParachuteMediumEast", getPos _box, [], 0, "FLY"];
_box attachTo [_chute, [0,0,3]];
_smoke = "SmokeShellBlue" createVehicle (getPos _box);
_smoke attachTo [_box, [0,0,0]];
_var = floor((random 2) + 1);

lastpack = time;

//display text to alert user
_textt = format ["\nLook at the sky!!!!!!",10];
titleText [_textt,"PLAIN DOWN"];

//define items

_tools = ["ItemEtool","ItemKnife","ItemFishingPole","ItemHatchet_DZE","ItemMatchbox_DZE","ItemCrowbar"];
_items = ["ItemSodaPepsi","ItemMorphine","FoodNutmix","ItemBloodbag","FoodCanSardines","ItemKiloHemp"];


//weapon lists
_weapon = "DMR";
_weapon2 = "AK_47_M";
_weapon3 = "BAF_L85A2_RIS_Holo";
_weapon4 = "RPK_74";
_weapon5 = "M14_EP1";
_weapon6 = "M249_DZ";
_giveWep = [_weapon,_weapon2,_weapon3,_weapon4,_weapon5,_weapon6] call BIS_fnc_selectRandom;
_possibleMags = getArray (configfile >> "cfgWeapons" >> _giveWep >> "magazines");
_mag = _possibleMags select 0;

//select arrays to use
_crateItems = [_items] call BIS_fnc_selectRandom;
uisleep 1;

clearweaponcargoglobal _box;
clearmagazinecargoglobal _box;

uisleep 1;

{_box addMagazineCargoGlobal [_x, _var];} forEach _crateItems;
{_box addWeaponCargoGlobal [_x, 1];} forEach _tools;
_box addMagazineCargoGlobal [_mag, _var];
_box addWeaponCargoGlobal [_giveWep, 1];

uisleep 1;

waitUntil {(player distance _box) > _distance};
deleteVehicle _box;
deleteVehicle _chute;

} else {
_text = format ["\nNeeds 1x ItemTinBar to repair the military radio!",10];
titleText [_text,"PLAIN DOWN"];
};

 

Link to comment
Share on other sites

  • 3 weeks later...

using the same HMMVWreck .. this allow players to search items in the hummvie wreck trunk.

*Create a sqf called "wreck.sqf" and drop it into Mpmissions\yourinstance\custom\script\

wreck.sqf

Spoiler

private ["_playerPos","_nearcar","_inventory","_random","_LastUsedTime","_Time","_hascrowbar"];

call gear_ui_init;
_playerPos = getPosATL player;
_nearcar = count nearestObjects [_playerPos, ["HMMWVWreck"], 3] > 0;
_random = round(random(4));
_LastUsedTime = 180;
_Time = time - lastuse;
_inventory = items player;
_hascrowbar = "ItemCrowbar" in _inventory;


if(_Time < _LastUsedTime) exitWith {
    cutText [format["whait anothers %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};

if !(_hascrowbar) exitWith {
cutText [format["You needs a Crowbar in inventory to open this vehicle."], "PLAIN DOWN"];
};

if (_nearcar && _hascrowbar) then {
    lastuse = time;

    switch (_random) do {    
        case 0 :{

            
            titleText ["a crate!!!!", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            
               
                _cratea = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicAmmunitionBox", _position, [], 0, "CAN_COLLIDE"];
                _cratea = _this;
                 clearWeaponCargoGlobal _cratea;
                 clearMagazineCargoGlobal _cratea;  
                _cratea addWeaponCargoGlobal ["ItemToolbox",2];
                _cratea addWeaponCargoGlobal ["ItemShovel"];
                _cratea addWeaponCargoGlobal ["ItemRadio"];
                _cratea addWeaponCargoGlobal ["M24_des_EP1"];
                _cratea addWeaponCargoGlobal ["AKS_74_kobra"];
                _cratea addWeaponCargoGlobal ["AK_74"];
                _cratea addmagazinecargoglobal ["15Rnd_9x19_M9SD",2];
                _cratea addmagazinecargoglobal ["30Rnd_9x19_MP5SD",2];
                _cratea addmagazinecargoglobal ["ItemSodaOrangeSherbet"];
                                
            };
             sleep 120;
                deleteVehicle _cratea;  
        };
        case 1 :{
        titleText ["i found a crate", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            _crateb = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _crateb = _this;
                 clearWeaponCargoGlobal _crateb;
                 clearMagazineCargoGlobal _crateb;  
                _crateb addWeaponCargoGlobal ["AK_74",2];
                _crateb addWeaponCargoGlobal ["G36A_camo",1];
                _crateb addWeaponCargoGlobal ["ItemRadio"];
                _crateb addWeaponCargoGlobal ["M9SD"];
                _crateb addWeaponCargoGlobal ["AKS_74_kobra"];
                _crateb addWeaponCargoGlobal ["MP5SD"];
                _crateb addmagazinecargoglobal ["30Rnd_9x19_MP5SD",2];
                _crateb addmagazinecargoglobal ["30Rnd_556x45_StanagSD"];
                _crateb addmagazinecargoglobal ["30Rnd_545x39_AK"];
                _crateb addmagazinecargoglobal ["ItemOilBarrel"];            
            };
             sleep 120;
                deleteVehicle _crateb;
        };
        case 2 :{
        titleText ["thers a crate in here", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            _cratec = objNull;
                if (true) then
                {
                _this = createVehicle ["LocalBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _cratec = _this;
                 clearWeaponCargoGlobal _cratec;
                 clearMagazineCargoGlobal _cratec;  
                _cratec addWeaponCargoGlobal ["AK_74",2];
                _cratec addmagazinecargoglobal ["ItemBloodbag",2];
                _cratec addmagazinecargoglobal ["FoodSteakRaw"];
                _cratec addmagazinecargoglobal ["30Rnd_545x39_AK"];
                _cratec addmagazinecargoglobal ["HandGrenade_west",5];            
            };
             sleep 120;
                deleteVehicle _cratec;
        };
        case 3 :{
        titleText ["thers a crate into the humvie wreck", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
             _crated = objNull;
                if (true) then
                {
                _this = createVehicle ["LocalBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _crated = _this;
                 clearWeaponCargoGlobal _crated;
                 clearMagazineCargoGlobal _crated;  
                _crated addmagazinecargoglobal ["ItemSandbag",2];
                _crated addmagazinecargoglobal ["ItemTentOld",2];
                _crated addmagazinecargoglobal ["PartWheel"];
                _crated addmagazinecargoglobal ["ItemMorphine"];
                _crated addmagazinecargoglobal ["ItemCanvas",2];                           
            };
             sleep 120;
                deleteVehicle _crated;
        };        
    };
};

at bottom of fn_selfaction.sqf

Spoiler

////////////buscar wreck//
private["_playerPos","_nearcar"];


_playerPos = getPosATL player;
_nearcar = count nearestObjects [_playerPos, ["HMMWVWreck"], 3] > 0;
 
if (_nearwreck) then {
        if (s_player_wreck < 0) then {
            s_player_wreck = player addaction[("<t color=""#3399cc"">" + ("OPEN TRUNK") +"</t>"),"custom\script\wreck.sqf"];
        };
    } else {
        player removeAction s_player_wreck;
        s_player_wreck = -1;
    };
////////////////

 

Link to comment
Share on other sites

  • 4 months later...
2 hours ago, Shak said:

Great idea Juan.

The only issue I have with the script is that it takes a while to remove the item from a player's gear, IE you can get 2 missions for just one item.

Any way to make it take the required item faster to eliminate that issue?

mmm really?

cuz remove item happend very early see:

if (_neartalker && _hasitem) then {
    lastuse = time;
    player removeMagazine "FoodchickenCooked";

 

and also script have a restrict time to use again

if(_Time < _LastUsedTime) exitWith {

 

 

i just can say you... remove sleep 5; from here  (i dnt know why i put it XD)

if (!_hasitem) exitWith {cutText [format["I like chickens giveme a FoodchickenCooked and we can talk"], "PLAIN DOWN"];};
sleep 5; //remove me

 

hope its works

 

Link to comment
Share on other sites

@Shak

Spoiler

private ["_hasitem","_LastUsedTime","_Time","_loot_lists","_randomNumbers","_deltime","_box","_loot_box"];



_hasitem = "FoodchickenCooked" in magazines player;    
_LastUsedTime = 1200;                                                                  
_Time = time - lastuse;
_deltime = 900;
_loot_box = "USVehicleBox";    

 

 

 

 


if (!_hasitem) exitWith {cutText [format["I like chickens giveme a FoodchickenCooked and we can talk"], "PLAIN DOWN"];};

if(_Time < _LastUsedTime) exitWith {
    cutText [format["You already have a mission whait anothers %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};

 

 

 

 

 

//proceed

if (_hasitem) then {
    lastuse = time;
    player removeMagazine "FoodchickenCooked";   //changeme if you put another  _hasitem
    
_randomNumbers = floor(random 100);

if (_randomNumbers <= 30) then {
 titleText ["Coords //16 up 79 left// have 15 minutes ", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 2;
            _positionArray=[[1677.587, 7417.2876],[1682.7095, 7416.1377],[1638.1494, 7402.5869, 0],[1614.4928, 7447.8296, -0.032172654],[1688.9667, 7443.4146, 0],[1672.4465, 7364.9146, -9.1552734e-005]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;

_box = createVehicle [_loot_box,_position,[], 0, "NONE"];
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
_box setVariable ["permaLoot",true];
    // Add loot
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);        

sleep _deltime;
deleteVehicle _box;      

};

if (_randomNumbers <= 60 && _randomNumbers > 31) then {
titleText ["Coords //79 up - 77 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 2;
            _positionArray=[[7990.2954, 7658.2842, -6.1035156e-005],[7946.6958, 7657.1748, -0.00015258789],[7904.582, 7580.2603, -0.00039672852],[7995.6387, 7562.2183, -9.1552734e-005]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
    
_box = createVehicle [_loot_box,_position,[], 0, "NONE"];
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
_box setVariable ["permaLoot",true];
    // Add loot
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);        

sleep _deltime;
deleteVehicle _box;              
};    

if (_randomNumbers <= 80 && _randomNumbers > 61) then {
 titleText ["Coords //86 up - 114 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 2;
            _positionArray=[[8693.7461, 3957.5413, 3.0517578e-005],[8603.2891, 3869.7571, -0.00012207031],[8643.4014, 3915.6455, -3.0517578e-005],[8667.9189, 3862.4624, -0.00012207031]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
_box = createVehicle [_loot_box,_position,[], 0, "NONE"];
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
_box setVariable ["permaLoot",true];
    // Add loot
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);        

sleep _deltime;
deleteVehicle _box;  
};    

if (_randomNumbers <= 100 && _randomNumbers > 81) then {
 titleText ["Coords //86 up - 114 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 2;
            _positionArray=[[8693.7461, 3957.5413, 3.0517578e-005],[8603.2891, 3869.7571, -0.00012207031],[8643.4014, 3915.6455, -3.0517578e-005],[8667.9189, 3862.4624, -0.00012207031]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
_box = createVehicle [_loot_box,_position,[], 0, "NONE"];
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
_box setVariable ["permaLoot",true];
    // Add loot
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);        

sleep _deltime;
deleteVehicle _box;  
};

};   

 

Link to comment
Share on other sites

5 hours ago, Shak said:

@juandayz, is there some code missing from that? The loot lists?

under _loot_box  variable  put:

Spoiler

_loot_lists = [
[
["M9SD","FN_FAL","M4A3_CCO_EP1","AKS_74_kobra","Sa58V_RCO_EP1","ItemEtool","ItemCrowbar","ItemKnife","ItemSledge","ItemCompass","Binocular","Binocular_Vector","NVGoggles","ItemGPS"],
["ItemBriefcase100oz","150Rnd_127x107_DSHKM","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","30Rnd_762x39_SA58","30Rnd_762x39_SA58","30Rnd_762x39_SA58","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]
],
[
["M4A1_HWS_GL_SD_Camo","M16A2GL","M16A4","M16A4_GL","M16A4_ACG_GL","M16A4_ACG","M4A1","M4A1_HWS_GL","M4A1_HWS_GL_camo","M4A1_HWS_GL_SD_Camo","M4A1_RCO_GL","M4A1_Aim","M4A1_Aim_camo","M4A1_AIM_SD_camo"],
["ItemBriefcase100oz","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor"]
],
[
["ItemToolbox","M4A1_HWS_GL_SD_Camo","M16A2GL","M16A4","M16A4_GL","M16A4_ACG_GL","M16A4_ACG","M4A1","M4A1_HWS_GL","M4A1_HWS_GL_camo","M4A1_HWS_GL_SD_Camo","M4A1_RCO_GL","M4A1_Aim","M4A1_Aim_camo","M4A1_AIM_SD_camo"],
["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor"]
],
[
["ChainSaw"],
["ItemBriefcase100oz","ItemBriefcase100oz","ItemCorrugated","ItemCorrugated","ItemCorrugated","ItemCorrugated","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemComboLock","ItemGenerator"]
],
[
["m240_scoped_EP1_DZE","Mk_48_DZ","M240_DZ","RPK_74"],
["ItemBriefcase100oz","100Rnd_762x51_M240","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_556x45_BetaCMag","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_556x45_BetaCMag","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_556x45_BetaCMag","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_556x45_BetaCMag","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_762x51_M240","100Rnd_762x51_M240","200Rnd_556x45_M249","2000Rnd_762x51_M134","2000Rnd_762x51_M134","ItemAVE","ItemLRK","ItemTNK","ItemARM","ItemORP","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked"]
],
[
["M4A1_HWS_GL_SD_Camo","M16A2GL","M16A4","M16A4_GL","M16A4_ACG_GL","M16A4_ACG","M4A1","M4A1_HWS_GL","M4A1_HWS_GL_camo","M4A1_HWS_GL_SD_Camo","M4A1_RCO_GL","M4A1_Aim","M4A1_Aim_camo","M4A1_AIM_SD_camo"],
["ItemBriefcase100oz","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","FoodCanFrankBeans","FoodCanFrankBeans","FoodCanBakedBeans","FoodMRE","HandGrenade_east","2000Rnd_762x51_M134","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks"]
],
[
["VSS_vintorez","Saiga12K","M8_compact"],
["ItemBriefcase100oz","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","HandGrenade_east","HandGrenade_east","FoodCanSardines","FoodMRE","FoodPistachio","FoodNutmix","FoodMRE","FoodPistachio","FoodNutmix","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks"]
]
];
_loot = _loot_lists call BIS_fnc_selectRandom;
_loot2 = _loot_lists call BIS_fnc_selectRandom;

 

 

Link to comment
Share on other sites

here u got:  maybe u can use this base to write your remake/update of it. :)

Spoiler

private ["_hasitem","_LastUsedTime","_Time","_loot_lists","_randomNumbers","_deltime","_box","_loot_box"];

 

_hasitem = "FoodchickenCooked" in magazines player;    
_LastUsedTime = 1200;                                                                  
_Time = time - lastuse;
_deltime = 900;
_loot_box = "USVehicleBox";    

 
_loot_lists = [
[
["M9SD","FN_FAL","M4A3_CCO_EP1","AKS_74_kobra","Sa58V_RCO_EP1","ItemEtool","ItemCrowbar","ItemKnife","ItemSledge","ItemCompass","Binocular","Binocular_Vector","NVGoggles","ItemGPS"],
["ItemBriefcase100oz","150Rnd_127x107_DSHKM","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","20Rnd_762x51_FNFAL","30Rnd_762x39_SA58","30Rnd_762x39_SA58","30Rnd_762x39_SA58","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD"]
],
[
["M4A1_HWS_GL_SD_Camo","M16A2GL","M16A4","M16A4_GL","M16A4_ACG_GL","M16A4_ACG","M4A1","M4A1_HWS_GL","M4A1_HWS_GL_camo","M4A1_HWS_GL_SD_Camo","M4A1_RCO_GL","M4A1_Aim","M4A1_Aim_camo","M4A1_AIM_SD_camo"],
["ItemBriefcase100oz","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor"]
],
[
["ItemToolbox","M4A1_HWS_GL_SD_Camo","M16A2GL","M16A4","M16A4_GL","M16A4_ACG_GL","M16A4_ACG","M4A1","M4A1_HWS_GL","M4A1_HWS_GL_camo","M4A1_HWS_GL_SD_Camo","M4A1_RCO_GL","M4A1_Aim","M4A1_Aim_camo","M4A1_AIM_SD_camo"],
["15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor","metal_floor_kit","ItemWoodFloor"]
],
[
["ChainSaw"],
["ItemBriefcase100oz","ItemBriefcase100oz","ItemCorrugated","ItemCorrugated","ItemCorrugated","ItemCorrugated","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemPole","ItemComboLock","ItemGenerator"]
],
[
["m240_scoped_EP1_DZE","Mk_48_DZ","M240_DZ","RPK_74"],
["ItemBriefcase100oz","100Rnd_762x51_M240","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_556x45_BetaCMag","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_556x45_BetaCMag","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_556x45_BetaCMag","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_556x45_BetaCMag","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_762x51_M240","100Rnd_762x51_M240","200Rnd_556x45_M249","2000Rnd_762x51_M134","2000Rnd_762x51_M134","ItemAVE","ItemLRK","ItemTNK","ItemARM","ItemORP","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked","ItemSeaBassCooked"]
],
[
["M4A1_HWS_GL_SD_Camo","M16A2GL","M16A4","M16A4_GL","M16A4_ACG_GL","M16A4_ACG","M4A1","M4A1_HWS_GL","M4A1_HWS_GL_camo","M4A1_HWS_GL_SD_Camo","M4A1_RCO_GL","M4A1_Aim","M4A1_Aim_camo","M4A1_AIM_SD_camo"],
["ItemBriefcase100oz","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","FoodCanFrankBeans","FoodCanFrankBeans","FoodCanBakedBeans","FoodMRE","HandGrenade_east","2000Rnd_762x51_M134","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks"]
],
[
["VSS_vintorez","Saiga12K","M8_compact"],
["ItemBriefcase100oz","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","30Rnd_556x45_Stanag","HandGrenade_east","HandGrenade_east","FoodCanSardines","FoodMRE","FoodPistachio","FoodNutmix","FoodMRE","FoodPistachio","FoodNutmix","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks"]
]
];
_loot = _loot_lists call BIS_fnc_selectRandom;
_loot2 = _loot_lists call BIS_fnc_selectRandom;

 

 

 


if (!_hasitem) exitWith {cutText [format["I like chickens giveme a FoodchickenCooked and we can talk"], "PLAIN DOWN"];};

if(_Time < _LastUsedTime) exitWith {
    cutText [format["You already have a mission whait anothers %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};

 

 

 

 

 

//proceed

if (_hasitem) then {
    lastuse = time;
    player removeMagazine "FoodchickenCooked";   //changeme if you put another  _hasitem
    
_randomNumbers = floor(random 100);

if (_randomNumbers <= 30) then {
 titleText ["Coords //16 up 79 left// have 15 minutes ", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 2;
            _positionArray=[[1677.587, 7417.2876],[1682.7095, 7416.1377],[1638.1494, 7402.5869, 0],[1614.4928, 7447.8296, -0.032172654],[1688.9667, 7443.4146, 0],[1672.4465, 7364.9146, -9.1552734e-005]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;

_box = createVehicle [_loot_box,_position,[], 0, "NONE"];
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
_box setVariable ["permaLoot",true];
    // Add loot
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);        

sleep _deltime;
deleteVehicle _box;      

};

if (_randomNumbers <= 60 && _randomNumbers > 31) then {
titleText ["Coords //79 up - 77 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 2;
            _positionArray=[[7990.2954, 7658.2842, -6.1035156e-005],[7946.6958, 7657.1748, -0.00015258789],[7904.582, 7580.2603, -0.00039672852],[7995.6387, 7562.2183, -9.1552734e-005]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
    
_box = createVehicle [_loot_box,_position,[], 0, "NONE"];
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
_box setVariable ["permaLoot",true];
    // Add loot
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);        

sleep _deltime;
deleteVehicle _box;              
};    

if (_randomNumbers <= 80 && _randomNumbers > 61) then {
 titleText ["Coords //86 up - 114 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 2;
            _positionArray=[[8693.7461, 3957.5413, 3.0517578e-005],[8603.2891, 3869.7571, -0.00012207031],[8643.4014, 3915.6455, -3.0517578e-005],[8667.9189, 3862.4624, -0.00012207031]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
_box = createVehicle [_loot_box,_position,[], 0, "NONE"];
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
_box setVariable ["permaLoot",true];
    // Add loot
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);        

sleep _deltime;
deleteVehicle _box;  
};    

if (_randomNumbers <= 100 && _randomNumbers > 81) then {
 titleText ["Coords //86 up - 114 left//  Have 15 minutes", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 2;
            _positionArray=[[8693.7461, 3957.5413, 3.0517578e-005],[8603.2891, 3869.7571, -0.00012207031],[8643.4014, 3915.6455, -3.0517578e-005],[8667.9189, 3862.4624, -0.00012207031]];
            _pos= floor random count _positionArray;
            _position = _positionArray select _pos;
_box = createVehicle [_loot_box,_position,[], 0, "NONE"];
clearMagazineCargoGlobal _box;
clearWeaponCargoGlobal _box;
_box setVariable ["permaLoot",true];
    // Add loot
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);
{
_box addWeaponCargoGlobal [_x,1];
} forEach (_loot2 select 0);
{
_box addMagazineCargoGlobal [_x,1];
} forEach (_loot2 select 1);        

sleep _deltime;
deleteVehicle _box;  
};

};   

 

 

Link to comment
Share on other sites

On 5/8/2016 at 5:16 PM, juandayz said:

using the same HMMVWreck .. this allow players to search items in the hummvie wreck trunk.

*Create a sqf called "wreck.sqf" and drop it into Mpmissions\yourinstance\custom\script\

wreck.sqf

  Reveal hidden contents

private ["_playerPos","_nearcar","_inventory","_random","_LastUsedTime","_Time","_hascrowbar"];

call gear_ui_init;
_playerPos = getPosATL player;
_nearcar = count nearestObjects [_playerPos, ["HMMWVWreck"], 3] > 0;
_random = round(random(4));
_LastUsedTime = 180;
_Time = time - lastuse;
_inventory = items player;
_hascrowbar = "ItemCrowbar" in _inventory;


if(_Time < _LastUsedTime) exitWith {
    cutText [format["whait anothers %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};

if !(_hascrowbar) exitWith {
cutText [format["You needs a Crowbar in inventory to open this vehicle."], "PLAIN DOWN"];
};

if (_nearcar && _hascrowbar) then {
    lastuse = time;

    switch (_random) do {    
        case 0 :{

            
            titleText ["a crate!!!!", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            
               
                _cratea = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicAmmunitionBox", _position, [], 0, "CAN_COLLIDE"];
                _cratea = _this;
                 clearWeaponCargoGlobal _cratea;
                 clearMagazineCargoGlobal _cratea;  
                _cratea addWeaponCargoGlobal ["ItemToolbox",2];
                _cratea addWeaponCargoGlobal ["ItemShovel"];
                _cratea addWeaponCargoGlobal ["ItemRadio"];
                _cratea addWeaponCargoGlobal ["M24_des_EP1"];
                _cratea addWeaponCargoGlobal ["AKS_74_kobra"];
                _cratea addWeaponCargoGlobal ["AK_74"];
                _cratea addmagazinecargoglobal ["15Rnd_9x19_M9SD",2];
                _cratea addmagazinecargoglobal ["30Rnd_9x19_MP5SD",2];
                _cratea addmagazinecargoglobal ["ItemSodaOrangeSherbet"];
                                
            };
             sleep 120;
                deleteVehicle _cratea;  
        };
        case 1 :{
        titleText ["i found a crate", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            _crateb = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _crateb = _this;
                 clearWeaponCargoGlobal _crateb;
                 clearMagazineCargoGlobal _crateb;  
                _crateb addWeaponCargoGlobal ["AK_74",2];
                _crateb addWeaponCargoGlobal ["G36A_camo",1];
                _crateb addWeaponCargoGlobal ["ItemRadio"];
                _crateb addWeaponCargoGlobal ["M9SD"];
                _crateb addWeaponCargoGlobal ["AKS_74_kobra"];
                _crateb addWeaponCargoGlobal ["MP5SD"];
                _crateb addmagazinecargoglobal ["30Rnd_9x19_MP5SD",2];
                _crateb addmagazinecargoglobal ["30Rnd_556x45_StanagSD"];
                _crateb addmagazinecargoglobal ["30Rnd_545x39_AK"];
                _crateb addmagazinecargoglobal ["ItemOilBarrel"];            
            };
             sleep 120;
                deleteVehicle _crateb;
        };
        case 2 :{
        titleText ["thers a crate in here", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            _cratec = objNull;
                if (true) then
                {
                _this = createVehicle ["LocalBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _cratec = _this;
                 clearWeaponCargoGlobal _cratec;
                 clearMagazineCargoGlobal _cratec;  
                _cratec addWeaponCargoGlobal ["AK_74",2];
                _cratec addmagazinecargoglobal ["ItemBloodbag",2];
                _cratec addmagazinecargoglobal ["FoodSteakRaw"];
                _cratec addmagazinecargoglobal ["30Rnd_545x39_AK"];
                _cratec addmagazinecargoglobal ["HandGrenade_west",5];            
            };
             sleep 120;
                deleteVehicle _cratec;
        };
        case 3 :{
        titleText ["thers a crate into the humvie wreck", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
             _crated = objNull;
                if (true) then
                {
                _this = createVehicle ["LocalBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _crated = _this;
                 clearWeaponCargoGlobal _crated;
                 clearMagazineCargoGlobal _crated;  
                _crated addmagazinecargoglobal ["ItemSandbag",2];
                _crated addmagazinecargoglobal ["ItemTentOld",2];
                _crated addmagazinecargoglobal ["PartWheel"];
                _crated addmagazinecargoglobal ["ItemMorphine"];
                _crated addmagazinecargoglobal ["ItemCanvas",2];                           
            };
             sleep 120;
                deleteVehicle _crated;
        };        
    };
};

at bottom of fn_selfaction.sqf

  Hide contents

////////////buscar wreck//
private["_playerPos","_nearcar"];


_playerPos = getPosATL player;
_nearcar = count nearestObjects [_playerPos, ["HMMWVWreck"], 3] > 0;
 
if (_nearwreck) then {
        if (s_player_wreck < 0) then {
            s_player_wreck = player addaction[("<t color=""#3399cc"">" + ("OPEN TRUNK") +"</t>"),"custom\script\wreck.sqf"];
        };
    } else {
        player removeAction s_player_wreck;
        s_player_wreck = -1;
    };
////////////////

 

juan, when I try this when I log onto my server the scroll commands to unlock, repair, salvage..etc on the vehicles does not work,only thing that comes up is gear. I have tried placing this at the bottom of my fn_selfactions and right above the self action call for your quest script. Any idea what might be causing that?

Link to comment
Share on other sites

11 hours ago, lonewolfgaming said:

juan, when I try this when I log onto my server the scroll commands to unlock, repair, salvage..etc on the vehicles does not work,only thing that comes up is gear. I have tried placing this at the bottom of my fn_selfactions and right above the self action call for your quest script. Any idea what might be causing that?

wreck.sqf (mpmissions\your instance\custom\scripts\wreck\)

Spoiler

private ["_inventory","_random","_LastUsedTime","_Time","_hascrowbar"];


_random = round(random(4));
_LastUsedTime = 180;
_Time = time - lastuse;
_inventory = items player;
_hascrowbar = "ItemCrowbar" in _inventory;


if(_Time < _LastUsedTime) exitWith {
    cutText [format["wait anothers %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};

if !(_hascrowbar) exitWith {
cutText [format["You needs a Crowbar in inventory to open this vehicle."], "PLAIN DOWN"];
};

if (_nearcar && _hascrowbar) then {
    lastuse = time;

    switch (_random) do {    
        case 0 :{

            
            titleText ["a crate!!!!", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            
               
                _cratea = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicAmmunitionBox", _position, [], 0, "CAN_COLLIDE"];
                _cratea = _this;
                 clearWeaponCargoGlobal _cratea;
                 clearMagazineCargoGlobal _cratea;  
                _cratea addWeaponCargoGlobal ["ItemToolbox",2];
                _cratea addWeaponCargoGlobal ["ItemShovel"];
                _cratea addWeaponCargoGlobal ["ItemRadio"];
                _cratea addWeaponCargoGlobal ["M24_des_EP1"];
                _cratea addWeaponCargoGlobal ["AKS_74_kobra"];
                _cratea addWeaponCargoGlobal ["AK_74"];
                _cratea addmagazinecargoglobal ["15Rnd_9x19_M9SD",2];
                _cratea addmagazinecargoglobal ["30Rnd_9x19_MP5SD",2];
                _cratea addmagazinecargoglobal ["ItemSodaOrangeSherbet"];
                                
            };
             sleep 120;
                deleteVehicle _cratea;  
        };
        case 1 :{
        titleText ["i found a crate", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            _crateb = objNull;
                if (true) then
                {
                _this = createVehicle ["USBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _crateb = _this;
                 clearWeaponCargoGlobal _crateb;
                 clearMagazineCargoGlobal _crateb;  
                _crateb addWeaponCargoGlobal ["AK_74",2];
                _crateb addWeaponCargoGlobal ["G36A_camo",1];
                _crateb addWeaponCargoGlobal ["ItemRadio"];
                _crateb addWeaponCargoGlobal ["M9SD"];
                _crateb addWeaponCargoGlobal ["AKS_74_kobra"];
                _crateb addWeaponCargoGlobal ["MP5SD"];
                _crateb addmagazinecargoglobal ["30Rnd_9x19_MP5SD",2];
                _crateb addmagazinecargoglobal ["30Rnd_556x45_StanagSD"];
                _crateb addmagazinecargoglobal ["30Rnd_545x39_AK"];
                _crateb addmagazinecargoglobal ["ItemOilBarrel"];            
            };
             sleep 120;
                deleteVehicle _crateb;
        };
        case 2 :{
        titleText ["thers a crate in here", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
            _cratec = objNull;
                if (true) then
                {
                _this = createVehicle ["LocalBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _cratec = _this;
                 clearWeaponCargoGlobal _cratec;
                 clearMagazineCargoGlobal _cratec;  
                _cratec addWeaponCargoGlobal ["AK_74",2];
                _cratec addmagazinecargoglobal ["ItemBloodbag",2];
                _cratec addmagazinecargoglobal ["FoodSteakRaw"];
                _cratec addmagazinecargoglobal ["30Rnd_545x39_AK"];
                _cratec addmagazinecargoglobal ["HandGrenade_west",5];            
            };
             sleep 120;
                deleteVehicle _cratec;
        };
        case 3 :{
        titleText ["thers a crate into the humvie wreck", "PLAIN DOWN"];titleFadeOut 5;    
            sleep 3;
             _crated = objNull;
                if (true) then
                {
                _this = createVehicle ["LocalBasicAmmunitionBox", _playerPos, [], 0, "CAN_COLLIDE"];
                _crated = _this;
                 clearWeaponCargoGlobal _crated;
                 clearMagazineCargoGlobal _crated;  
                _crated addmagazinecargoglobal ["ItemSandbag",2];
                _crated addmagazinecargoglobal ["ItemTentOld",2];
                _crated addmagazinecargoglobal ["PartWheel"];
                _crated addmagazinecargoglobal ["ItemMorphine"];
                _crated addmagazinecargoglobal ["ItemCanvas",2];                           
            };
             sleep 120;
                deleteVehicle _crated;
        };        
    };
};

 

now in fn_selfaction (custom).

find:

if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {

above paste:

///wreck trunk

if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "HMMWVWreck")) then {
if (s_player_wreck< 0) then {
    s_player_wreck = player addAction ["<t color='#ff5200'>OPEN TRUNK</t>", "custom\scripts\wreck\wreck.sqf", [], 5, false];
    };
    } else {
    player removeAction s_player_wreck;
    s_player_wreck = -1;
    };

////////////

now near of the end (only lines in blue)

Spoiler

} else {
//Engineering

player removeAction s_player_wreck;
    s_player_wreck = -1;

    player removeAction s_player_plotManagement;
    s_player_plotManagement = -1;
   
    
    {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
    s_player_repair_crtl = -1;
    {player removeAction _x} count s_player_combi;s_player_combi = [];
    dayz_myCursorTarget = objNull;
    s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];
    {player removeAction _x} count s_player_parts;s_player_parts = [];
    s_player_parts_crtl = -1;
    {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
    s_player_lockUnlock_crtl = -1;
    player removeAction s_player_checkGear;
    s_player_checkGear = -1;

 

Link to comment
Share on other sites

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
  • Discord

×
×
  • Create New...