Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Velocity Checking

Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-15-2007 21:55
Hello all. I been trying to figure out how I could get a working script to tell me what the velocity of my bullets are. I have done everything I can and I am stumped. I've been wondering if I have to use sensors, but I would at least like to see maybe an example of its use? I am trying to design a health or HP system that goes down based off of the bullet's velocity. This has been done before, but I am having trouble working the velocity part out. Any help would be appreciated, thanks!
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
08-15-2007 22:05
well if the target is sensing the bullet, it would probably use a volume detect, or collision_start event, and in the event do something like:

float velocity;

velocity = llVecMag(llDetectedVel(0));
Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-15-2007 22:23
You are a life saver, I figured some more things out, thank you so very much!
Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-16-2007 06:55
Problem yet again!

Ok I get the velocity figured out, I even got it to turn into an integer so I can have percise damage counting. But now I have issue...

How exactly can I take one integer and subract it's total from another?

I tried the obvious with my two integers, health and ExactVelocity

health - Exactvelocity;

Gave no effect, so now I'm pretty stumped again...
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
08-16-2007 07:36
Try:

health = health - Exactvelocity;

or

health -= Exactvelocity;
Sollie Villota
Registered User
Join date: 22 Jun 2007
Posts: 46
08-16-2007 08:29
Well dang, that was simple. THANKS!!!!