Aggro

Gift box Loot spawn

13 posts in this topic

1 hour ago, Aggro said:

did you get a chance to test it in the latest update? i have not had a chance yet.

Not yet, but I'll try to find time to do it this week.

Share this post


Link to post
Share on other sites

> xmas gift box exile 1.0.3 <

ExileServer_object_player_network_createPlayerRequest

Spoiler

/**
 * ExileServer_object_player_network_createPlayerRequest
 *
 * 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["_sessionID", "_parameters", "_requestingPlayer", "_spawnLocationMarkerName", "_playerUID", "_accountData", "_bambiPlayer", "_cargoType"];
_sessionID = _this select 0;
_parameters = _this select 1;
_requestingPlayer = _sessionID call ExileServer_system_session_getPlayerObject;
try
{
    if (isNull _requestingPlayer) then
    {
        throw format ["Session %1 requested a bambi character, but doesn't have a player object. Hacker or Monday?", _sessionID];
    };
    _spawnLocationMarkerName = _parameters select 0;
    _playerUID = getPlayerUID _requestingPlayer;
    if(_playerUID isEqualTo "")then
    {
        throw format ["Player: '%1' has no player UID. Arma/Steam sucks!.",name _requestingPlayer];
    };
    _accountData = format["getAccountStats:%1", _playerUID] call ExileServer_system_database_query_selectSingle;
    _bambiPlayer = (createGroup independent) createUnit ["Exile_Unit_Player", [0,0,0], [], 0, "CAN_COLLIDE"];
    //removeHeadgear _bambiPlayer;
    //xmas
    _bambiPlayer addHeadgear "Exile_Headgear_SantaHat";    
    //xmas
    {
        _cargoType = _x call ExileClient_util_cargo_getType;
        switch (_cargoType) do
        {
            case 1:     { _bambiPlayer addItem _x; };
            case 2:     { _bambiPlayer addWeaponGlobal _x; };
            case 3:     { _bambiPlayer addBackpackGlobal _x; };
            case 4:        { _bambiPlayer linkItem _x; };
            default                     { _bambiPlayer addItem _x; };
        };
    }
    forEach getArray(configFile >> "CfgSettings" >> "BambiSettings" >> "loadOut");
    [_sessionID, _requestingPlayer, _spawnLocationMarkerName, _bambiPlayer, _accountData] call ExileServer_object_player_createBambi;
}
catch
{
    _exception call ExileServer_util_log;
};

ExileServer_system_lootManager_spawnLootInBuilding

Spoiler

/**
 * ExileServer_system_lootManager_spawnLootInBuilding
 *
 * 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["_building", "_buildingConfig", "_lootTableName", "_localPositions", "_lootConfig", "_maximumNumberOfLootPositions", "_maximumPositionCoverage", "_maximumNumberOfItemsPerLootSpot", "_numberOfPositionsToUse", "_lootPositions", "_spawnedItemClassNames", "_lootWeaponHolderNetIDs", "_lootPosition", "_lootHolder", "_numberOfItemsToSpawn", "_n", "_itemClassName", "_cargoType", "_magazineClassNames", "_magazineClassName", "_numberOfMagazines" ,"_presentClasses"];
_building = _this;
_building setVariable ["ExileLootSpawnedAt", time];
_building setVariable ["ExileHasLoot", true];
_buildingConfig = configFile >> "CfgBuildings" >> typeOf _building;
_lootTableName = getText (_buildingConfig >> "table");
_localPositions = getArray (_buildingConfig >> "positions");
if ((getPosATL _building) call ExileClient_util_world_isInRadiatedZone) then
{
    _lootTableName = "Radiation";
};
_lootConfig = missionConfigFile >> "CfgExileLootSettings";
_maximumNumberOfLootPositions = getNumber (_lootConfig >> "maximumNumberOfLootSpotsPerBuilding");
_maximumPositionCoverage = getNumber (_lootConfig >> "maximumPositionCoverage");
_maximumNumberOfItemsPerLootSpot = getNumber (_lootConfig >> "maximumNumberOfItemsPerLootSpot");
_numberOfPositionsToUse = 1 max (((count _localPositions) * _maximumPositionCoverage / 100) min _maximumNumberOfLootPositions);
_localPositions = _localPositions call ExileClient_util_array_shuffle;
_lootPositions = _localPositions select [0, _numberOfPositionsToUse];
_spawnedItemClassNames = [];
_lootWeaponHolderNetIDs = [];
//xmas gift box
_presentClasses =
[
    "Exile_Loot_XmasPresent_Blue",
    "Exile_Loot_XmasPresent_Gold",
    "Exile_Loot_XmasPresent_Green",
    "Exile_Loot_XmasPresent_Mint",
    "Exile_Loot_XmasPresent_Pink",
    "Exile_Loot_XmasPresent_Purple",
    "Exile_Loot_XmasPresent_Red",
    "Exile_Loot_XmasPresent_Magenta"
];
//xmas gift box
{
    _lootPosition = ASLToATL (AGLToASL (_building modelToWorld _x));
    if (_lootPosition select 2 < 0.05) then
    {
        _lootPosition set [2, 0.05];
    };
    _lootHolder = objNull;
    _numberOfItemsToSpawn = (floor (random _maximumNumberOfItemsPerLootSpot)) + 1;
    for "_n" from 1 to _numberOfItemsToSpawn do
    {
        _itemClassName = _lootTableName call ExileServer_system_lootManager_dropItem;
        if !(_itemClassName in _spawnedItemClassNames) then
        {
            if (isNull _lootHolder) then
            {
                //xmas gift box
                if ((floor (random 100)) < 50) then
                {
                    _lootHolder = createVehicle [_presentClasses call BIS_fnc_selectRandom, _lootPosition, [], 0, "CAN_COLLIDE"];
                }
                else
                {
                    _lootHolder = createVehicle ["LootWeaponHolder", _lootPosition, [], 0, "CAN_COLLIDE"];
                };
                //xmas gift box
                //_lootHolder = createVehicle ["LootWeaponHolder", _lootPosition, [], 0, "CAN_COLLIDE"];
                _lootHolder setDir (random 360);
                _lootHolder setPosATL _lootPosition;
                _lootHolder setVariable ["ExileSpawnedAt", time];
                _lootWeaponHolderNetIDs pushBack (netId _lootHolder);                                            
            };
            _cargoType = _itemClassName call ExileClient_util_cargo_getType;
            switch (_cargoType) do
            {
                case 1:     
                {
                    if (_itemClassName isEqualTo "Exile_Item_MountainDupe") then
                    {
                        _lootHolder addMagazineCargoGlobal [_itemClassName, 2];
                    }
                    else
                    {
                        _lootHolder addMagazineCargoGlobal [_itemClassName, 1];
                    };
                };
                case 3:     
                {
                    _lootHolder addBackpackCargoGlobal [_itemClassName, 1];
                };
                case 2:     
                {
                    _lootHolder addWeaponCargoGlobal [_itemClassName, 1];
                    if !(_itemClassName isKindOf ["Exile_Melee_Abstract", configFile >> "CfgWeapons"]) then
                    {
                        _magazineClassNames = getArray(configFile >> "CfgWeapons" >> _itemClassName >> "magazines");
                        if (count(_magazineClassNames) > 0) then
                        {
                            _magazineClassName = selectRandom _magazineClassNames;
                            _numberOfMagazines = 2 + floor(random 3);
                            _lootHolder addMagazineCargoGlobal [_magazineClassName, _numberOfMagazines];
                            _spawnedItemClassNames pushBack _magazineClassName;
                        };
                    };
                    _numberOfItemsToSpawn = -1;
                };
                default
                {
                    _lootHolder addItemCargoGlobal [_itemClassName, 1];
                };
            };
            _spawnedItemClassNames pushBack _itemClassName;
        };
    };
}
forEach _lootPositions;
_building setVariable ["ExileLootWeaponHolderNetIDs", _lootWeaponHolderNetIDs];
ExileServerBuildingNetIdsWithLoot pushBack (netId _building);

 

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.