Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Not sure if this is a script issue or not ...

Brash Zenovka
Still Learning
Join date: 25 Jun 2007
Posts: 392
07-08-2007 17:27
I would like to have on my property a boat or hovercraft that, if I take it out for a spin, will return to its original "parking" location on MY property if lost/abandoned instead of being returned to my inventory. Mostly so I don't have to re - place it again each time I use it.

Is this possible to do, and is it possible also on vehicles/objects with a No Modify setting by the creator?

I am very new so I may need the equivalent of "SL Baby Talk" =)
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
07-08-2007 17:35
In the case where someone is allowed to ride it, and then just leaves it somewhere, a script could watch for someone getting off of it, wait a minute or so, then it could warpos back to to your dock.

From a scripting detail perspective:

It might check the changed event in the script to see if someone gets off it.
It might then call llSetTimeEvent to start a countdown.
If no one gets back on before the timer runs out, it might then do a series of llSetPos commands until it is back to your dock.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
07-08-2007 18:12
With a no-mod vehicle, your options are limited. The easiest is to put a button at the "parking location" that will replace the vehicle when touched.

However, the best method might be to use an invisible prim on the parking space to detect the vehicle... if the vehicle isn't detected after a certain amount of time, a new vehicle will be rezzed. I just happen to need such a script myself, so I'll write one here, while at work.

The LSL functions used:

llRezObject()
http://lslwiki.net/lslwiki/wakka.php?wakka=llRezObject

llVolumeDetect()
http://lslwiki.net/lslwiki/wakka.php?wakka=llVolumeDetect

llCollisionFilter()
http://lslwiki.net/lslwiki/wakka.php?wakka=llCollisionFilter

llSetTimerEvent()
http://lslwiki.net/lslwiki/wakka.php?wakka=llSetTimerEvent

Basically, place a large cube on your parking space. Set the position and rotation of the cube equal to the ideal position and rotation of your vehicle. Drop a copy of your vehicle into the cube's contents. Add this script:

From: someone
float SECONDS_TO_WAIT = 120.0;
string NAME_OF_VEHICLE = "exact name/case sensitive";

default {
state_entry() {
llCollisionFilter(NAME_OF_VEHICLE, "", TRUE);
llVolumeDetect(TRUE);
}
collision_start(integer num) {
llSetTimerEvent(0.0);
}
collision_end(integer num) {
llSetTimerEvent(SECONDS_TO_WAIT);
}
timer() {
llSetTimerEvent(0.0);
llRezObject(NAME_OF_VEHICLE, ZERO_VECTOR, ZERO_VECTOR, ZERO_ROTATION, 0);
}
}