Moin,
ich habe mir mal das Script für die Hunting_zone in der 5er angeschaut und bin nicht wirklich begeistert davon, da der life_server alle 3-5 sekunden schaut ob ein Spieler in der Nähe des Markers ist. Nun meine Frage dazu, kann man das nicht in den Client verlagern, das würde in meinen Augen deutlich mehr Sinn ergeben und auch die Serverperformance deutlich entlasten. Ich möchte das Script nämlich ein wenig umbauen um das Schildi farmen etwas attraktiver zu machen (Spawnrate erhöhen).
Code
/*
File: fn_huntingZone.sqf
Author: Bryan "Tonic" Boardwine
Description:
Spawns animals around the marker when a player
is near. Very basic WIP
TODO:
Change it up so animals repopulate over time.
*/
private ["_animalList","_dist","_radius","_zoneName","_unitsNear","_animalsActive"];
params [
["_zoneName","",[""]],
["_maxAnimals",10,[0]]
];
if (_zoneName isEqualTo "") exitWith {};
_animalList = ["Sheep_random_F","Goat_random_F","Hen_random_F","Cock_random_F"];
_radius = (getMarkerSize _zoneName) select 0;
_dist = _radius + 100;
_zone = getMarkerPos _zoneName;
if (!isNil "animals" && {!(count animals isEqualTo 0)}) then {
_maxAnimals = _maxAnimals - count(animals);
} else {
animals = [];
};
_unitsNear = false;
_animalsActive = false;
for "_i" from 0 to 1 step 0 do {
{if ((_x distance _zone) < _dist) exitWith {_unitsNear = true;}; _unitsNear = false;} forEach playableUnits;
if (_unitsNear && !_animalsActive) then {
_animalsActive = true;
for "_i" from 1 to _maxAnimals do {
_animalClass = selectRandom _animalList;
_position = [((_zone select 0) - _radius + random (_radius * 2)), ((_zone select 1) - _radius + random (_radius * 2)),0];
_animal = createAgent [_animalClass,_position,[],0,"FORM"];
_animal setDir (random 360);
animals pushBack _animal;
};
} else {
if (!_unitsNear && _animalsActive) then {
{deleteVehicle _x;} forEach animals;
animals = [];
_animalsActive = false;
};
};
uiSleep (3 + random 2);
_maxAnimals = param [1,10,[0]];
};
Alles anzeigen
Gruß,
moeck