Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Building Gun, bullet error (UPDATED)

Forza Ninetails
Registered User
Join date: 3 Feb 2008
Posts: 19
05-15-2009 22:33
any gun builders here know why my bullet, on rez, doesnt move. just floats there, and sometimes the bullet will auto delete way too fast. I put a script in the bullet to kill on 10 seconds.


OK I FOUND THAT THE BULLET NEEDS TO BE PHYSICAL, BUT HOW DO I MAKE THE BULLET JUST FLOAT SLOWLY AT THE SAME Z HIGHT AND NOT FALL TO THE GROUND D:


//
// Semi Auto Script
//

float SPEED = 2.0;
integer LIFETIME = 10;

float DELAY = 0.2;

vector vel;
vector pos;
rotation rot;

integer have_permissions = FALSE;
integer armed = TRUE;
string instruction_not_held =
"Choose 'Acquire->attach->left hand' from my menu to wear and use me.";


fire()
{
if (armed)
{
armed = FALSE;
rot = llGetRot();
vel = llRot2Fwd(rot);
pos = llGetPos();
pos = pos + vel;
pos.z += 0.75;


vel = vel * SPEED;


llTriggerSound("Report", 1.0);
llRezObject("Bullet", pos, vel, rot, LIFETIME);


llSetTimerEvent(DELAY);
}
}

default
{
state_entry()

{
if (!have_permissions)
{
llRequestPermissions(llGetOwner(),
PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS);
}
}
on_rez(integer param)
{

llPreloadSound("Report";);
}

run_time_permissions(integer permissions)
{

if (permissions == PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS)
{

llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
llStartAnimation("hold_R_rifle";);
have_permissions = TRUE;
}
}

attach(key attachedAgent)
{

if (attachedAgent != NULL_KEY)
{

llRequestPermissions(llGetOwner(),
PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS);
}
else
{

if (have_permissions)
{
llStopAnimation("hold_R_rifle";);
llStopAnimation("aim_R_rifle";);
llReleaseControls();
llSetRot(<0,0,0,1>;);
have_permissions = FALSE;
}
}
}

control(key name, integer levels, integer edges)
{

if ( ((edges & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON)
&&;((levels & CONTROL_ML_LBUTTON) == CONTROL_ML_LBUTTON) )
{

fire();
}
}

touch_end(integer num)
{

if (have_permissions)
{
; }
else
{
llWhisper(0, instruction_not_held);
}
}

timer()
{

llSetTimerEvent(0.0);
armed = TRUE;
}

}
DancesWithRobots Soyer
Registered User
Join date: 7 Apr 2006
Posts: 701
05-15-2009 22:38
This is the wrong place for this sort of question. But is your bullet a physical object?
_____________________
"Two lives I have.
One life I live. One life I dream.
In dreams I remember the better in me."
Forza Ninetails
Registered User
Join date: 3 Feb 2008
Posts: 19
05-15-2009 22:47
From: DancesWithRobots Soyer
This is the wrong place for this sort of question. But is your bullet a physical object?

is now. now i just need it to not drop when i fire it. i want it to slowly move as it flys
Dekka Raymaker
thinking very hard
Join date: 4 Feb 2007
Posts: 3,898
05-16-2009 03:43
ask this question in Script Tips forum
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
05-16-2009 03:51
Or start with the Popgun in the Library.
_____________________
Archived for Your Protection
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-16-2009 15:57
assuming you have a velocity that'll continue forward movement, you need to set the buoyancy of the bullet so it doesn't drop. it does after all have mass.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -