Multi passenger, different poses
|
|
Carl Greenstein
The Stickmans Alt
Join date: 14 Dec 2003
Posts: 15
|
08-22-2005 19:54
In my scripting ineptness, I have found it difficult to figure out how to make my multi passenger vehicle use different sit poses. I have one for the driver, which works fine, and another for the passenger which I can't figure out how to enable. Maybe I'm just using a retarded script or something. Anyway, I'm using the "realistic vehicle script" by Aaron Perkins and the coordinating "realistic seat" script for the seats. Heres is what the seat script looks like: //********************************************** //Title: Car Seat //Author: Aaron Perkins //Date: 2/17/2004 //**********************************************
default { state_entry() { llSitTarget(<0,0,0.5>, llEuler2Rot(<0,-0.4,0> )); }
} As you can see, theres no where to actually choose which animation to use in that seat script, it just tells you where to sit. The main car script is choosing what animation to use for the driver but not the passenger. Is there even a way to add multiple animations for different seats in a vehicle without the use of poseballs?
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
08-22-2005 20:13
Why don't you put the script and the animation into each seat?
_____________________
 Seagel Neville 
|
|
Carl Greenstein
The Stickmans Alt
Join date: 14 Dec 2003
Posts: 15
|
08-22-2005 20:15
because:
1. I dont want to give control to the passenger 2. wouldnt that be terribly innefficient 3. I dont know what to trim out and what to leave in the script if I were to try that
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
08-22-2005 21:16
From: Carl Greenstein because:
1. I dont want to give control to the passenger 2. wouldnt that be terribly innefficient 3. I dont know what to trim out and what to leave in the script if I were to try that 1. OK. I wrote jsut a sit script below. You need some sit animation, too. 2. I didn't understand why you said "terribly innefficient". It would be the easiest way, that is, enough efficient. 3. Try to use the script below and you have to write the animation's name in " " on the first line. You must put this script and your animation file into the same seat. string ANIMATION = "YOUR ANIMATION NAME"; // You have to put your animation's name in here. default { state_entry() { llSitTarget(<0,0,0.5>, llEuler2Rot(<0,-0.4,0> )); // You might need to trim out these value here. } changed(integer change) { if(change & CHANGED_LINK) { key av = llAvatarOnSitTarget(); if(av != NULL_KEY) { llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION); } } } run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) { llStopAnimation("sit_generic"); llStopAnimation("sit"); llStartAnimation(ANIMATION); } } on_rez(integer start_param) { llResetScript(); } }
_____________________
 Seagel Neville 
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-22-2005 21:56
Sorry, Seagel, that's going to have problems. One, it never STOPS the animation, so people will still be in thier sit pose whenthey stand. Second, it doesn't track who's on it, so the changed event will restart the animations whenever there's a link change (that is, when anyone else sits). And finally, if you stop the built-in sit anims, they will be restarted via a bug when the vehicle crosses a sim border. Give this one a shot: key pilot = NULL_KEY; string TheAnim = "ANIM_HERE"; // Name of the animation default { state_entry() { llSitTarget(<0.3, 0.0, 0.31>, ZERO_ROTATION); // This positions the avatar's attachment position on this prim pilot = NULL_KEY; // THis is to track who we're working with } changed(integer change) { key av = llAvatarOnSitTarget(); if (change & CHANGED_LINK) { if ( (av == llGetOwner()) && (pilot == NULL_KEY) ) // fresh sit { pilot = av; llWhisper(0, "Welcome, " + llKey2Name(pilot)); llRequestPermissions(pilot, PERMISSION_TRIGGER_ANIMATION); } else if ( (av == NULL_KEY) && (pilot != NULL_KEY) ) // Probably stand { if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) llStopAnimation(TheAnim); pilot = NULL_KEY; } } } run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) { llStartAnimation(TheAnim); } } }
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
08-22-2005 22:20
Thank you, Jillian. I realized that I was indiscreet. Sorry Carl, use Jillian's code. 
_____________________
 Seagel Neville 
|
|
Carl Greenstein
The Stickmans Alt
Join date: 14 Dec 2003
Posts: 15
|
08-23-2005 06:09
Strangely enough Jill, your script didn't work. It complied fine, but it wouldn't play the animation.  SteveR Whiplash stopped by and wrote up this script that ended up working for me. Hopefully it will help others as well. //Sitting script by SteveR Whiplash 8/23/2005 string anim = "enteranimhere";
default { state_entry(){ llSitTarget(<0,0,0.1>, ZERO_ROTATION); } changed(integer change){ if (change & CHANGED_LINK){ key sitter = llAvatarOnSitTarget(); if (sitter){ if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION && llGetPermissionsKey() == sitter){ llStartAnimation(anim); } else { llRequestPermissions(sitter, PERMISSION_TRIGGER_ANIMATION); } } else { if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION){ llStopAnimation(anim); } } } } run_time_permissions(integer perm){ if (perm & PERMISSION_TRIGGER_ANIMATION){ llStartAnimation(anim); } } }
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
08-23-2005 06:35
hmm... there seems to be no llRequestPermissions on Jillian's code. Anyway Carl, did you accomplish what you wanted? Congrats. And thank you for letting us know your successful code here. 
_____________________
 Seagel Neville 
|
|
Carl Greenstein
The Stickmans Alt
Join date: 14 Dec 2003
Posts: 15
|
08-23-2005 07:51
Indeed, things worked out wonderfully. Expect my first product from my new venture here soon!  Much thanks to the people on the forums for helpin with the scripting! 
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-23-2005 11:54
I gotta stop writing code straight to the board >.< EDIT: Fixed my script.
|
|
SteveR Whiplash
teh Monkeh
Join date: 24 Sep 2004
Posts: 173
|
08-23-2005 13:42
The script Karl posted is just what I whipped up on the spot, here's a more optimized version. // SitAnim // SteveR Whiplash
// Name of the animation. string anim = "backflip";
// Offset Position // ex: <0.0, 0.0, 1.0> = 1 meter above the object (z axis) vector offset = <0.0, 0.0, 0.1>;
// Degrees Rotation // ex: <0, 0, 45> = +45 degrees on the z axis vector deg = <0, 0, 0>;
// Pie Option Text string text = "Sit";
default { state_entry(){ llSitTarget(offset, llEuler2Rot(deg * DEG_TO_RAD)); //set the sit target llSetSitText(text); //set pie text } changed(integer change){ if (change & CHANGED_LINK){ //link change, maybe someone sat/stood up key sitter = llAvatarOnSitTarget(); if (sitter != NULL_KEY){ //someone sat down if (llGetPermissionsKey() != sitter){ //don't have perms for this person llRequestPermissions(sitter, PERMISSION_TRIGGER_ANIMATION); //get perms } } else { //someone might have stood up if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION){ //we have perms for someone.. llStopAnimation(anim); //stop the anim } } } } run_time_permissions(integer perm){ if (perm & PERMISSION_TRIGGER_ANIMATION){ //perms granted llStartAnimation(anim); //start the anim } } }
|
|
Ronin Arnaz
Registered User
Join date: 6 Jun 2005
Posts: 41
|
03-13-2007 02:08
Great script, but it doesn't work without stopping the default sit animation first. Also, you have to reset the script after stopping your animation, or problems will ensue. // Name of the animation. string anim = "INSERT_ANIMATION";
// Offset Position // ex: <0.0, 0.0, 1.0> = 1 meter above the object (z axis) vector offset = <0.0, 0.0, 0.7>;
// Degrees Rotation // ex: <0, 0, 45> = +45 degrees on the z axis vector deg = <0, 0, 0>;
// Pie Option Text string text = "Sit";
default { state_entry(){ llSitTarget(offset, llEuler2Rot(deg * DEG_TO_RAD)); //set the sit target llSetSitText(text); //set pie text } changed(integer change){ if (change & CHANGED_LINK){ //link change, maybe someone sat/stood up key sitter = llAvatarOnSitTarget(); if (sitter != NULL_KEY){ //someone sat down if (llGetPermissionsKey() != sitter){ //don't have perms for this person llRequestPermissions(sitter, PERMISSION_TRIGGER_ANIMATION); //get perms } } else { //someone might have stood up if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION){ //we have perms for someone.. llStopAnimation(anim); //stop the anim llResetScript(); } } } } run_time_permissions(integer perm){ if (perm & PERMISSION_TRIGGER_ANIMATION){ //perms granted llStopAnimation("sit"); llStartAnimation(anim); //start the anim } } }
|