Jump to content
mrsandbox

Animals on Dedicated Server

Recommended Posts

Im searching urgently for a solution to spawn animals on a dedicated server on speficic places, where they move in a certain radius. 

I tried all the modules, scripts, but cant get a solution for this one. willing to pay for a script that works. 

thanks in advance.

Share this post


Link to post
Share on other sites
6 hours ago, mrsandbox said:

Im searching urgently for a solution to spawn animals on a dedicated server on speficic places, where they move in a certain radius. 

I tried all the modules, scripts, but cant get a solution for this one. willing to pay for a script that works. 

thanks in advance.

create a trigger called triggerName(for this example) and it creates a random amount of a random animal at a random location inside the trigger. to make this a little better(dont have time atm), create an array on the server and when the player walks into the trigger have it pass the triggers name to the script, then have it pass the _animalH to the server to add to the array, when the player leaves the trigger have it delete the elements of the array or something along those lines(granted you would need arrays for each trigger so when one player leaves a trigger, it doesnt delete the animals in all of the other triggers).

_amountSpawn = selectRandom [3, 5, 8, 10];
_animalList = ["Fin_sand_F", "Cock_white_F", "Goat_random_F"];
_marker = triggerName;
_size = triggerArea triggerName;
_anGroup = createGroup CIVILIAN;

_spawnAnimalFnc =
{
	_animal = _animalList call BIS_fnc_selectRandom;
	_location = [_marker, _size] call BIS_fnc_randomPosTrigger;
	_animal createUnit [[_location select 0, _location select 1, _location select 2], _anGroup];
};

for "_i" from 0 to _amountSpawn do
{
	call _spawnAnimalFnc;
};

 

  • Like 2

Share this post


Link to post
Share on other sites

@gokitty1199 offers a good solution.  I'm not sure the animals will stay within a certain radius though once spawned.  I think that would require coding a loop to execute per animal spawned.   But maybe that isn't that important as you would only spawn them when a player enters a trigger radius.

 

After the createUnit statement, you might want to add the following to the above script so they start off moving in different directions:

_animal setdir random 360;

And maybe my Birds of Prey script might interest you.   When a player enters a trigger area a land animal (rabbit, chicken, or snake) is created if trigger pos is on land, or a random fish is created if trigger pos is over water.  Then a seagull is spawned above later that will dive and attack the animal/fish and carry it away.  It is MP compatible.

 

You can see these scripts in action in these 2 missions:

If you like this script please Rate these missions on Steam as a small reward for creating them.  Thanks!

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, johnnyboy said:

@gokitty1199 offers a good solution.  I'm not sure the anaimals will stay within a certain radius though once spawned.  I think that would require coding a loop to execute per animal spawned.   But maybe that isn't that important as you would only spawn them when a player enters a trigger radius.

 

After the createUnit statement, you might want to add the following to the above script so they start off moving in different directions:


_animal setdir random 360;

And maybe my Birds of Prey script might interest you.   When a player enters a trigger area a land animal (rabbit, chicken, or snake) is created if trigger pos is on land, or a random fish is created if trigger pos is over water.  Then a seagull is spawned above later that will dive and attack the animal/fish and carry it away.  It is MP compatible.

 

You can see these scripts in action in these 2 missions:

If you like this script please Rate these missions on Steam as a small reward for creating them.  Thanks!

thats freakin awsome

  • Like 1

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

×