Tree Planting Script

Creating scripts
User avatar
Antonio Valenti
Posts: 16
Joined: Sat May 27, 2017 3:04 am
Has thanked: 1 time
Been thanked: 13 times

Tree Planting Script

Post by Antonio Valenti »

Back in my early days at SL, I obtained a script that allowed one to distribute trees randomly across a sim. As I remember, it randomly picked a tree from the prim's inventory, randomized a location (Ei: 130x 205), and dropped the tree from a couple hundred meters. If the tree hit water (went below 20m), it was deleted. The number of trees dropped was a variable in the script. It was a fast and quick was to plant a sim-full of trees without doing it manually. 30 minutes flying around the sim was all that was needed to "clean up" the ones that fell incorrectly.

After all these years I can't find that script - either in my inventories, or online.

My question is - Does anyone have that script, or for the script writers, would it be hard to duplicate?

Al
User avatar
Ilan Tochner
Posts: 6504
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4943 times
Been thanked: 4455 times
Contact:

Re: Tree Planting Script

Post by Ilan Tochner »

Hi Alan,

If those scripts used Physical objects to implement this behavior then you'd wind up with a very laggy world (leaving hundreds of Physical objects inworld is very bad for OpenSim server performance).
User avatar
Antonio Valenti
Posts: 16
Joined: Sat May 27, 2017 3:04 am
Has thanked: 1 time
Been thanked: 13 times

Re: Tree Planting Script

Post by Antonio Valenti »

The "trees" were the Linden defaults. The only times I used it was with a half dozen different pine forest type trees. You could sit and watch them fall - took about 10 minutes to do a Sim.
User avatar
Ilan Tochner
Posts: 6504
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4943 times
Been thanked: 4455 times
Contact:

Re: Tree Planting Script

Post by Ilan Tochner »

A while ago I saw someone in private Kitely world who used a script that populated the world with trees that grew, sent out seeds, grew old, etc. I don't recall the name of the world but I do recall that they initially had a bug with that system and it flooded their world with trees uncontrollably. Changing the timing on some of the functions solved the problem.
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Tree Planting Script

Post by Graham Mills »

I've been looking into plants a little as part of a project to model a late Georgian botanic garden. I'm sorry to say I know very little about botany, gardening or history so progress is a little slow but interesting (to me at least).

I believe there is (or was) a tree module for OpenSim which is not supported by Kitely so you would need to run it offline, save the OAR and reupload. See this thread for (very outdated) info: http://opensim-users.2152040.n2.nabble. ... 63142.html. You will find other references as well if you search..

Ilan may be thinking of Kayaker's product: https://www.kitely.com/market/product/3 ... ar=3316944

You may also find it interesting to visit the RezMela sim on Kitely called Garden Palettes.

I've been playing with scripts to introduce a little randomness into planting patterns derived from simple text grids in notecards. Example: https://twitter.com/vrsimility/status/8 ... 9035632640 and https://twitter.com/vrsimility/status/8 ... 2496080896. This is very much a demo at the moment.
These users thanked the author Graham Mills for the post:
Ilan Tochner
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Tree Planting Script

Post by Graham Mills »

Here's a very simple tree-planting script you can put in a cube. It expects to find a copy-enabled object called "tree" in the same cube's inventory. By default it rezzes a few trees (10-ish) at locations above 20 m and then returns to <128,128, 50>. The global variable TREERISE allows you to determine the height at which the tree will be planted if much of the trunk is below the ground.

Don't blame me if it breaks something.

Code: Select all

integer TREEMAX = 10;
float HEIGHTMIN = 20.0;
float TREERISE = 9.0;

default
{
    touch_start(integer n)
    {

        float rndx;
        float rndy;
        integer hasmoved;
        integer i = 0;
        while (i < TREEMAX)
        {
            rndx = llFrand(255.0);
            rndy = llFrand(255.0);
            float height = osGetTerrainHeight(llFloor(rndx), llFloor(rndy));
            if (height > HEIGHTMIN)
            {
                hasmoved = llSetRegionPos(<rndx, rndy, height>);
                if (hasmoved == 1)
                {
                    llRezObject("tree", llGetPos() + <0.0, 0.0, TREERISE>, ZERO_VECTOR, ZERO_ROTATION, 42);
                    i++;
                }
            }
        }
        hasmoved = llSetRegionPos(<128, 128, 50>);
    }
}
User avatar
Shandon Loring
Posts: 1341
Joined: Sat Oct 26, 2013 3:25 am
Has thanked: 961 times
Been thanked: 1581 times
Contact:

Re: Tree Planting Script

Post by Shandon Loring »

for what it might be worth...
I've got a cute little script for dropping coconuts from a palm tree... the coconuts are initially Physical so that they fall of course, but after a quick set time they go non-physical and phantom and temporary.
(created by Ibrew Meads of West of Ireland in SL)
I've also a simple little script that spits out fire and smoke and randomly shaped rocks, that again start Physical, then non-physical and phantom and temporary, we use it as a very simple baby volcano.

Both of these can be seen at the Polynesian Island area on Seanchai Homeworld.

Maybe something this simple could be leveraged to drop random trees from the inventory of a slow moving object travelling above your sim??

The trick would be to get the trees to land correctly, but that could probably be accomplished by attaching an invisi-prim as a base to keep to your tree upright.
Then you'd still need to do some 'weeding' after the initial tree-fall.

Anyway.. just thoughts...

The method we've used at Seanchai's homeworld and on Celticworld for plants, trees, and landscaping in general is simply an unscripted artiste by the name of Caledonia who painstakingly places each tree individually. Admittedly, time consuming, and I don't think you can buy any Caledonia's anywhere anymore. ;)
These users thanked the author Shandon Loring for the post:
Constance Peregrine
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Tree Planting Script

Post by Graham Mills »

Example of output from modification of previous script to permit automated planting of multiple tree types. https://twitter.com/vrsimility/status/8 ... 5934262272
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Tree Planting Script

Post by Graham Mills »

Incidentally, the trees were from Encantada on OSgrid Wright Plaza. Very good but not for redistribution.
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Tree Planting Script

Post by Graham Mills »

For completeness, perhaps worth mentioning the work of a few years back by Aaron Duffy who used OpenSim (and later Unity) to develop an educational simulation of the evolution of ferns and plants on virtual terrain.

http://www.aduffy70.org/vpgsim

https://github.com/aduffy70/VPGsim-modules
Post Reply