mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
0.3.9.0490
Added improved plant spawner by Redbeard Actual and [VB]AWOL. Fixes to player load and revive thanks to He-Man http://epochmod.com/forum/topic/42178-disappearing-mags-on-login-revive-fix/#comment-277194 renamed cfgpatches for a2 structures pbo
This commit is contained in:
parent
020e2ed7f8
commit
e27e414584
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
build=489;
|
||||
build=490;
|
||||
|
@ -1 +1 @@
|
||||
build=489;
|
||||
build=490;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
Contributors: He-Man
|
||||
|
||||
Description:
|
||||
Player Login
|
||||
@ -137,7 +137,7 @@ if (_this isEqualType []) then {
|
||||
|
||||
_player setPosATL _location;
|
||||
|
||||
_newPlyr = _group createUnit[_class, _location, [], 0, "CAN_COLLIDE"];
|
||||
_newPlyr = _group createUnit[_class, _location, [], 0, "CAN_COLLIDE"];
|
||||
// diag_log format["DEBUG: _newPlyr %1 %2 %3",_newPlyr, _location, getPosATL _newPlyr];
|
||||
|
||||
if !(isNull _newPlyr) then {
|
||||
@ -195,7 +195,7 @@ if (_this isEqualType []) then {
|
||||
// Load Apperance END
|
||||
|
||||
// Load inventory + defaults START
|
||||
if (count _weaponsAndItems >= 2) then {
|
||||
if (count _weaponsAndItems >= 3) then {
|
||||
_equipped = _weaponsAndItems select 2;
|
||||
{
|
||||
_weapon = _x deleteAt 0;
|
||||
@ -208,7 +208,7 @@ if (_this isEqualType []) then {
|
||||
// magazines
|
||||
if (_x isEqualType []) then{
|
||||
_wMags = true;
|
||||
_wMagsArray = _x;
|
||||
_wMagsArray pushback _x;
|
||||
} else {
|
||||
// attachments
|
||||
if (_x != "") then{
|
||||
@ -216,12 +216,14 @@ if (_this isEqualType []) then {
|
||||
};
|
||||
};
|
||||
} forEach _x;
|
||||
if (_wMags) then {
|
||||
{
|
||||
_newPlyr addMagazine _x;
|
||||
} foreach _wMagsArray;
|
||||
};
|
||||
// add weapon if equiped
|
||||
if (_weapon in _equipped) then {
|
||||
_equipped = _equipped - [_weapon];
|
||||
if (_wMags) then {
|
||||
_newPlyr addMagazine _wMagsArray;
|
||||
};
|
||||
if (_weapon != "") then {
|
||||
_newPlyr addWeapon _weapon;
|
||||
};
|
||||
@ -239,18 +241,13 @@ if (_this isEqualType []) then {
|
||||
{
|
||||
_newPlyr removeSecondaryWeaponItem _x;
|
||||
} forEach (secondaryWeaponItems _newPlyr);
|
||||
|
||||
{ _newPlyr addSecondaryWeaponItem _x } forEach _attachments;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// overflow need to add these items to storage
|
||||
}else{
|
||||
{
|
||||
_newPlyr addItem _x;
|
||||
} forEach _attachments;
|
||||
if (_wMags) then {
|
||||
_newPlyr addMagazine _wMagsArray;
|
||||
};
|
||||
};
|
||||
} forEach(_weaponsAndItems select 1);
|
||||
_currWeap = _weaponsAndItems select 0;
|
||||
@ -320,12 +317,11 @@ if (_this isEqualType []) then {
|
||||
};
|
||||
|
||||
if !(_server_vars isEqualTo[]) then{
|
||||
_newPlyr setVariable["SERVER_VARS", _server_vars, true];
|
||||
//Used for mission tracking. TODO: collect directly as required rather than broadcast.
|
||||
_newPlyr setVariable["SERVER_VARS", _server_vars];
|
||||
};
|
||||
|
||||
if (!_canBeRevived) then {
|
||||
_newPlyr setVariable["REVIVE", _canBeRevived];
|
||||
_newPlyr setVariable["REVIVE", _canBeRevived]
|
||||
};
|
||||
|
||||
[_playerNetID, _playerUID, [_newPlyr, _vars, _currWeap, loadAbs _newPlyr, _playerGroup, _canBeRevived, _newPlyr call EPOCH_server_setPToken,_playerGroupArray]] call EPOCH_server_pushPlayer;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
Author: Aaron Clark - EpochMod.com
|
||||
|
||||
Contributors:
|
||||
Contributors: He-Man
|
||||
|
||||
Description:
|
||||
Player Revive
|
||||
@ -19,6 +19,24 @@ if !([_reviver, _token] call EPOCH_server_getPToken) exitWith{};
|
||||
if (isNull _player) exitWith{};
|
||||
if (_player distance _reviver > 20) exitWith{};
|
||||
|
||||
_fnc_addItemToX = {
|
||||
private ["_itemSlot","_itemqtys","_newPlyr"];
|
||||
_newPlyr = _this select 0;
|
||||
{
|
||||
_itemSlot = _forEachIndex;
|
||||
_itemqtys = _x select 1;
|
||||
{
|
||||
for "_i" from 1 to (_itemqtys select _forEachIndex) do {
|
||||
switch _itemSlot do {
|
||||
case 0: { _newPlyr addItemToUniform _x };
|
||||
case 1: { _newPlyr addItemToVest _x };
|
||||
case 2: { _newPlyr addItemToBackpack _x };
|
||||
};
|
||||
};
|
||||
} forEach(_x select 0);
|
||||
} forEach (_this select 1);
|
||||
};
|
||||
|
||||
if (!local _player) then {
|
||||
_playerUID = getPlayerUID _player;
|
||||
if (!isNil "_playerUID" && !alive _player) then {
|
||||
@ -52,7 +70,10 @@ if (!local _player) then {
|
||||
_primaryWeapon = "";
|
||||
_secondaryWeapon = "";
|
||||
|
||||
_wh = nearestObjects[_player, ["WeaponHolderSimulated"], 12];
|
||||
/*
|
||||
_droppedWeapons = [];
|
||||
reverse _wh;
|
||||
{
|
||||
{
|
||||
_droppedWeapons pushBack _x;
|
||||
@ -63,8 +84,30 @@ if (!local _player) then {
|
||||
};
|
||||
} forEach (weaponsItemsCargo _x);
|
||||
|
||||
} forEach nearestObjects[_player, ["WeaponHolderSimulated"], 12];
|
||||
} foreach _wh;
|
||||
*/
|
||||
_droppedPrimary = [];
|
||||
_droppedSecondary = [];
|
||||
_droppedWeapons = [];
|
||||
_deleteprimary = [];
|
||||
_deletesecondary = [];
|
||||
reverse _wh;
|
||||
{
|
||||
_currwh = _x;
|
||||
{
|
||||
_type = getNumber(configfile >> "cfgweapons" >> (_x select 0) >> "type");
|
||||
switch _type do {
|
||||
case 1: {_droppedPrimary = _x; _primaryWeapon = _x select 0; _deleteprimary = [_currwh]};
|
||||
case 4: {_droppedSecondary = _x; _secondaryWeapon = _x select 0;_deletesecondary = [_currwh]};
|
||||
};
|
||||
} forEach (weaponsItemsCargo _x);
|
||||
} foreach _wh;
|
||||
{
|
||||
if (!isnull _x) then {deletevehicle _x};
|
||||
} foreach (_deleteprimary+_deletesecondary);
|
||||
|
||||
if !(_droppedPrimary isequalto []) then {_droppedWeapons pushback _droppedPrimary};
|
||||
if !(_droppedSecondary isequalto []) then {_droppedWeapons pushback _droppedSecondary};
|
||||
// diag_log ["DEBUG: _droppedWeapons %1", _droppedWeapons];
|
||||
|
||||
_itemsplayer = [getItemCargo(uniformContainer _player), getItemCargo(vestContainer _player), getItemCargo(backpackContainer _player)];
|
||||
@ -133,36 +176,38 @@ if (!local _player) then {
|
||||
};
|
||||
|
||||
// Weapons
|
||||
if (count _weapons >= 2) then {
|
||||
|
||||
if (count _weapons >= 3) then {
|
||||
_equipped = _weapons select 2;
|
||||
{
|
||||
_weapon = _x select 0;
|
||||
_weapon = _x deleteAt 0;
|
||||
_type = getNumber(configfile >> "cfgweapons" >> _weapon >> "type");
|
||||
|
||||
_attachments = [];
|
||||
_wMags = false;
|
||||
_wMagsArray = [];
|
||||
// suppressor, laser, optics
|
||||
for "_a" from 1 to 3 do {
|
||||
_attachment = _x select _a;
|
||||
if (_attachment != "") then {
|
||||
_attachments pushBack _attachment;
|
||||
{
|
||||
// magazines
|
||||
if (_x isEqualType []) then{
|
||||
_wMags = true;
|
||||
_wMagsArray pushback _x;
|
||||
} else {
|
||||
// attachments
|
||||
if (_x != "") then{
|
||||
_attachments pushBack _x;
|
||||
};
|
||||
};
|
||||
} forEach _x;
|
||||
if (_wMags) then {
|
||||
{
|
||||
_newPlyr addMagazine _x;
|
||||
} foreach _wMagsArray;
|
||||
};
|
||||
_wMags = (count _x) == 5;
|
||||
|
||||
// add weapon if equiped
|
||||
|
||||
if (_weapon in _equipped) then {
|
||||
_equipped = _equipped - [_weapon];
|
||||
|
||||
if (_wMags) then {
|
||||
_newPlyr addMagazine(_x select 4);
|
||||
};
|
||||
|
||||
if (_weapon != "") then {
|
||||
_newPlyr addWeapon _weapon;
|
||||
};
|
||||
|
||||
switch _type do {
|
||||
case 1: { // primary
|
||||
removeAllPrimaryWeaponItems _newPlyr;
|
||||
@ -180,22 +225,14 @@ if (!local _player) then {
|
||||
{ _newPlyr addSecondaryWeaponItem _x }forEach _attachments;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
}else{
|
||||
{
|
||||
_newPlyr addItem _x;
|
||||
}forEach _attachments;
|
||||
|
||||
if (_wMags) then {
|
||||
_newPlyr addMagazine(_x select 4);
|
||||
};
|
||||
};
|
||||
|
||||
} forEach (_weapons select 1);
|
||||
|
||||
_currWeap = (_weapons select 0);
|
||||
|
||||
// _currWeap = (_weapons select 0);
|
||||
};
|
||||
|
||||
// Linked items
|
||||
{
|
||||
if (_x in ["Binocular","Rangefinder"]) then {
|
||||
@ -205,46 +242,15 @@ if (!local _player) then {
|
||||
};
|
||||
}forEach _items;
|
||||
|
||||
|
||||
// add items to containers
|
||||
{
|
||||
_itemSlot = _forEachIndex;
|
||||
_itemqtys = _x select 1;
|
||||
{
|
||||
for "_i" from 1 to (_itemqtys select _forEachIndex) do {
|
||||
switch _itemSlot do {
|
||||
case 0: { _newPlyr addItemToUniform _x };
|
||||
case 1: { _newPlyr addItemToVest _x };
|
||||
case 2: { _newPlyr addItemToBackpack _x };
|
||||
};
|
||||
//diag_log format["DEBUG additemtoVest: %1", _x];
|
||||
};
|
||||
|
||||
}forEach (_x select 0);
|
||||
}forEach _itemsplayer;
|
||||
[_newPlyr, _itemsplayer] call _fnc_addItemToX;
|
||||
|
||||
// add weapons to containers
|
||||
{
|
||||
_itemSlot = _forEachIndex;
|
||||
_itemqtys = _x select 1;
|
||||
{
|
||||
for "_i" from 1 to (_itemqtys select _forEachIndex) do {
|
||||
switch _itemSlot do {
|
||||
case 0: { _newPlyr addItemToUniform _x };
|
||||
case 1: { _newPlyr addItemToVest _x };
|
||||
case 2: { _newPlyr addItemToBackpack _x };
|
||||
};
|
||||
//diag_log format["DEBUG additemtoVest: %1", _x];
|
||||
};
|
||||
|
||||
}forEach (_x select 0);
|
||||
}forEach _weaponsplayer;
|
||||
[_newPlyr, _weaponsplayer] call _fnc_addItemToX;
|
||||
|
||||
// Add magazines
|
||||
{
|
||||
_newPlyr addMagazine _x;
|
||||
//diag_log format["DEBUG addMagazine: %1", _x];
|
||||
}forEach _magazinesAmmo;
|
||||
{_newPlyr addMagazine _x;}forEach _magazinesAmmo;
|
||||
// Load inventory + defaults END
|
||||
|
||||
// Final Push
|
||||
_token = _newPlyr call EPOCH_server_setPToken;
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1 +1 @@
|
||||
build=489;
|
||||
build=490;
|
||||
|
Binary file not shown.
@ -1,35 +1,141 @@
|
||||
/*
|
||||
Plant Spawn Event
|
||||
by Aaron Clark - EpochMod.com
|
||||
Author/s:
|
||||
Redbeard Actual
|
||||
Aaron Clark - EpochMod.com
|
||||
|
||||
Description:
|
||||
Improved Plant Spawner - Plant Patch Spawner
|
||||
Event spawns a random number of plants based on plant type.
|
||||
Prefers "Hill" locations and restricts Jammers and Protected Trader Zones.
|
||||
Plants now decay after 20 minutes and marker will change to brown at 50%.
|
||||
Plant patch marker will turn red after one plant is picked
|
||||
Plants and marker will cleanup after all plants in a patch are picked or die due to decay.
|
||||
|
||||
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
http://creativecommons.org/licenses/by-nc-nd/4.0/
|
||||
|
||||
Improvements and or bugfixes and other contributions are welcome via the github:
|
||||
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server_settings/EpochEvents/PlantSpawner.sqf
|
||||
*/
|
||||
private ["_displayName","_marker","_plants","_plant","_item","_plantPosition"];
|
||||
_debug = false;
|
||||
_serverMapConfig = configFile >> "CfgEpoch" >> worldName;
|
||||
_plantLimit = [_serverMapConfig, "plantLimit", 10] call EPOCH_fnc_returnConfigEntry;
|
||||
private ["_debug","_jammers","_restricted","_playersNearby","_plant","_position","_plantCount","_scatter","_marker","_nearbyLocations","_plants","_timeStamp","_decayTime","_showPlantMarkers"];
|
||||
|
||||
// SET THIS TO TRUE TO GET MESSAGES IN LOG.
|
||||
_debug = true;
|
||||
_showPlantMarkers = true;
|
||||
|
||||
// select a plant type to spawn
|
||||
_plant = selectRandom ["Goldenseal_EPOCH", "Goldenseal_EPOCH", "Goldenseal_EPOCH", "Poppy_EPOCH", "Pumpkin_EPOCH"];
|
||||
|
||||
// START PLANT PATCH SPAWN LIMIT CODE IF EPOCH_plantCounter HAS NOT BEEN INITIATED.
|
||||
// THIS MAKES SURE IT ONLY DOES THIS BIT THE FIRST TIME THE EVENT RUNS.
|
||||
if (isNil "EPOCH_plantCounter") then {
|
||||
//SET COUNTER TO ZERO.
|
||||
EPOCH_plantCounter = 0;
|
||||
} else {
|
||||
EPOCH_plantCounter = EPOCH_plantCounter + 1;
|
||||
//SET LIMIT TO FIVE.
|
||||
EPOCH_plantLimit = 5;
|
||||
};
|
||||
|
||||
if (EPOCH_plantCounter >= _plantLimit) exitWith {if (_debug) then {diag_log "DEBUG: suppressed plant spawn over limit"}};
|
||||
//STOP THE SCRIPT AND EXIT IF THE COUNTER IS TOO HIGH.
|
||||
if (EPOCH_plantCounter >= EPOCH_plantLimit) exitWith {
|
||||
if (_debug) then {diag_log "DEBUG: suppressed plant spawn over limit"};
|
||||
};
|
||||
|
||||
_plantPosition = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 4000, 0] call BIS_fnc_findSafePos;
|
||||
// FIND A POSITION FOR PLANT PATCH prefer Hils and Vineyards
|
||||
_nearbyLocations = nearestLocations [epoch_centerMarkerPosition,["VegetationVineyard","Hill"],EPOCH_dynamicVehicleArea];
|
||||
if (_nearbyLocations isEqualTo []) then {
|
||||
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 4000, 0] call BIS_fnc_findSafePos;
|
||||
} else {
|
||||
_selectedLocation = locationPosition (selectRandom _nearbyLocations);
|
||||
_position = [_selectedLocation, 0, 1000, 10, 0, 4000, 0] call BIS_fnc_findSafePos;
|
||||
};
|
||||
|
||||
if ((count _plantPosition) == 2) then{
|
||||
_plants = ["Goldenseal_EPOCH", "Poppy_EPOCH", "Pumpkin_EPOCH"];
|
||||
_plant = selectRandom _plants;
|
||||
_item = createVehicle[_plant, _plantPosition, [], 0.0, "CAN_COLLIDE"];
|
||||
if (EPOCH_showShippingContainers) then{
|
||||
_displayName = getText(configfile >> "CfgVehicles" >> typeOf _item >> "DisplayName");
|
||||
_marker = createMarker[str(_plantPosition), _plantPosition];
|
||||
//CHECK FOR PROTECTED AREA WITIN 2000 METERS.
|
||||
_restricted = nearestObjects [_position, ["ProtectionZone_Invisible_F"], 2000];
|
||||
if(count _restricted > 0) exitWith {
|
||||
if (_debug) then {diag_log "DEBUG: suppressed PLANT PATCH spawn TRADER too close"};
|
||||
};
|
||||
|
||||
//CHECK FOR JAMMERS IN THE AREA WITHIN 1000 METERS.
|
||||
_jammers = nearestObjects[_position, ["PlotPole_EPOCH"], 1000];
|
||||
if(count _jammers > 0) exitWith {
|
||||
if (_debug) then {diag_log "DEBUG: suppressed PLANT PATCH spawn jammer too close"};
|
||||
};
|
||||
|
||||
//CHECK TO SEE IF PLAYERS WITHIN 900 METERS.
|
||||
_playersNearby = _position nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 900];
|
||||
if(count _playersNearby > 0) exitWith {
|
||||
if (_debug) then {diag_log "DEBUG: suppressed PLANT PATCH spawn PLAYER too close"};
|
||||
};
|
||||
|
||||
// IF WE MADE IT THIS FAR, WE CAN SPAWN SOME SHIT.
|
||||
if ((count _position) == 2) then{
|
||||
|
||||
// vary plant count and scatter by plant type
|
||||
_plantCount = 1;
|
||||
_scatter = 10;
|
||||
_decayTime = 1200;
|
||||
switch _plant do {
|
||||
case "Goldenseal_EPOCH": {
|
||||
_plantCount = (floor(random(4)))+3;
|
||||
_scatter = 10;
|
||||
};
|
||||
case "Poppy_EPOCH": {
|
||||
_plantCount = (floor(random(2)))+3;
|
||||
_scatter = 15;
|
||||
};
|
||||
case "Pumpkin_EPOCH": {
|
||||
_plantCount = (floor(random(3)))+5;
|
||||
_scatter = 20;
|
||||
};
|
||||
};
|
||||
|
||||
_plants = [];
|
||||
// CREATE THE PATCH OF PLANTS.
|
||||
for "_i" from 1 to _plantCount step 1 do {
|
||||
_plants pushBack createVehicle[_plant, _position, [], _scatter, "NONE"];
|
||||
};
|
||||
_timeStamp = diag_tickTime;
|
||||
|
||||
// SET UP THE MARKER.
|
||||
if (_showPlantMarkers) then{
|
||||
_marker = createMarker[str(_position), _position];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_triangle";
|
||||
// _marker setMarkerText _displayName;
|
||||
_marker setMarkerType "waypoint";
|
||||
_marker setMarkerColor "ColorGreen";
|
||||
};
|
||||
|
||||
// TICK COUNTER + 1 SPAWNED PLANT PATCH.
|
||||
EPOCH_plantCounter = EPOCH_plantCounter + 1;
|
||||
|
||||
// wait loop to handle plant patch
|
||||
while {true} do {
|
||||
private _plantsLeft = _plants select {!isNull _x};
|
||||
// Wait for all plants to be picked or to decay
|
||||
if (_plantsLeft isEqualTo [] || (diag_tickTime - _timeStamp) > _decayTime) exitWith {
|
||||
// TICK THE COUNTER DOWN SO A NEW PLANT PATCH WILL SPAWN TO TAKE ITS PLACE.
|
||||
EPOCH_plantCounter = EPOCH_plantCounter - 1;
|
||||
// DELETE THAT MARKER.
|
||||
if (_showPlantMarkers) then{
|
||||
deleteMarker _marker;
|
||||
};
|
||||
// remove any left over "dead" plants (only if decayTime is reached)
|
||||
{deleteVehicle _x} forEach _plantsLeft;
|
||||
};
|
||||
// set marker to brown to show 50% decay but not if already marked as picked (red).
|
||||
if !(getMarkerColor _marker in ["ColorRed","ColorBrown"]) then {
|
||||
if ((diag_tickTime - _timeStamp) > (_decayTime/2)) then {
|
||||
_marker setMarkerColor "ColorBrown";
|
||||
};
|
||||
};
|
||||
// WAIT FOR A PLAYER TO Pick one plant then set marker to red
|
||||
if (count _plantsLeft != _plantCount) then {
|
||||
if (_showPlantMarkers) then{
|
||||
if (getMarkerColor _marker != "ColorRed") then {
|
||||
_marker setMarkerColor "ColorRed";
|
||||
};
|
||||
};
|
||||
};
|
||||
sleep 30;
|
||||
};
|
||||
};
|
||||
// END SCRIPT.
|
||||
|
@ -1 +1 @@
|
||||
build=489;
|
||||
build=490;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user