Jump to content

Patch Script to convert land-based plane to seaplane


You are about to reply to a thread that has been inactive for 2228 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello!

I have recently been attempting to convert one of my land-based planes into a seaplane. I have successfully installed floats on it, but find that my aircraft sinks like a rock. The aircraft in question is an mm_MXS-R 1.2 by Michie Yokosuka, and the mm_MXS-R_script_1.2 it contains is marked as 'no modify'.

Therefore, I have since been trying to learn how to create a patch script which I can insert into my plane's root prim, that will allow my plane to float on water. Based on past forum posts, I have crafted the following script, but it does not seem to work:

default
{
    state_entry()
    {
        vector pos = llGetPos();
            float altitude_sea = (pos.z - llWater(ZERO_VECTOR));
            if (altitude_sea > 0 )
            {
                llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );
                llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0 ); 
                llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 10 );
                llSetVehicleFloatParam( VEHICLE_BUOYANCY, .977 );
            }
            else if (altitude_sea < 0 )
            {
                llSetVehicleFloatParam( VEHICLE_HOVER_HEIGHT, 0 );
                llSetVehicleFloatParam( VEHICLE_HOVER_EFFICIENCY, 0.2 ); 
                llSetVehicleFloatParam( VEHICLE_HOVER_TIMESCALE, 0.4 );
                llSetVehicleFloatParam( VEHICLE_BUOYANCY, 1.0 );
            }
    }
}

I have also installed VICE on the plane via RCX's free installer program, and that process has been a resounding success. So currently the additional scripts installed on the plane's root prim are:

  1. RCX VICE+TCS LISTENER
  2. VICE Bomb Control v1.2.0
  3. VICE+TCS ALA sensor
  4. The following VICE Patch:
/**
 * @author: reconx86 (RCX Productions)
 *
 * @license: You are allowed to share this script full-perm with others and even use it in your own projects.
 * But do not sell the script seperately nor as part of a script package.
 *
 * This script is made to make any incompatible mod-vehicle work with VICE.
 * It's not recommended to use unless you really can't script the vehicle at hand, this script may cause glitches and interfere with the main-script functions.
 */
integer seated;
key owner;
integer links;
integer prevLinks;

default
{
    state_entry()
    {
        owner = llGetOwner();
        prevLinks = llGetNumberOfPrims();
    }
    
    changed(integer change)
    {
        if (change & CHANGED_OWNER) {
            owner = llGetOwner();
        }
        if (change & CHANGED_LINK) {
            integer link_nr;
            links = llGetNumberOfPrims();
            for (link_nr = 0; link_nr <= links; link_nr++) {
                if (owner == llGetLinkKey(link_nr)) {
                    if (!seated) {
                        llMessageLinked(LINK_SET, seated = TRUE, "seated", owner);
                    }
                    prevLinks = links;
                }
            }
            if (seated && links == prevLinks - 1) {
                llMessageLinked(LINK_SET, seated = FALSE, "seated", NULL_KEY);
            }
            prevLinks = links;
        }
    }
}

I would really appreciate it if someone could help me perfect my seaplane patch script! :)

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2228 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...