Introduction to Weapons: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Clockwork
No edit summary
 
>Clockwork
No edit summary
(No difference)

Revision as of 16:40, 25 June 2007


This is a Basic, Weapon related tutorial.


Introduction

This is a basic beginner's introduction to weapons. It explains to you the structure of weapons and why they work.

Weapon Structure

The structure of a weapon looks something like this.

[Tool Name]
  |-Sounds
  |-Weapon Script
  |-Projectile Script
  |-Local Gui
  |-Handle
  |   |-Mesh

The next few sections explain what this is.

Tool

The tool is the big thing at the top. It goes into people's backpacks and shows up in their screen. Tools have scripts, parts, and meshes that direct what the tool does. The only thing you really need to change in the tool is the name and the GripPos if you're trying to change how the player grips the weapon.

Handle

The handle is the part that contains the mesh. Meshes can't be put into the game except under a part that defines its general shape (called the bounding box). The handle is the part that has a mesh in it that shows what the weapon looks like. Each weapon has its own mesh that it uses. Usually, if you want to make a new weapon, you should copy another existing weapon and change the script only so that you don't have to copy the mesh URLs and GripPos on the tool over.

Weapon Script

The weapon script is usually called something related to the weapon name, such as "Server Launcher" for the Rocket Launcher and "Slingshot" for the slingshot. It dictates what the weapon does when its fired.

Projectile Script

The projectile script is attached to the projectile and handles what the projectile does when it flies out of the weapon. Usually it just handles what happens when it hits something.

Local Gui

The Local Gui is a LocalScript that deals with cursors on the client. It changes the cursor to a target when you switch to a weapon and adds the "reloading" text onto the cursor after firing. Usually there is nothing that needs to be changed in this script except for the reload time.