BIS fnc animalSiteSpawn: Difference between revisions
Jump to navigation
Jump to search
m (see also) |
m (template:command argument fix) |
||
Line 8: | Line 8: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Create an area that spawns animals. The animals will be created or deleted if a player is inside or outside the area's radius. Can only be used by the server or in singleplayer. |= | | Create an area that spawns animals. The animals will be created or deleted if a player is inside or outside the area's radius. Can only be used by the server or in singleplayer. |DESCRIPTION= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [animalSite, classnamesToSpawn, radius] call [[BIS_fnc_animalSiteSpawn]]; |= | | [animalSite, classnamesToSpawn, radius] call [[BIS_fnc_animalSiteSpawn]]; |SYNTAX= | ||
|p1= [animalSite, classnamesToSpawn, radius]: [[Array]]|= Parameter 1 | |p1= [animalSite, classnamesToSpawn, radius]: [[Array]]|= Parameter 1 | ||
Line 18: | Line 18: | ||
|p4= radius: [[Number]] - The radius by which animals are created or deleted.|= Parameter 4 | |p4= radius: [[Number]] - The radius by which animals are created or deleted.|= Parameter 4 | ||
| [[Script_(Handle)]] |= | | [[Script_(Handle)]] |RETURNVALUE= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 24: | Line 24: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[Arma 3 CfgVehicles Animals]] |= | | [[Arma 3 CfgVehicles Animals]] |SEEALSO= | ||
}} | }} |
Revision as of 11:26, 7 April 2019
Description
- Description:
- Create an area that spawns animals. The animals will be created or deleted if a player is inside or outside the area's radius. Can only be used by the server or in singleplayer.
- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- [animalSite, classnamesToSpawn, radius] call BIS_fnc_animalSiteSpawn;
- Parameters:
- [animalSite, classnamesToSpawn, radius]: Array
- animalSite: Object - The object to create the site around.
- classnamesToSpawn: Array - Animals that can be spawned.
- radius: Number - The radius by which animals are created or deleted.
- Return Value:
- Script_(Handle)
Examples
- Example 1:
[ player, ["rabbit_f","turtle_f","hen_random_f"], 200] call BIS_fnc_animalSiteSpawn;
Additional Information
- See also:
- Arma 3 CfgVehicles Animals
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
Bottom Section
- Posted on December 7, 2014 - 08:37 (UTC)
- DreadedEntity
-
The only way to stop the animals from spawning is to delete the object. When using this function, I recommend creating a non-solid object (almost anything from the "Objects (Helpers)" list in the editor, and using hideObjectGlobal on it. Using setVariable you can add the animal site to a reference object to find it easily when you want to delete it.
_obj = createVehicle ["Sign_Sphere10cm_F", getPos player, [], 0, "CAN_COLLIDE"]; hideObjectGlobal _obj; player setVariable ["animalSite", _obj]; _obj = nil;
There are two hidden variables, "animalCount" and "radius". Use setVariable on the object to change these.
animalCount is supposed to limit the amount of animals that can spawn. In the code, the algorithm for this is hard to understand.
radius refers to how far away from the object the animals can spawn.
Both are numbers.
The "area" is imaginary. It is not a tangible area defined by trigger or marker radius, the area is only saved as an integer within the function.
- Posted on December 7, 2014 - 09:26 (UTC)
- Strangepete
-
Using the Script_(Handle) returned, the function can be checked using scriptDone or killed with terminate; Existing generated animals will not be cleaned up when terminated.
_handle = [params] call BIS_fnc_animalSiteSpawn; if(!(scriptDone _handle)) then { terminate _handle; };