HOME GAMES MISC

How to create a weapon for ttt

Folder Structure

Your workspace folder (Where you can throw everything thats not supposed to be in the final addon for easy access)
- ttt_weaponname (all lower case, _ instead of spaces)
- - lua (This is where the code goes)
- - - weapons (Specifying that youre making a weapon)
- - - - ttt_weaponname.lua (Is also sometimes called shared.lua)
- - materials (This is where textures go)
- - - vgui
- - - - ttt
- - - - - icon_uniqueidentifier_weaponname.vtf (The cause of death / shop icon. Has to be a unique name.
If two weapos happen to share an icon name, the server just uses the one it happens to download first for both.
This warning can also be found inside the example lua.)
- - - - - icon_uniqueidentifier_weaponname.vmt (LOOK UP WHT THIS DOES!!!)

Lua File

A weapon is usually contained to a single lua file.

We have created this example.lua as an easy starting point
(Inspired by the ttt.com AK47 template, and the Walther 2000).

Some more unique functions need extra code snippets.
(IF you want to write them yourselve, look at ttt_weapon_base. It has all the basic functions you can override in your own weapons lua file.)
• Adjustable Zoom (Already included in example.lua)
• Adjustable Cone While Aiming (Already included in example.lua)
Sniper Scope
Burst Fire (Works, but still needs to be cleaned up)

Creating a Shop Icon

Shop icons are often just a picture of the weapon in front of a colored background.
The background files are available on ttt.com, but the .psd file breaks if you dont use photoshop.
Thats why we decided to just host the background images here:
Blue background for ttt weapons displayed in the shopRed background for ttt weapons displayed in the shopYellow background for ttt weapons displayed in the shopGreen background for ttt weapons displayed in the shop
• Blue is used for every weapon and item.
• Red is only used for passive effects that never touch your inventory.
• We are unsure what Yellow and Green stand for???

Converting the finished shop icon

We are going to convert our shop icon into a .vtf file to ensure that gmod can scale the image down when necessary.
Just download VTFEdit from the archived nemesis website (yes, this is also where the valve dev wiki will lead you)
and import your png.

The ttt2 doc reccomends these settings:
add alt text!!!
• Were using DTX5 because it supports transparency while still being a smaller format.
• Cubic Resize Filter and Mipmap Filter seem to be the setting base weapons use?
• Our image size is 512px, so it will also be our maximum size.
• Sharpen Medium also seems to be what other base weapons use?

Links:

Bluesky Icon My Bluesky | Twitch Icon My Twitch | Bat Icon My GFs page ♥