General > Developers Corner

Pointshop - Adding Trails

<< < (4/8) > >>

Zmaster:
Since nobody can find a problem with the info I provided, I'm gonna post everything I can think of that is related to the trail.

Locations of the files:
ZmaSaw.vmt and ZmaSaw.vtf:
C:\GMOD\garrysmod\materials\ZmaSaw.vmt
C:\GMOD\garrysmod\materials\ZmaSaw.vtf
(Code/whatever is in the vmt is below)

File that makes client download the vtfs and vmts:
C:\GMOD\garrysmod\addons\ZsAddons\lua\autorun\my_trails_stuff.lua
(Code in this file is below)

File in pointshop addon folder that adds it to the shop:
C:\GMOD\garrysmod\addons\pointshop-master\lua\items\trails\zmasaw.lua
(Code in this file is below)


Code for the files:
zmasaw.lua code (Pointshop file)

--- Code: ---ITEM.Name = 'Saw'
ITEM.Price = 500
ITEM.Material = 'materials/ZmaSaw.vmt'
 
function ITEM:OnEquip(ply, modifications)
ply.LaserTrail = util.SpriteTrail(ply, 0, modifications.color, false, 15, 1, 4, 0.125, self.Material)
end

function ITEM:OnHolster(ply)
SafeRemoveEntity(ply.LaserTrail)
end

function ITEM:Modify(modifications)
PS:ShowColorChooser(self, modifications)
end

function ITEM:OnModify(ply, modifications)
SafeRemoveEntity(ply.LaserTrail)
self:OnEquip(ply, modifications)
end
--- End code ---
my_trails_stuff.lua (File that makes clients download the vmts and vtfs)

--- Code: ---if (SERVER) then
resource.AddFile( "materials/ZmaSaw.vmt" )
resource.AddFile( "materials/ZmaSaw.vtf" )
end
--- End code ---
ZmaSaw.vmt (Self explanatory)

--- Code: ---"UnlitGeneric"
{
        "$basetexture" "materials/ZmaSaw"
        "$vertexalpha" 1
        "$vertexcolor" 1
}
--- End code ---

MrPresident:
In your material path, it's relative to the materials folder. You don't need to include it.

Your code is looking for : materials/materials/ZmaSaw.vmt

change your ITEM.Material to
ITEM.Material = 'ZmaSaw.vmt'

Neku:

--- Quote from: MrPresident on May 31, 2014, 11:31:24 AM ---In your material path, it's relative to the materials folder. You don't need to include it.

Your code is looking for : materials/materials/ZmaSaw.vmt

change your ITEM.Material to
ITEM.Material = 'ZmaSaw.vmt'

--- End quote ---

Er, not vmt. Use vtf.

Edit: Oh, I've never made a trail myself, sorry about the bad info.

MrPresident:

--- Quote from: Neku on May 31, 2014, 11:47:23 AM ---Er, not vmt. Use vtf.

--- End quote ---

No... You are supposed to use the vmt with SpriteTrail.
http://wiki.garrysmod.com/page/util/SpriteTrail
http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index73b0.html


Also, right from the valve wiki (Just for learning points):

--- Quote ---A texture is a two-dimensional raster image in the context of a game engine. Textures in Source are stored in the Valve Texture Format, and with a very few exceptions are only accessed through an intermediate material.

--- End quote ---

MrPresident:
A .vmt is what source uses as a texture. It has all of the information the engine needs to display the graphic. (INCLUDING a link to the actual image itself which is the .vtf)

A .vtf is just the image that a .vmt uses.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version