CODE
// Script created by SiRiS Asturias.This way the only thing it does each timer event is a water to current height comparison on the Z vector.
// All rights reserved. (c)2005 (Released as OpenSource 12/06/2005)
// Free for use as long as this header stays intact & follows the below guidelines.
// This work is licensed under the:
// Creative Commons Attribution-NonCommercial-ShareAlike License.
// To view the full copy of this license, please visit:
// http://creativecommons.org/licenses/by-nc-sa/2.0/
integer a;// Idle switch
default
{
state_entry()
{
llSetHoverHeight(0.15,TRUE, 0.5);// Make plane hover
llSetTimerEvent(0.2);//Land Timer
}
timer()
{
vector pos =llGetPos() -<0,0,0.2>;//Cuurent position minus offset
float water =llWater(<0,0,0>);// Water height in the current Sim
if (a == 1)// If idle
{
if (pos.z> water)// Check to see if we are off the water
{
llOwnerSay("In the air");
llSetTimerEvent(0.2);//Took off, start landing timer again
a = 0;//Set state back to airborne
}
}
else if (pos.z <= water)// Landed on water, trigger particles and wait to leave
{
llOwnerSay("Water Landing");
Water(); // Start splash particle system
llSetTimerEvent(5.0);// Idle grounded timer
a = 1;//Set state to water landing
}
}
}
Could easily be modded to add only calling the llWater function per Sim change for even more efficiency per timer event.
Enjoy!
