Jump to content

Multiple seats in ship priority


Kelborn Denfu
 Share

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

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

Recommended Posts

Hey guys, I've been building/modding a space ship and I keep running into a problem. Every time I add chairs / couches inside, my avatar sits on them instead of the pilots seat (even when I am selecting the pilots seat directly) making it impossible to fly.

I can't view the script in the non-pilot chairs, but i've tried 2 separate chairs with separate scripts and the same problem occurs. 1 of the chairs I tried was actually part of the originally purchased ship before I started moding it.

Any suggestions would be appreciated.

Here is the script in the pilots seat:

list primsetting = [PRIM_TYPE,PRIM_TYPE_SPHERE, PRIM_HOLE_CIRCLE, <0.65, 0.85, 0.0>, 0.90, <0.0, 0.0, 0.0>, <0.35, 0.90, 0.0>];
list primsize = [PRIM_SIZE,<1.100,1.310,2.250>];
default
{
    state_entry()
    {
       list check = llGetPrimitiveParams([PRIM_SIZE]);
        if(llList2String(check,0) != llList2String(primsize,1))
        {
llSetPos(llGetPos() + <0,0,1>);
}
llSetPrimitiveParams(primsetting + primsize);
        llSetSitText("Get in");
        llSitTarget(<0.0,0.0,-0.6>, <0,-0.2,0,1>);
        llSetCameraEyeOffset(<-35.0, 0, 8.0>);
        llSetCameraAtOffset(<0.0, 0.0, 1.0>);
    }
    changed(integer change)
    {
        if (CHANGED_LINK)
        {
            key agent = llAvatarOnSitTarget();
            if (agent)
            {
            llMessageLinked(LINK_SET,0,"pilotsit",agent);
            }
            else
            {
            llMessageLinked(LINK_SET,0,"pilotunsit",agent);
                llUnSit(agent);
            }
        }
       
    }
}

Link to comment
Share on other sites

You've evidently messed up the link order, possibly making one of your new seats the root prim.  Be very careful when you add prims to a linkset.  Changing the link order can affect more than just the sit targets.

You may want to take a look at llLinkSitTarget and llAvatarOnLinkSitTarget if you have more than one seat in your linkset.

Link to comment
Share on other sites

The seats are used in the reverse order you linked them - if you sit on the ship. 
That means if you sit on the ship you will end in the seat that was linked last.
Solution - unlink pilot seat and link again - don't make it the root.

But you can always sit on any seat directly. That definitely works - no discussion :) - I do that daily.

If you have problems that may be a bounding box of a sculptie or a mesh that probably prevents you hitting the seat.

 P.S. that is of course only for seats that have a sit target. And if you use scripted seats that are not meant to be linked ... hmmm ... anything can happen. :D

Link to comment
Share on other sites

What's strange is that even when I walk right up to the pilots seat and right click > sit on it directly, it still boots me to the back of the ship onto a chair instead (occasionally I'll sit on the pilot seat for a split second before getting booted, and can actually still fly the ship from the back, or at least the camera angle adjust as if I was flying it). When I get home I'll try to link the pilot seat last and see if that works, otherwise I'll try to put a different pilot seat in I guess?

 

Thanks for the suggestion, I'll post the results as soon as I try it out!

Link to comment
Share on other sites

Right.  BTW, llLinkSitTarget gives you a handy way to discourage sitting anywhere except in designated seating.  Look at the very last note in the caveats for llLinkSitTarget :

If an object has multiple seats (each seat has a script that sets a sit target with llSitTarget, or the linkset has a script that assigns several llLinkSitTargets), the following method determines which sit target an avatar ends up at:

  • If the prim that is clicked on has a sit target and that sit target is not full, that sit target is used.
  • If the prim that is clicked on has no sit target, and one or more other linked prims have sit targets that are not full, the sit target of the prim with the lowest link number will be used.

Paying particular attention to the second bulleted point, notice that if you have, say, three idenitified sit targets and all three seats are empty, sitting anywhere at random (except on one of the three seats) will land you on LinkSitTarget(1).  If LinkSitTarget(1) is full, it will land you on LinkSitTarget(2).  If LinkSitTarget(2) is full, it will land you on LinkSitTarget(3).  But, suppose that you only want people to sit in the first two seats?  You can assign LinkSitTarget(3) to a hidden transparent prim somewhere and tell your script

if (llAvatarOnLinkSitTarget(3)){    llUnSit(llAvatarOnLinkSitTarget(3));}

Then, if someone sits at random, he can only be seated in the first two seats unless seat 3 is full, but that's why you make seat 3 a hidden prim.  Nobody will ever sit on it deliberately because they don't know that it's there.  :smileywink:

Just be sure that you link your prims sanely so you know which one is which.

 

Link to comment
Share on other sites

Dunno if this will help or not, i use this for bleachers and such.

This function checks for prims named "seat"

 

// Will check for name of prims called  "seat" when linked to other primsinteger lNum;string lName;list seats;vector offset = <0.4,0,0.3>;        // x , y , z position of the sit targetvector Vrot = <0.0 , 90.0, 0.0>;   // vector of the rotation of sit targetrotation Srot  = ZERO_ROTATION;setSeats(){     llSetClickAction(CLICK_ACTION_SIT);      integer prims=llGetNumberOfPrims();         integer x;      for(x = 1; x <= prims;++x)      { lName = llGetLinkName(x);               list my_list = llParseString2List(lName,[" "],[","]);                if (llList2String(my_list,0) == "seat")         {  seats += x;                   }        }              // to change rotation, un-comment and use this, and change Vrot above,                //  Vrot = *= DEG_TO_RAD;           //  Srot = llEuler2Rot(Vrot);                            integer len = llGetListLength(seats);      integer n;      for(; n < len;++n)      { integer i = llList2Integer(seats,n);        llLinkSitTarget(i,offset,Srot);             }    }default{     state_entry()    { setSeats();    }}
Link to comment
Share on other sites

Update:

Linking the seat last didn't work, so I figured it was the non-pilot seats that was causing the problems (they are just meant to be furnature afterall, probably not meant to be linked).

I pulled the scripts out of them and just dropped regular poseballs ontop, but the problem still persists, I just go to the poseballs now instead of the pilots seat.

I also tried moving the pilots seat to an open area so nothing was blocking the way and stood directly ontop of it, but I still get bumped to the back.

Finally I rezzed a new pilot seat and flight script cube by themselves, made sure it was working, then linked it in to the ship and Ta Da! It works now! I fly the ship by default, but if i directly select a poseball, I sit there instead. Thanks a lot for the help, everyone!

Link to comment
Share on other sites

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

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

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...