Jump to content

Unsit on Collision


Recommended Posts

I enjoy putting vehicle rezzers in my builds (e.g., quad rezzer in a desert build or jetski rezzer in a tropical island build). The problem is that there are always people who abuse the vehicles and drive them all over the builds (e.g., quad vehicle into structures or jetski all over the islands). 

In order to address this issue, I was thinking about creating an invisible prim with a script that would unsit avatars from vehicles if a collision is detected. Vehicles are no mod, so the script has to be in the invisible prim. Is this possible? If so, how should this script be written? I have not looked into LSL for over 12-13 years, and was never proficient anyways, so please be gentle with me.

If I understand llVolumeDetect correctly, if I set a prim to llVolumeDetect(TRUE), the prim will behave as if it was phantom and an avatar passing through this prim will trigger collision_start and collision_end events.

Using collision_start event, it is my understanding that we can use llGetAgentInfo to make sure that the avatar is sitting on an object (i.e., the vehicle) and llDetectedKey will return the UUID of the avatar that triggered the event passing through the prim.

llUnSit takes a user id as input - which I assume is the UUID returned from llDetectedKey above - and works if the avatar is over land owned by the scripted object's group the owner has land rights for (paraphrasing from the LSL wiki).

Now, how do I glue this together? Am I missing something? Would the community be able to help me put this together? Hope it is something very easy and simple for all the smart knowledgeable people here. :)

 

Link to comment
Share on other sites

I think you should set up no-vehicle zones and use a central scripted object to monitor if a vehicle have entered said areas and unsit everyone sitting on it with a message they have entered a no-vehicle area.

Putting collision scripts in everything would consume far more resources, especially with all the accumulated idle script timing when one script for the whole region will work.

llUnsit() can work remotely as moderation but requires the host object to be owned by the same owner as the land.

When I operated multiple sandboxes, we required users to use a vehicle platform instead of the ground floor, in-which, people were unsat when they tried to use vehicles that output a detectable velocity, which physical and KFM vehicles do.

  • Like 1
Link to comment
Share on other sites

53 minutes ago, Lucia Nightfire said:

I think you should set up no-vehicle zones and use a central scripted object to monitor if a vehicle have entered said areas and unsit everyone sitting on it with a message they have entered a no-vehicle area.

If I understand the suggestion correctly, llSensorRepeat should be used, which will create a sensor event. Did I get that right?

In the sensor event, use the same logic as I mentioned in my original post in the collision_start event.

What is an acceptable rate to use with llSensorRepeat, which will not severely impact region performance? For instance, is 1.0 second rate acceptable, or will it cause too much lag?

58 minutes ago, Lucia Nightfire said:

Putting collision scripts in everything would consume far more resources, especially with all the accumulated idle script timing when one script for the whole region will work.

In my original plan, I was envisioning using the llVolumeDetect script in 4 prims (or 1 square prim hollowed out), which would form a virtual wall around all the structures I want to protect. I'm not planning on dropping the script into every object in my build.

How would my envisioned llVolumeDetect approach compare to the llSensorRepeat one? For my intended purpose, sensing every 10 or 15 seconds would not be acceptable, especially when I expect llVolumeDetect to instantaneously register the collision_start event.

1 hour ago, Lucia Nightfire said:

llUnsit() can work remotely as moderation but requires the host object to be owned by the same owner as the land.

No problems concerning land ownership.

Link to comment
Share on other sites

For starters, looks like you need a jetski that won't travel on land. That's not hard to do, but you need access to the code. If you've above water level, turn off all thrust. As with a real jet-ski, you can run it up onto the beach, but not very far.

There's a full-perm jetski on Marketplace for L$500 from a well-regarded creator, so you can do that if you have to.

(Looking at jet skis, there are lots of them, but many are no longer supported, with the inworld store gone.)

  • Thanks 1
Link to comment
Share on other sites

it depends on how many avatars you expect to collide with the barrier, whether that be riding on rezzed vehicles or just walking about

if you expect many avatars then Lucia's method is the way to go. If there are fewer avatars expected then the collision barrier will be ok

if you go with collision barrier (and assuming that only your vehicles can be rezzed) then rezz a barrier when a vehicle is rezzed. Delete the barrier when no vehicles are rezzed

 

  • Thanks 1
Link to comment
Share on other sites

How do we tell if an avatar is driving a vehicle? I tried using llGetAgentInfo but it is not working. I thought that AGENT_ON_OBJECT would indicate that the avatar is on a vehicle. Should I use a different function? If so, which one?

When I'm not on a vehicle, llGetAgentInfo in the script below correctly indicates that I have attachments, I'm scripted and I'm walking (as an example).

[14:16] Object: The agent: has attachments | scripted | walking | 

However, when I'm on a vehicle (a quad bike), llGetAgentInfo in the script below does not return anything. What am I doing wrong?

[14:18] Object: The agent: 

Here is the script - which I dropped on a prim - that I'm using to figure out how to detect if an avatar is driving a vehicle:

default
{
    state_entry()
    {
        llVolumeDetect(TRUE);
    }

    collision_start(integer number)
    {
        llSay(0, "Detected!");
        llSay(0, (string)number);
        llSay(0, "Key of avatar colliding: " + (string) llDetectedKey(0) );
        integer agentInfo = llGetAgentInfo(llDetectedKey(0));
        string out = "The agent: ";
        if(agentInfo & AGENT_ALWAYS_RUN)
            out += "running | ";
        if(agentInfo & AGENT_ATTACHMENTS)
            out += "has attachments | ";
        if(agentInfo & AGENT_AWAY)
            out += "away | ";
        if(agentInfo & AGENT_BUSY)
            out += "busy | ";
        if(agentInfo & AGENT_CROUCHING)
            out += "crouching | ";
        if(agentInfo & AGENT_FLYING)
            out += "flying | ";
        if(agentInfo & AGENT_IN_AIR)
            out += "in air | ";
        if(agentInfo & AGENT_MOUSELOOK)
            out += "mouselook | ";
        if(agentInfo & AGENT_SCRIPTED)
            out += "scripted | ";
        if(agentInfo & AGENT_SITTING)
            out += "sitting | ";
        if(agentInfo & AGENT_TYPING)
            out += "typing | ";
        if(agentInfo & AGENT_WALKING)
            out += "walking | ";
        if(agentInfo & AGENT_ON_OBJECT)
            out += "on object ";
        out += "\n";
        llSay(0, out);
    }
}

Edited by Echelon Alcott
Link to comment
Share on other sites

when agent can only be on your rezzed vehicle (and vehicle is third-party no-mod) then capture the uuid of the rezzed vehicle in the rezzer

http://wiki.secondlife.com/wiki/Object_rez

1) rez the wall from the rezzer (if it isn't already)

2) pass the vehicle uuid to the wall

3) when the vehicle hits the wall then return the vehicle object

http://wiki.secondlife.com/wiki/LlReturnObjectsByID

 

the premise being that you want to restrict the vehicle

  • Thanks 1
Link to comment
Share on other sites

5 minutes ago, Mollymews said:

when agent can only be on your rezzed vehicle (and vehicle is third-party no-mod) then capture the uuid of the rezzed vehicle in the rezzer

http://wiki.secondlife.com/wiki/Object_rez

1) rez the wall from the rezzer (if it isn't already)

2) pass the vehicle uuid to the wall

3) when the vehicle hits the wall then return the vehicle object

http://wiki.secondlife.com/wiki/LlReturnObjectsByID

 

the premise being that you want to restrict the vehicle

Thanks, Mollymews.

Unfortunately the rezzer is no mod.

Link to comment
Share on other sites

18 minutes ago, Echelon Alcott said:

Unfortunately the rezzer is no mod.

Then write your own rezzer. a 'Touch to rez something in my inventory' script is almost trivial. slightly less trivial if you want to make sure it doesn't rez things on top of each other (easier if those things are mod and can be told to die if they're in the way) but still doable.

Link to comment
Share on other sites

15 minutes ago, Echelon Alcott said:

Unfortunately the rezzer is no mod.

you might want to look at getting a rezzer script and try to make your own. Google on keyword: LSL REZZER.  There are quite a few opensource rezzer scripts

from the conversation I am assuming that you have surfboard/jet ski/paraglider like vehicles, bought as a package - rezzer + vehicle(s)

if so then most times the vehicles can be copied from the provided rezzer to your inventory

when so then make your rezzer and stick the vehicles in it

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...