Jump to content

LOOKING FOR SCRIPT HELP!!


Gloverflo
 Share

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

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

Recommended Posts

Me and my wife are looking for some help with scripting.

We are looking for a script that we can be drop inside a prim giving that prim the ability to be dealt damage once hit/touched.

Example:

An avatar holding a baseball bat that can give physical damage to a prim. Once prim is hit, the prim is disappears. 

Link to comment
Share on other sites

When you swing a baseball bat, your arms only appear  to move.  The animation is an illusion, created entirely in your viewer.  As far as the physics engine is concerned, the bat cannot hit anything.  You can do what you want by writing your script to respond when your avatar collides with the prim or when it gets very close.  You might try using llGetAnimationList when you are within, say, 0.5m and then only triggering the damage response if the script detects your "swing" animation in that list, but you would have to do that in a fast timer.  Even then, I suspect it would be tricky.  If you are not a LSL scripter, I suggest posting in the InWorld Employment forum to see if a scripter is willing to try writing a custom script for a fee.

Link to comment
Share on other sites

Arguably the first and most important ability of any scripter is to figure out how to translate a high-level concept into a series of effects that can actually be acted on.

'being damaged' in my mind would probably translate to swapping textures and/or models, something that you can't just plug into any old prim and expect it to work.

On the other hand, just making a number go down every time the thing gets bumped into or touched, and destroy the object when the number is zero is fairly straight forward:

integer health = 10;

damage()
{  --health;
   llSetText((string)health,<(health<7),(health>4),0>,1.0);
   if(health==0)
   {   llDie();
   }
}
default
{
  state_entry()
  {   llSetText("",<0,0,0>,0.0);
  }
  collision_start(integer i)
  {   damage();
  }
  touch_start(integer i)
  {   damage();
  }
}

(also added some fancy text to tell you how much health the thing has.)

Another thing to keep in mind, is that for things like this you often need a whole scripted system, rather than just individual parts. if you want a baseball-bat to be able to interact with your hit-able thing, both the bat and the thing need to know the correct protocols for that interaction. Generally speaking, if scripter A writes a bat script and scripter B writes a ball script, they're not going to work together, unless both scripters have a very good idea about how the other part works (either by communicating directly with eachother, or via reasonably understandable documentation.)

I had to turn down a job for a "scanable bracelet" not too long ago, because the client couldn't seem to fathom that making such is basically impossible without knowing how it is going to be "scanned" for, or also programming each scanning device.

Edited by Quistess Alpha
  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 949 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...