imitating "NOS" in vehicle problems
|
|
JR Breed
Registered User
Join date: 17 Jan 2006
Posts: 49
|
08-10-2006 10:45
Hello, Ive recently been spending a good amount of time trying to figure out how to create a "NOS" type effect in a ground vehicle. I made a HUD button that uses llApplyImpulse that works great on a avatar thats not sitting on a phyiscs enabled object. Once I sit on the physical object, the impulse is reduced to almost nothing. It produces very little Impulse if any at all.
This leads me to believe that there has to be another script put inside the phyical object to listen when the HUD button is pressed for the llApplyImpulse to work correctly. The only problem with this is, no matter how hard I try (been spending hours trying different things) to figure this out, I just dont understand how listeners work from one script to another.
It would be greatly apprecaited if someone could lead me in the right direction in understanding this more clearly. Thank you for taking the time to read this over. =)
|
|
JR Breed
Registered User
Join date: 17 Jan 2006
Posts: 49
|
08-10-2006 11:51
Just to show that I am trying to learn.... This is the HUD button script. integer NOS;
default { touch_start(integer total_number) { llMessageLinked(LINK_SET,0,"NOS", NULL_KEY); } } Here is what I think should be the listening script integer NOS;
default { on_rez(integer i) { NOS = 0; } link_message(integer sender_num, integer num, string str, key id) { llApplyImpulse(<1000,0,0>,1); integer total = llGetInventoryNumber(INVENTORY_TEXTURE); NOS = (NOS + 1); if (NOS == total); { NOS = 0; } llApplyImpulse(<1000,0,0>,1); } } Now as you can see there is a "integer total = llGetInventoryNumber(INVENTORY_TEXTURE);". I edited a texture fliper script. I dont know if Im close to figuring this out or I totally going in the wrong direction with this. Any and all help is apprecaited.
|
|
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
|
08-10-2006 11:55
Heavier object, more impulse needed. llApplyImpulse(<1000,0,0> * llGetMass(), TRUE);
_____________________
Aodhan's Forge shop at slurl.com/secondlife/Rieul/95/213/107
|
|
JR Breed
Registered User
Join date: 17 Jan 2006
Posts: 49
|
08-10-2006 12:43
Ive tried setting the number at 10000000 and it didnt make any difference. Tried what you suggested. No noticable difference even with the number set very high. Thanks for the reply Aodhan. Apprecaite it lots. =)
|
|
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
|
08-10-2006 12:47
From: JR Breed Ive tried setting the number at 10000000 and it didnt make any difference. Tried what you suggested. No noticable difference even with the number set very high. Thanks for the reply Aodhan. Apprecaite it lots. =) I've never used impulse on an avatar while sitting on a physical object, but what is sure is that if put it in the physical object you will have no problems. Just remember the llGetMass part or you'll be stuck changing the numbers too much. Avatars don't all have the same weight.
_____________________
Aodhan's Forge shop at slurl.com/secondlife/Rieul/95/213/107
|
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
08-10-2006 16:50
From: JR Breed Hello, Ive recently been spending a good amount of time trying to figure out how to create a "NOS" type effect in a ground vehicle. I made a HUD button that uses llApplyImpulse that works great on a avatar thats not sitting on a phyiscs enabled object. Once I sit on the physical object, the impulse is reduced to almost nothing. It produces very little Impulse if any at all.
This leads me to believe that there has to be another script put inside the phyical object to listen when the HUD button is pressed for the llApplyImpulse to work correctly. The only problem with this is, no matter how hard I try (been spending hours trying different things) to figure this out, I just dont understand how listeners work from one script to another.
It would be greatly apprecaited if someone could lead me in the right direction in understanding this more clearly. Thank you for taking the time to read this over. =) You want the vehicle HUD button prim in the vehicle HUD object attached to the driver avatar to communicate with the SEPARATE vehicle object that that the avatar is sitting or driving? You'll need to use llWhisper in the HUD and a listen event handler in the vehicle object. Like this for the HUD button: integer Channel = -12345; // You need to decide on this number.
touch_start (integer touches) { llWhisper (Channel, "NOS Boost!"); }
And like this this in the vehicle: integer Channel = -12345; // Must be the same as the HUD channel!
state_entry () { llListen (Channel, "NOS Boost Button", NULL_KEY, "NOS Boost!"); }
listen (integer channel, string Name, key Key, string Message) { llOwnerSay (0, "Applying NOS boost now!"); llApplyImpulse (... // Etc, apply your desired push here! }
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-10-2006 19:01
Unfortunately there is a magnitude limit of 20,000 on 'llApplyImpulse()', which means if your physical object is big enough (well massive enough) it will not be effective for you. The vehicle functions, on the other hand, seem to ignore mass completely. What you might be able to do is set the vehicle's linear motor direction to maximum (which is only 40 m/s, by the way  ), and drop the linear motor timescale to a really low value for an instant. That's probably about the best you are going to get unless you pop into non-physical status to make some 'llSetPos()' warps for a while or something (which also has its major drawbacks). The other thing you can do is hollow out all the prims on your vehicle that you can get away with to try to reduce the mass. And/or make the vehicle smaller (which isn't usually an option most would want to take).
|
|
JR Breed
Registered User
Join date: 17 Jan 2006
Posts: 49
|
08-10-2006 19:36
Thank you Angela for taken the time and posting some help and a guide. The first script was fine. The second script I get an error at "llOwnerSay (0, "Applying NOS boost now!"  ;". So I just deleted that line out and the script compiled. Gave it a shot and nothing happened. So I put in "llOwnerSay ("Applying NOS boost now!"  ;" and it compiled. No noticeable effect. I also tried using "llApplyImpulse(<1000,0,0> * llGetMass(), TRUE);" Nothing noticable. I tried putting the second script in the parent prim and then tested in a child prim. Same results. Thank you again Angela. Ill keep trying different things with what you helped me out with. I did make 1 single prim and put the script in that and made it a phyical object and sat on that to test. I did notice it move when I pressed the HUD button, but the effect was so little. The prim barely moved. Just wiggled a tiny hair when HUD button was pressed. BTW, its not a big/huge vehical. Its actually a small crotch rocket motorcycle. Also like to add, there is a place in SL where you can buy a No Mod, No Transfer "NOS" script and HUD attachment. All ya do is drop the script in the car, and wear the HUD and it works. You hit the button and you blast off in a boost of speed. So, I know its possible. Just dunno what that guy did to achive that effect with just 2 scripts.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-11-2006 02:06
Well, try modifying it to: llApplyImpulse(<20000,0,0>, TRUE); which is the maximum impulse you can apply anyway. See if that helps any.
|
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
08-11-2006 03:55
It might be llPushObject, with the target key being the vehicle itself. Like: llPushObject (llGetKey (), etc.
|