• Custom Texture on my server
    9 replies, posted
So, I use the map rp_downtown_evilmelon_V1 for my gmod server, and i've tried to extract it using gmad, for the purpose of replacing a texture it uses with one of my own. See.. i want its billboard to display something other them EM servers on it. I edited the .vtf using "VTFedit" and replaced the texture using the same dimensions with a custom texture and exported after saving. I tried adding [CODE]resource.AddFile("materials/cm_textures/emlogo.vtf") resource.AddFile("materials/cm_textures/emlogo.vmt")[/CODE] and i the new edited version to my server materials folder. after this failed, I made new folder in addons on the server, and gave it a title, and then added the same file path and uploaded those same files. I'm only this far. Try as I may, noting works. At this point, I know this makes me a complete moron. Flame me as I'm sure I have that coming, but can you also shed some light?
Still looking for the right answer. Today I've download the Source SDK 2013 Hammer editor... Please Stop me if i'm going the wrong direction. ;) The answer could be so simple, and i wouldn't know it yet. ;)
See, the thing is when players download it, it won't overwrite it with yours. So it's useless. I suggest drawing over it with Cam3D2D or recompiling the map under a new name with that new texture.
I'm not sure whether or not you've seen this: [url]http://steamcommunity.com/id/Acecool/screenshots/?appid=4000[/url] Evocity v33 with fresh asphalt. [IMG]http://cloud-3.steampowered.com/ugc/3314951615634424605/85C045D74E2920C5A4932A8DFE23322605C1A0FC/[/IMG] All you have to do is do a live-replace of the $basetexture after the player is fully loaded. If you do it before the player has fully loaded then you'll have a random texture placed there or they'll crash ( mac users primarily ).
[QUOTE=Acecool;44423490]I'm not sure whether or not you've seen this: [url]http://steamcommunity.com/id/Acecool/screenshots/?appid=4000[/url] Evocity v33 with fresh asphalt. [IMG]http://cloud-3.steampowered.com/ugc/3314951615634424605/85C045D74E2920C5A4932A8DFE23322605C1A0FC/[/IMG] All you have to do is do a live-replace of the $basetexture after the player is fully loaded. If you do it before the player has fully loaded then you'll have a random texture placed there or they'll crash ( mac users primarily ).[/QUOTE]I replace textures in InitPostEntity with no problems, I wonder why you crashed or got random textures placed o.O?
InitPostEntity should be fine but for some users it may be too early. I haven't crashed but have seen users crash because of it ( it has to be once they're fully in the game ). Maybe I should submit a pull request with my PlayerFullyConnected SH hook.
I think you misunderstand entirely. I want a permanent texture, where a billboard displays a different logo, upon server restart and always there, replacing legitimately the original texture for good. I don't want an On the fly thing I'd have to manage after players join. it just isn't what i mean.
Once it's set-up there's nothing left to do. It's an automated process. When the texture is downloaded to the client, you write code that detects if the texture exists. If it does, they downloaded it so run the replacement code. If it's not detected, they didn't download it, their downloads may be off. Alternatively, you can write a billboards script which runs with Cam2d3D to paint a vgui / html panel up on the billboard, or render it some other way... If you want a permanent texture, you'll have to recompile the map and make the players download a huge map to replace a few textures...
[QUOTE=Acecool;44435851]Once it's set-up there's nothing left to do. It's an automated process. When the texture is downloaded to the client, you write code that detects if the texture exists. If it does, they downloaded it so run the replacement code. If it's not detected, they didn't download it, their downloads may be off. Alternatively, you can write a billboards script which runs with Cam2d3D to paint a vgui / html panel up on the billboard, or render it some other way... If you want a permanent texture, you'll have to recompile the map and make the players download a huge map to replace a few textures...[/QUOTE] well, my server is password protected at the moment, until its ready, so at the moment, people would have to start fresh, same as they would any server. I did what you suggested and compressed the map to bz2, and its not a terrible size. at best, i plan to contact the map creator and ask for permission to reupload the map to workshop just noting that its just an upload for server content.
I didn't suggest you compress the map, nor did I suggest you even go that route as it's very prohibitive; users won't sit through a long download for a map with a few texture changes. I suggested using a real-time Lua coded texture-replacement system whereby you only send the required textures... For real-time Lua replacement, you need to make a list of textures you want to replace ( easy way is using concommand: mat_texture_list or +mat_texture_list for hold-open ). [lua] // // Set up the original textures set to be replaced, and the replacement texture in a table // local REPLACE_DEFAULT_MAP_TEXTURES = { { original = "sgtsicktextures/sicknessroad_01", replacement = "acrp/asphalt/roadquad_v2" }; { original = "sgtsicktextures/sicknessroad_02", replacement = "acrp/asphalt/slabquad_v2" }; { original = "sgtsicktextures/gunroad_01", replacement = "acrp/asphalt/roadquad_v2" }; { original = "sgtsicktextures/gunroad_02", replacement = "acrp/asphalt/roadquad_v2" }; { original = "sgtsicktextures/gunroad_03", replacement = "acrp/asphalt/slabquad_v2" }; { original = "sgtsicktextures/gunroad_04", replacement = "acrp/asphalt/slabquad_v2" }; { original = "ajacks/ajacks_road2", replacement = "acrp/asphalt/roadquad_v2" }; { original = "ajacks/ajacks_road4", replacement = "acrp/asphalt/roadquad_v2" }; { original = "ajacks/ajacks_road5", replacement = "acrp/asphalt/roadquad_v2" }; { original = "ajacks/ajacks_road7", replacement = "acrp/asphalt/slabquad_v2" }; { original = "ajacks/ajacks_road8", replacement = "acrp/asphalt/roadquad_v2" }; { original = "ajacks/ajacks_10", replacement = "acrp/asphalt/slabquad_v2" }; { original = "hall_concrete/hall_concrete11_wet", replacement = "acrp/asphalt/slab_v2" }; };[/lua] Once you have the original textures, make a list, or add to the original list of textures you'd like to replace them with. Process the textures first by getting the Material( ), Material( ):GetTexture( "$basetexture" ) for the replacement material, and OriginalMaterial( ):SetTexture( basetexture", NewTexture ) such as: [lua]local _originalMaterial = Material( v.original ); local _replacementMaterial = Material( v.replacement ); local _newTexture = _replacementMaterial:GetTexture( "$basetexture" ); _originalMaterial:SetTexture( "$basetexture", _newTexture ); [/lua] This must be done after the player has fully joined; if done sooner there will be random textures which are visible instead of the intended texture. This is because the materials are loading at that point, and it will simply grab the last one in the list if it can't find the exact one during the load-period.
Sorry, you need to Log In to post a reply to this thread.