Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

i built a gun how do i script it to shoot??????

dragon Kitsune
Registered User
Join date: 4 Aug 2006
Posts: 6
08-08-2006 15:50
i need to no how to script a gun to shoot
dragon Kitsune
Registered User
Join date: 4 Aug 2006
Posts: 6
y wont n e 1 post help??????????????????????????
08-08-2006 15:55
y wont n e 1 post help??????????????????????????
Goapinoa Primeau
Addict
Join date: 29 Jun 2006
Posts: 58
08-08-2006 16:02
What you need to do is get a script for the gun,

and one for the bullet....

you need to design and build the bullet

and in need to be in the contents of the gun.

Theres some free gun scripts lying around if you have a search but basically it needs to do the following...

Rez the bullet in response to a mouse command, apply impulse to bullet to send it shooting away..


Off to find you an example,

---
http://secondlife.com/badgeo/wakka.php?wakka=ExampleGun

Heres a link to some example scripts, with one for the gun and one for the bullet.

A few points important !

Make sure your bullets are setup so they kill themselves after a certain amount of time.
Best is to make them temp-on-rez, that way you dont have to worry about the taking up prim space or deleting them because they'll delete themselves after a minute of being rezzed. These precautions are already built into the example gun scripts i linked too above.

BTW,

I wonder if This thread is quiet because people dont like guns too much, be sure to keep practive in a combat sandbox, and you might want to think about building in and on/off switch for the sound effects, this makes testing easier on your own patch's of land without disturbing the neighbours :)
dragon Kitsune
Registered User
Join date: 4 Aug 2006
Posts: 6
dont know what to do
08-08-2006 16:28
i added the scripts to the bullet anmd gun but it says bullet not found shot not found what do i do????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? and what rez mean???????????????????????
Goapinoa Primeau
Addict
Join date: 29 Jun 2006
Posts: 58
08-08-2006 16:41
Rez means to create - i.e when you drag someting from your inventory, or when an object like a gun, creates a bullet from its own contents.

Your script is looking for things called bullet and, whatever the other one was.

'shot' is a sound effect built into the script from when it was first written, you either have to find a sound effect to use and add it to the contents ofyour gun and change the script so it calls for your sound instead of the one it is currently looking for. Or delete the lines of code that call for the sound altogether and you will have a gun wilth a silencer :)

the cant find bullet, is because you it cant find the item bullet in your guns contents.

did you do what i said earlier

make sure the contents of the gun contains the object 'bullet'.

if you have then the problem is just in the name, like maybe the script is trying to rez an object called 'bullet' and your object is called 'Bullet' (note capitols)

looking at the script again i can see that the bullet in the gun must be named Bullet, with a capitol B.

By the way, thank you for your prompt response
dragon Kitsune
Registered User
Join date: 4 Aug 2006
Posts: 6
ok so i got the bullet down
08-08-2006 16:46
tyvm
dragon Kitsune
Registered User
Join date: 4 Aug 2006
Posts: 6
08-08-2006 16:47
so how i delete or find sound thingy????????????????????????????????????????????????????
Goapinoa Primeau
Addict
Join date: 29 Jun 2006
Posts: 58
08-08-2006 17:04
So it shoots... cool

Ok well ifyouve got a goos sound effect in your iventory, add it to the guns contents and rename it to to be what the script is looking for, or if you havent delete the lines of code that call for the sound from the gun script

these lines are

this whole section from the bit that start with veryify inventory

if (llGetInventoryKey(gShotSound) != NULL_KEY) {
gEnableSound = TRUE;
} else {
gEnableSound = FALSE;
say("sound not found: " + gShotSound);
}

and from a bit lower down, 2 lines below where it says //mouse release

if (gEnableSound) llTriggerSound(gShotSound, 1.0);

delete that line too,

save your scripts and you should be ready!

np


----
**

integer gBulletDamage = 50; // Passed to the bullet script via the rez param

this line of code in your gun script decides how much damage the bullet will do. this only works on land with combat/health levels enabled, you can see this if you get a heart in the menu-bar when your on the land.

Change the number to 100 to kill with one bullet, max health is 100 so a bullet with Damage of 10 would take 10 bullets to kill, set it too 1 and you will have to fire 100 bullets to kill. See what i mean?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-08-2006 20:27
I've heard a place called Yadni's (I think that's right) has a bunch of free (or really cheap) weapons and things you can modify and tear apart. You might look there.
Thrash Misfit
Registered User
Join date: 8 Jun 2006
Posts: 16
08-08-2006 23:09
Wow. I'm wondering if this guy is for real or a troll.
Willford Cunningham
Builder of many things.
Join date: 1 Jul 2004
Posts: 8
08-09-2006 13:45
knowing the type ... more than likely for real.

which is kinda sad, but typical.
Meghan Eldrich
Registered User
Join date: 27 Mar 2006
Posts: 7
08-09-2006 16:56
now no doubt he'll go off and make a boat load of cash on another stolen freebie script.. =)
Goapinoa Primeau
Addict
Join date: 29 Jun 2006
Posts: 58
08-09-2006 18:28
oh come one, be nice, he's just enthused, and a bit rude.

I remember my first days in SL, got my first free gun pretty quick caused some mayhem in Abbots Aerodrome.

Dear Mr Terra,

I have long since been barred from you establishment and should like to return to see you creations. I've heard you got some great stuff and freebies too which i can no longer access due to my initial annoying stupidity with guns and bombs in your office.

I've cant even remember how much of an ***ka i was being with my brand new avatar and new found G14 automatic 'say help for notecard' blaster.

Needless to say I now realise that SL is not one huge opportunity for shooting games and have since discovered that guns are probably the least useful, least imaginative, most common, thing for people to make out of tools that can make almost anything.

Despite repeat petitions you have refused to allow me access to your most highly regarded of aerodromes, obviously you like many others, really get wound up by the use of weapons in SL outside of the Designated Combat Zones.

Having seriously lost out on visiting Abbots through my stupidity I have taken it upon myself to warn others against this possible fate an hope to secure in this some measure of redemption for my previous actions.

By the way, Ill gladly pick all the anoying little bits of shrapnel out of your wallpaper if it helps my cause.

Utmost Sincerity

Goapinoa Primeau