Jump to content
Sign in to follow this  
KingoftheSandbox

Animals on Dedicated Server

Recommended Posts

Possible to make that function work on a dedicated?

Works for me with that code in a gamelogic, but only shadows for the animals.

animalspawn = [site1,["Sheep_random_F"],50] call BIS_fnc_animalSiteSpawn; 

File: fn_animalSiteSpawn.sqf
Author: Borivoj Hlava

Description:
Spawn of animals in animal sites.

Parameter(s):
_this select 0: Object - Site.
_this select 1: Array - Spawned config classes.
_this select 2: Number - Animals are spawned/deleted when the player is close/far to the site than this distance (in meters).

Returned value:
None
*/

if (isServer) then {
_this spawn {
	_site = _this select 0;
	_animalList = _this select 1;
	_genDist = _this select 2;		//creation distance

	_sitePos = getPos _site;
	_active = false;
	_animalCount = _site getvariable ["animalCount",5];
	_radius = _site getvariable ["radius",10];	
	_siteAnimals = [];

	while {!(isNull _site)} do {
		_dist = 10000;
		{
			if (isPlayer _x) then {
				_checkDist = (_x distance _site) - _radius;
				if (_dist > _checkDist) then {_dist = _checkDist};
			};
		} forEach allUnits;

		if !(_active) then {
			if (_dist < _genDist) then {
				_count = round ((_animalCount - (_animalCount/5) + (random (_animalCount/2.5))));
				_i = 0;
				while {_i < _animalCount} do {
					_animal = _animalList select (round ((random ((count _animalList) - 0.01)) - 0.499));
					_pos = [((_sitePos select 0) - _radius + random (_radius * 2)), ((_sitePos select 1) - _radius + random (_radius * 2)), 0];
					_unit = createAgent [_animal,_pos,[],0,"NONE"];
					_unit setVariable ["inSite",_site];
					_unit setDir (random 360);
					_siteAnimals = _siteAnimals + [_unit];
					_i = _i + 1;
					sleep 0.05
				};
				_active = true
			}
		} else {
			if (_dist > (_genDist + _genDist/10)) then {
				{deleteVehicle _x} forEach _siteAnimals;
				_siteAnimals = [];
				_active = false;
			}
		};

		sleep (2.5 + random 1);
	};
};
};

Edited by KingoftheSandbox

Share this post


Link to post
Share on other sites

Are you sure it's because of the dedicated server? Because I've occasionally gotten only shadows in SP as well, and I just assumed it's because they've somehow spawned underground.

Share this post


Link to post
Share on other sites

this has been an issue for arma3 since the alpha that still isn't fixed. if I remember correctly its the sheep and the goats that are invisible to clients (they just see shadows walking around). for the longest time now I been creating the animals using creatunit instead of creatagent so all player would see all the animals.

Share this post


Link to post
Share on other sites

Huh, that's good to know. A feedback ticket

Does the normal function cause problems (besides increased load) if you just switch createAgent to createUnit?

Share this post


Link to post
Share on other sites

I actually don't use the animal module. I wrote a script to spawn animals around the player similar to what dayz mod has. as far as impact goes between createagent and createunit you just have to set intelligence to zero (save on resources) and keep track of how many groups are in your mission (due to the total group limit of arma) because they are now counted as one. also a good idea to setcaptive on the animals to make sure other factions don't shoot at them. I admit the setcaptive thing is something I just thought of because the mission im working on uses custom script for ai and all factions are friendly towards each other to make it work properly :)

Share this post


Link to post
Share on other sites

I know this is a very old post, but its the first one I found relating to this problem (and seeing as how I can't post new threads either). This problem still exists and really needs to be fixed. Sheep and Goats still spawn invisible minus the shadows.

Share this post


Link to post
Share on other sites

Voted up - need my sheep and goats.

However else will I do my Arma Bethlehem nativity mission? :p

Share this post


Link to post
Share on other sites
I know this is a very old post, but its the first one I found relating to this problem (and seeing as how I can't post new threads either). This problem still exists and really needs to be fixed. Sheep and Goats still spawn invisible minus the shadows.

I just tested on a dedicated server and they show up fine for me, like they should after the fix half a year ago. Has anyone else had this still happen?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×