So I am working on a skin pack with a friend on the map 2d. We want for example change the KFC logo to Taco bell, but here’s the problem. We know HOW to open the BSP file so we can see the textures and materials etc… but we do not know how to save the things we have edit. If we import a new logo for taco bell and then want to save it, then we need to insert the location, but it can’t be opened as it’s not valid.
What can we do to replace the textures? We don’t want to create a new map, just replace some materials on the map…
You can actually do it on the fly if that’s an option for you.
Here’s what I did to evocity V33; it’s all done on the fly.
If you’re wanting to edit the map, that’s better suited for the mapping forum.
For code, to do it with code you need to understand and implement several things.
You need to be able to detect the EXACT instant that a player joins. The instant this happens isn’t important to get it done in a certain time, but if you do it BEFORE then the textures will not be replaced properly. Additionally, Add a 5 second timer after the EXACT moment they are fully in the game and can walk around to do the work. MAC users crash if you replace textures right after they load in using code.
Lua. You need to be able to GetMaterial, GetTexture $basetexture, SetTexture $basetexture newTexture
And that’s really all there is to it for the Lua aspect.
GetMaterial is my custom function, the others are real based on the returned material so: Material:GetTexture( “$basetexture” ), Material:SetTexture( “$basetexture”, newTexture/Material or string )
GetMaterial revolves around CreateMaterial if the material you reference doesn’t exist. Usually you use $basetexture / the one you’re replacing. Make sure you use the proper options such as $basetexture, $vertexcolor, $vertexalpha, $additive, $alphatest, $model, $nocull, $ignorez; if you do it incorrectly you’ll have a flashing or whatever texture; make sure the new texture is a power of 2 and square ( I have seen crazy things from non square textures )
If you have more questions feel free to ask.
EDIT: Ninja’d, but it’s incorrect anyway - he Googled it and copy/pasted it without supplying credit or explanation. This is old code and will NOT work:
Edit2: And now the guy that told me to kill myself and repeatedly harassed me, whereby the FBI is investigating his online activities for cyber-bullying, rating me dumb because he doesn’t know how to code and gives incorrect information.
What we were thinking was that we open the BSP file using VTFEDIT and then export the TGA and then edited it and then imported it again, using VTFEDIT. Problem is that we can’t save it once we have imported it.
Doing that is a bad idea - you end with a version that is named the same as others, but has a different signature, so nobody would be able to join unless they were using your specific variant of the map.
That’s a terrible idea; use Lua and you won’t need to have a second version of the map to force users to download. The only time this is a good idea, is if it’s a COMPLETE 100% retexture whereby it’s easier to have all of the textures compiled with it.