ULX

Author Topic: Pointshop - Adding Trails  (Read 17766 times)

0 Members and 1 Guest are viewing this topic.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Pointshop - Adding Trails
« Reply #15 on: May 31, 2014, 10:13:50 AM »
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: [Select]
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
my_trails_stuff.lua (File that makes clients download the vmts and vtfs)
Code: [Select]
if (SERVER) then
resource.AddFile( "materials/ZmaSaw.vmt" )
resource.AddFile( "materials/ZmaSaw.vtf" )
end
ZmaSaw.vmt (Self explanatory)
Code: [Select]
"UnlitGeneric"
{
        "$basetexture" "materials/ZmaSaw"
        "$vertexalpha" 1
        "$vertexcolor" 1
}

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Pointshop - Adding Trails
« Reply #16 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'

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Pointshop - Adding Trails
« Reply #17 on: May 31, 2014, 11:47:23 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'

Er, not vmt. Use vtf.

Edit: Oh, I've never made a trail myself, sorry about the bad info.
« Last Edit: May 31, 2014, 03:12:41 PM by Neku »
Out of the Garry's Mod business.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Pointshop - Adding Trails
« Reply #18 on: May 31, 2014, 11:56:45 AM »
Er, not vmt. Use vtf.

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.
« Last Edit: May 31, 2014, 12:18:55 PM by MrPresident »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Pointshop - Adding Trails
« Reply #19 on: May 31, 2014, 11:58:34 AM »
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.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Pointshop - Adding Trails
« Reply #20 on: May 31, 2014, 12:03:11 PM »
Okay, did what you said.
Changed materials/ZmaSaw.vmt to ZmaSaw.vmt

Now, I join the server. I equip the trail. But instead of showing the missing texture thing, it shows nothing at all.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Pointshop - Adding Trails
« Reply #21 on: May 31, 2014, 12:08:29 PM »
Well, this is a start.

Having is show nothing, means that it's at least not pointing to something that doesn't exist.

Have you manually edited the .vtf at all?

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Pointshop - Adding Trails
« Reply #22 on: May 31, 2014, 12:10:45 PM »
I've manually edited the .vmt once, but not the .vtf
Did you mean that?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Pointshop - Adding Trails
« Reply #23 on: May 31, 2014, 12:14:08 PM »
Yeah, that's what I meant. Sorry.

What did you change? That could have caused an issue.

Also, is it possible that modifications.color isn't being set? That might be why it's invisible as well. You might changing that to something like.. Color(255,255,255,255) just as a test.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Pointshop - Adding Trails
« Reply #24 on: May 31, 2014, 12:16:59 PM »
In an example right from the valve website (https://developer.valvesoftware.com/wiki/Material)

They have
$basetexture coast\shingle_01

try changing yours to:
$basetexture ZmaSaw

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Pointshop - Adding Trails
« Reply #25 on: May 31, 2014, 12:26:07 PM »
"What did you change? That could have caused an issue."
I believe all I did was change the location of the ZmaSaw thing after the "$basetexture" part of it

"Also, is it possible that modifications.color isn't being set? That might be why it's invisible as well. You might changing that to something like.. Color(255,255,255,255) just as a test."
Where would I do that? Ingame? If so, that's what it's set to there.


"They have
$basetexture coast\shingle_01

try changing yours to:
$basetexture ZmaSaw"
Just did this.
Code: [Select]
"UnlitGeneric"
{
        "$basetexture" "ZmaSaw"
        "$vertexalpha" 1
        "$vertexcolor" 1
}
Still shows nothing when I walk around.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Pointshop - Adding Trails
« Reply #26 on: May 31, 2014, 12:41:50 PM »
Are you seeing anything in your client console about missing textures or anything like that?

Other than the things I've already suggested, I don't really know what else is going on. I use PNG files for all my GUI/Material stuff now since GM13 allows it. I'm not super familiar with VMT/VTF.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Pointshop - Adding Trails
« Reply #27 on: May 31, 2014, 03:10:27 PM »
I've gone ahead and dug up a couple of .vmt's belonging to trails.

Code: [Select]
"UnlitGeneric"
{
"$baseTexture" "trails/8bitarrow"

"$additive" 0
"$vertexcolor" 1
"$vertexalpha" 1
}

From what I've seen from your's, it does not include $additive.
Out of the Garry's Mod business.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Pointshop - Adding Trails
« Reply #28 on: May 31, 2014, 03:54:16 PM »
For Neku:
I added the part that was missing
Now when I go to the PointShop, it will show the correct image in the PointShop, but when I walk around after equipping the trail, it shows nothing.


For MrPresident:
I didn't check before this, but after I fixed the thing Neku told me to do (talked about it earlier in this post), I have nothing in my client console that says anything related to the missing texture.

Current Problem: Correct image of trail shows when in PointShop menu. It does not show when I walk around. (Nothing shows at all when I walk around)

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Pointshop - Adding Trails
« Reply #29 on: May 31, 2014, 04:58:25 PM »
Code: [Select]
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

This is your item.lua. You still have the ply.LaserTrail in that. Change it to something like, ply.SawTrail.
It should look like this:
Code: [Select]
ITEM.Name = 'Saw'
ITEM.Price = 500
ITEM.Material = 'materials/ZmaSaw.vmt'
 
function ITEM:OnEquip(ply, modifications)
ply.SawTrail = util.SpriteTrail(ply, 0, modifications.color, false, 15, 1, 4, 0.125, self.Material)
end

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

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

function ITEM:OnModify(ply, modifications)
SafeRemoveEntity(ply.SawTrail)
self:OnEquip(ply, modifications)
end

I'm not saying this will fix it, but it was conflicting with your laser trail.
Out of the Garry's Mod business.