TTT converting addon/swep

I followed the “custom weapons” tutorial from the TTT website so please don’t give me that link. I don’t need help with the lua coding it I THINK. My confusion with converting addons and sweps is i don’t understand where i put the materials, sounds, and models.

I don’t work with addons typically but you setup a directory inside of the addon like this:

addons/addonname/content/ - and then all the content goes here.
addons/addonname/lua - for lua and what not obviously.

So would sweps be the same? I want the players be able to purchase it during the game

If you’re adding it to the gamemode itself it should be something like this

gamemode/ttt/entities - this is where the swep code goes
gamemode/ttt/content - this is where you place your new models/materials/sounds.

As for adding weapons to the gamemode I can’t help you there, I’ve never worked with TTT.

Ok well i’ll try that again

Full guide on how to add custom weapons to TTT

i got the coding part, i was confused on where to put the contents of the addon/swep like sounds and particles. last time i checked i don’t think it says where to put that stuff. I was tried some different ways and i couldn’t get it to come up in the traitor menu so i came here for help. so far no luck

It’s all on that webpage I posted:


SWEP.EquipMenuData = {
   type = "Weapon",
   desc = "Example custom weapon."
};
SWEP.CanBuy = { ROLE_TRAITOR }
SWEP.Icon = "VGUI/ttt/icon_myserver_ak47"

I KNOW i already have that, but it’s not working. I was wondering if it was because it had a bunch of other stuff that terrortown folder didn’t have. Like particles and sounds do i just throw it in the content folder??

Yes.

addons/addonname/sound
addons/addonname/models
addons/addonname/materials

k thats all i needed to know thanks

[editline]22nd August 2012[/editline]

Still doesn’t work, i’m pretty sure you don’t put it in the addon folder. I’m trying to convert a swep into a custom weapon that you can buy as a traitor. I put the materials, models, and sound in the srcds/orangebox/garrysmod/materials…
srcds/orangebox/garrysmod/models…
srcds/orangebox/garrysmod/sound…
folder and the shared.lua in the
srcds/orangebox/garrysmod/gamemodes/terrortown/entities/weapons/weapon_ttt_custom

is there anything i’m missing or that i’m putting them in the wrong spot

Did I not say

Gamemodes/TTT/content?

If you need one custom weapon to be fixed just post your shared.lua I can’t help you if I don’t see any code. Also, don’t use garrysmod/ as a base folder for materials, models and sounds it’ll become cluttered. Unless you are using a Fast-DL which requires you to place then in the base garrysmod/ folder. Aside from that post your shared.lua.

I’ve been going back and forth from 2 forums about this so i’m trying different things. I tried the gamemodes/ttt/content and put the materials/models/sound in there but it didn’t work for me. Unless i did it wrong which is a possibility, i’ll try it again.


// Variables that are used on both client and server
if SERVER then
	resource.AddFile("materials/VGUI/weapons/weapon_jihadbomb.vmt") -- Suicide Bomb
end
SWEP.EquipMenuData = {
   type = "Jihad Bomb",
   desc = "Left-Click to explode
Right-Click to taunt"
};
SWEP.Base	= "weapon_tttbase"

SWEP.Kind = WEAPON_EQUIP1
SWEP.CanBuy = { ROLE_TRAITOR }

SWEP.Author			= "Stingwraith"
SWEP.Contact		= "stingwraith123@yahoo.com"
SWEP.Purpose		= "Sacrifice yourself for Allah."
SWEP.Instructions	= "Left Click to make yourself EXPLODE. Right click to taunt."
SWEP.DrawCrosshair		= false

SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true		// Spawnable in singleplayer or by server admins

SWEP.ViewModel			= "models/weapons/v_jb.mdl"
SWEP.WorldModel			= "models/weapons/w_jb.mdl"

SWEP.Primary.ClipSize		= -1
SWEP.Primary.DefaultClip	= -1
SWEP.Primary.Automatic		= false
SWEP.Primary.Ammo			= "none"
SWEP.Primary.Delay			= 3

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo			= "none"





/*---------------------------------------------------------
	Reload does nothing
---------------------------------------------------------*/
function SWEP:Reload()
end   

function SWEP:Initialize()
    util.PrecacheSound("siege/big_explosion.wav")
    util.PrecacheSound("siege/jihad.wav")
end


/*---------------------------------------------------------
   Think does nothing
---------------------------------------------------------*/
function SWEP:Think()	
end


/*---------------------------------------------------------
	PrimaryAttack
---------------------------------------------------------*/
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire(CurTime() + 3)

	
	local effectdata = EffectData()
		effectdata:SetOrigin( self.Owner:GetPos() )
		effectdata:SetNormal( self.Owner:GetPos() )
		effectdata:SetMagnitude( 8 )
		effectdata:SetScale( 1 )
		effectdata:SetRadius( 16 )
	util.Effect( "Sparks", effectdata )
	
	self.BaseClass.ShootEffects( self )
	
	
	// The rest is only done on the server
	if (SERVER) then
		timer.Simple(2, function() self:Asplode() end )
		self.Owner:EmitSound( "siege/jihad.wav" )
	end

end

--The asplode function
function SWEP:Asplode()
local k, v
	
	// Make an explosion at your position
	local ent = ents.Create( "env_explosion" )
		ent:SetPos( self.Owner:GetPos() )
		ent:SetOwner( self.Owner )
		ent:Spawn()
		ent:SetKeyValue( "iMagnitude", "250" )
		ent:Fire( "Explode", 0, 0 )
		ent:EmitSound( "siege/big_explosion.wav", 500, 500 )
		
		self.Owner:Kill( )
		self.Owner:AddFrags( -1 )
 
		for k, v in pairs( player.GetAll( ) ) do
		  v:ConCommand( "play siege/big_explosion.wav
" )
		end

end


/*---------------------------------------------------------
	SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()	
	
	self.Weapon:SetNextSecondaryFire( CurTime() + 1 )
	
	local TauntSound = Sound( "vo/npc/male01/overhere01.wav" )

	self.Weapon:EmitSound( TauntSound )
	
	// The rest is only done on the server
	if (!SERVER) then return end
	
	self.Weapon:EmitSound( TauntSound )


end

[editline]22nd August 2012[/editline]

Oh and what about the resource file?