Jump to content
Sign in to follow this  
Antorugby

Problem with animals

Recommended Posts

Hello guys, I'm using the create site module to spawn sheeps and goats, it works fine, the only problem that I have is to make them spawn with a trigger.

The Condition of Presence of the module doesn't seems to work for me, I tried to have a trigger with activation "sheepsite" and the module in the condition with "sheepsite", I tried using triggerActivated, but nothing seems to work.

Any tips?

Share this post


Link to post
Share on other sites

Looking at the animal module it should be capable of spawning animals when your within a certain distance.

However I haven't managed to get that working and trigger has no effect.

It's as if they have tried to automate it but it isn't working or at least more knowledge is required.

Share this post


Link to post
Share on other sites
Looking at the animal module it should be capable of spawning animals when your within a certain distance.

However I haven't managed to get that working and trigger has no effect.

It's as if they have tried to automate it but it isn't working or at least more knowledge is required.

I think the range refers how far they will spawn from the module.

Also, it seems you can get hurt and die if they hit you.

Inviato dal mio GT-I9300 utilizzando Tapatalk

Share this post


Link to post
Share on other sites

I think they're the only options we have control of but according to the module it should do this :-

_this select 2: Number - Animals are spawned/deleted when the player is close/far to the site than this distance (in meters).

Share this post


Link to post
Share on other sites
I think they're the only options we have control of but according to the module it should do this :-

_this select 2: Number - Animals are spawned/deleted when the player is close/far to the site than this distance (in meters).

Mhmh I set range 5, I was 30 meters away and they spawned anyway.

I'll try again maybe I did something wrong.

Inviato dal mio GT-I9300 utilizzando Tapatalk

Share this post


Link to post
Share on other sites

I think they've messed up and forgot to display the setting in the editor.

It has to have a setting or it would throw an error, It does work if I call/ spawn the module as I then can send my own variables.

placed in game logic

this setvariable ["animalCount",10];// default 5 if not used
this setvariable ["radius",20];// default 10meters  if not used
null=[this,["Alsatian_SandBlack_F"],200] call BIS_fnc_animalSiteSpawn;

200 is the spawn delete radius this varies depending on radius roughly 200+radius

If anyone can work out how to set the spawn delete using a placed module here's the code _this select 2 is the issue

/*
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;};
				hint str _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"];
					player sidechat "one";
					_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);
	};
};
};

Share this post


Link to post
Share on other sites
I think they've messed up and forgot to display the setting in the editor.

It has to have a setting or it would throw an error, It does work if I call/ spawn the module as I then can send my own variables.

placed in game logic

this setvariable ["animalCount",10];// default 5 if not used
this setvariable ["radius",20];// default 10meters  if not used
null=[this,["Alsatian_SandBlack_F"],200] call BIS_fnc_animalSiteSpawn;

200 is the spawn delete radius this varies depending on radius roughly 200+radius

If anyone can work out how to set the spawn delete using a placed module here's the code _this select 2 is the issue

/*
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;};
hint str _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"];
player sidechat "one";
_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);
};
};
};

Thank you so much, this will help me a lot!

Inviato dal mio GT-I9300 utilizzando Tapatalk

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  

×