createFoliage
Grows GTA's native plants inside a world-space triangle by registering it with the native plant manager.
Syntax
foliage|false createFoliage(Vector3 v1, Vector3 v2, Vector3 v3, int surface [, float density = 1.0])Arguments
v1Vector3First triangle corner.
v2Vector3Second triangle corner.
v3Vector3Third triangle corner.
surfaceintGTA surface ID from 0 through 255. It must have plant properties defined in the loaded plants.dat.
densityfloatoptional · default 1.0Density multiplier from 0.0 through 10.0, where 1.0 is the native density for that surface.
Returns
A foliage element, or false when the triangle is degenerate, the surface has no plant properties, the density is out of range, or no custom slot is free.
Ownership and lifecycle
A foliage element belongs to the resource that created it and joins its element group, so stopping the resource removes its patches without explicit cleanup. Every setter rebuilds the native triangle atomically and rolls back to the previous state when the new combination is rejected.
- GTA decides what grows. The surface selects an existing plants.dat entry; Neon adds no plant types of its own.
- A density of 0.0 creates a real but empty patch, which is useful as a control when comparing densities.
- At most 64 custom foliage elements exist at a time, and GTA's shared plant pool can still refuse a triangle before that budget is reached.
OOP aliases
Foliage.create(v1, v2, v3, surface, density)
Example
local patch = createFoliage( Vector3(2470, -1650, 12.5), Vector3(2480, -1650, 12.5), Vector3(2475, -1640, 12.5), 10, 1.5)