Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

help make this bullet work!

LeVey Palou
Registered User
Join date: 31 Aug 2006
Posts: 131
06-22-2007 01:14
Hello all!

I have primmed a bullet to look like gunfire from a star wars style blaster. Looks great! lol, but doesnt work. when I fire it first it comes out side ways and second it doesnt project.....doesnt go anywhere. It hangs in the air sideways until it temp deletes.

Grrrr.
I am using scripts that work just fine otherwise on a bullet that is one prim. The blaster shot is a total of six, seven now that i added a cube as the parent prim in an attempt to give it orientaion. I have seen other bullets that are more than one prim so I dont think my goal is impossible.

I pulled these scripts from another gun I found and make NO CLAIM to them whatsoever. I just happen to be using them. I am gonna post them so you can see what I am working with and also a few pics of the blast.

The first two go in the gun:

*****bullet firing script*******

vector gEyeOffset = <0.0, 0.0, 0.84>;
integer velocity=100;
f()
{
vector my_pos = llGetPos() + gEyeOffset;
rotation my_rot = llGetRot();
vector my_fwd = llRot2Fwd(my_rot);
llRezObject("BLASTER SHOT TEMP", my_pos, my_fwd * velocity,my_rot,1);

}
default
{
listen(integer c, string n ,key id, string m)
{
if(llGetSubString(m,0,1)=="/v";)
{
string mess=llGetSubString(m,3,-1);
velocity-=velocity;
velocity=(integer)mess;

}
}
link_message(integer n, integer g, string m, key id)
{
if(m=="shots";)
{
f();
}
}
}
*********end*************

*******F F class 4 script******
integer z = FALSE;
integer TRIGGER_CHANNEL = 100;
string main="";
string sound1 ="Fire";
string bullet="bullet plus";
list weaponmain = ["Attachments","Bullet Type","More....","Credits"];
list attac = ["Laser","Back"];
list bt = ["Damage","Orbit","Back"];
list more=["Help File","Back"];
integer velocity=100;
integer sil;
integer newvel;
integer w;

stopall()
{
llStopAnimation("hold_r_bazooka";);
llStopAnimation("hold_r_handgun";);
llStopAnimation("hold_r_rifle";);
llStopAnimation("aim_r_bazooka";);
llStopAnimation("aim_r_handgun";);
llStopAnimation("aim_r_rifle";);
}
string owner;

checkown()
{
llListenRemove(w);
w=llListen(0,"",owner=llGetOwner(),"";);
}

default
{
on_rez(integer c)
{
checkown();
llSay(0,"For help on how to use this weapon , click me!";);
}
state_entry()
{
checkown();
}
attach(key a)
{
if(a == NULL_KEY)
{
z=FALSE;
llStopAnimation(main);
llReleaseControls();
}
else
{
checkown();
llRequestPermissions(a, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
}
}
run_time_permissions(integer a)
{
if(a > 0)
{
llStartAnimation(main);
llTakeControls(CONTROL_ML_LBUTTON,TRUE, FALSE);
}
}
control(key a, integer b, integer c)
{
if(b & CONTROL_ML_LBUTTON)
{
llSleep(0.2);
if(sil==TRUE)
llMessageLinked(LINK_SET,0,"shotss",NULL_KEY);
else if(sil==FALSE)
llMessageLinked(LINK_SET,0,"shots",NULL_KEY);
}
}
listen(integer c, string n, key id, string m)
{
if(llGetSubString(m,0,1)=="/v";)
{
string mess=llGetSubString(m,3,-1);
velocity-=velocity;
velocity=(integer)mess;
velocity/=50;
newvel=velocity*50;
llInstantMessage(owner,"The Velocity of your weapon is now "+(string)newvel);
}
else if(m=="/?v";)
{
llSay(0,"The velocity of your weapon is currently " + (string)velocity);
}
else if(m=="las";)
{
llMessageLinked(LINK_ALL_CHILDREN,0,"laser",NULL_KEY);
}
else if(m=="/na";)
{
stopall();
}
else if(m=="/ap";)
{
stopall();
llStartAnimation("aim_r_handgun";);
}
else if(m=="/hp";)
{
stopall();
llStartAnimation("hold_r_handgun";);

}
else if(m=="/ab";)
{
stopall();
llStartAnimation("aim_r_bazooka";);
}
else if(m=="/ar";)
{
stopall();
llStartAnimation("aim_r_rifle";);
}
else if(m=="/hr";)
{
stopall();
llStartAnimation("hold_r_rifle";);
}
else if(m=="/hb";)
{
stopall();
llStartAnimation("hold_r_bazooka";);
}

if(m=="/r";)
{
llResetScript();
}

if(m=="laser";)
{
llMessageLinked(LINK_SET,0,"laser",NULL_KEY);
}
if(m=="scope";)
{
llMessageLinked(LINK_SET,0,"scope",NULL_KEY);
}
if(m=="silencer";)
{
llMessageLinked(LINK_SET,0,"sil",NULL_KEY);
}
if(m=="laser_off";)
{
llMessageLinked(LINK_SET,0,"laser_off",NULL_KEY);
}

if(m=="stock_off";)
{
llMessageLinked(LINK_SET,0,"stock_off",NULL_KEY);
}
if(m=="stock";)
{
llMessageLinked(LINK_SET,0,"stock",NULL_KEY);
}
if(m=="one_clip";)
{
llMessageLinked(LINK_SET,0,"mc_off",NULL_KEY);
}
if(m=="muiltple_clips";)
{
llMessageLinked(LINK_SET,0,"mc",NULL_KEY);
}
}
touch_start(integer c)
{
llGiveInventory(owner,"help";);
}
}



**********end**********

and the bullet script that goes in the bullet:



*******shield breaker bullet script**********

//
// Winter's Shieldbreaker Bullet
// Modified from the Bolter Round
//

vector velocity;
integer shot = FALSE;
integer fade = FALSE;
float alpha = 1.0;
float damage = 100;
float hitpower = 1000000000;
float lifetime = 5;
integer push = 9999;

explode()
{
llSetStatus(STATUS_PHYSICS, FALSE);
vector vel = llGetVel() * hitpower;
llPushObject(llDetectedKey(0), vel, ZERO_VECTOR, FALSE);
llSetForce(<0,0,0>, TRUE);
llTriggerSound("Explosion", 10.0);
llMakeExplosion(20, 1.0, 5, 3.0, 1.0, "Smoke", ZERO_VECTOR);
llMakeExplosion(20, 1.0, 5, 3.0, 1.0, "Green", ZERO_VECTOR);
llMakeExplosion(20, 1.0, 5, 3.0, 1.0, "Blue", ZERO_VECTOR);
llDie();
}

nuke(key person,vector target_normalised_vector)
{
llUnSit(person);
// PUSH SOMEONE AWAY FROM YOU
//llPushObject(person,<100000000,100000000,100000000>,<100000000,100000000,100000000>,TRUE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
llPushObject(person,llPow(push,6.42)*target_normalised_vector,ZERO_VECTOR,FALSE);
// okay fine i know it's a bit excessive :P
}

default
{
state_entry()
{
llSetDamage(damage);
}

on_rez(integer start_param)
{
llSensorRepeat("",NULL_KEY,AGENT,96,PI,0.001);
llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
llSetBuoyancy(1.0);
llCollisionSound("", 1.0); // Disable collision sounds
velocity = llGetVel() * 5;
float vmag;
vmag = llVecMag(velocity);
if (vmag > 0.1) shot = TRUE;
llSetTimerEvent(lifetime);
}

sensor(integer num_detected)
{
integer x;
for(x=0;x<num_detected;x++)
{
if(llDetectedKey(x)!=llGetOwner())
{
// rez the object
if(llVecDist(llGetPos(),llDetectedPos(x)) <= 10)
{
//llRezObject("Bullet",llDetectedPos(x),<0,0,0.1>,ZERO_ROTATION,0);
if(llDetectedKey(x) != llGetOwner())
{
vector pos = <0,0,0>;
vector my_pos = <0,0,0>;
vector target_relative_direction;
vector target_normalised_vector;
pos = llDetectedPos(x); // get position of target
my_pos = llGetPos(); // get position of user
target_relative_direction = pos - my_pos;
target_normalised_vector = llVecNorm(target_relative_direction);
nuke(llDetectedKey(x),target_normalised_vector);
}
}else{
rotation rot;
vector fwd;
vector pos;
llLookAt(llDetectedPos(x),999999,0.1);
rot = llGetRot();
fwd = llRot2Fwd(rot);
pos = llGetPos();
pos = pos + fwd;
//pos.z += 0.75; // Correct to eye point
//pos.z += 0.83;
fwd = fwd * 30;
//llRezObject("Bullet", pos, fwd, rot, 0);
}
}
}
}

collision_start(integer total_number)
{
explode();
}

timer()
{
if (!fade)
{
if (shot)
{
explode();
}
}
else
{
llSetAlpha(alpha, -1);
alpha = alpha * 0.999999;
if (alpha < 0.1)
{
explode();
}
}
}
}

************end**************

And here are the pics of the blast itself:

http://i62.photobucket.com/albums/h118/lordzahms/Snapshot_024.jpg

http://i62.photobucket.com/albums/h118/lordzahms/Snapshot_023.jpg


.......Ummmmmmmmm, help!
LeVey Palou
Registered User
Join date: 31 Aug 2006
Posts: 131
06-22-2007 20:59
...

aNYONE?
Anyone?
bUELLER?
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
06-22-2007 23:51
Try this,

llRezObject("BLASTER SHOT TEMP", my_pos, my_fwd * velocity,<0.00000, 0.70711, 0.00000, 0.70711> *my_rot,1);