Hey,
I hope someone might be willing to offer some quick advice to a novice mapper. I have been scouring Google searches and the FAQ's for help but have come up empty.
I am designing a map in GTKRadiant 1.5 and am stuck on a texturing issue.
What I would like to do is change a brush's texture during game-play.
Here is a basic example of what I mean. Imagine a simple square brush on a wall with a button next to it. The player walks up to the button, pushes it, and the texture on the square brush (or just one face of the brush) changes to something else. That's basically it.
Is this even possible?? I have not been able to find help in FAQs or elsewhere specific to this topic. If it is possible I assume it would involve a shader and/or code in the map's .script file.
Any help for a poor novice?
Thank you.
Is it possible to change a brush's texture in-game?
Re: Is it possible to change a brush's texture in-game?
Here is the documentation:
http://robotrenegade.com/q3map2/docs/sh ... ities.html
It has some pretty big limitations, namely with lighting and blendfuncs. I don't recall the details, but I was helping sock with a bunch of this stuff, maybe he'll remember the conversation better than I.
You can also fake it using some kind of triggerable entity, say a func_door that appears and overlaps the original texture.
http://robotrenegade.com/q3map2/docs/sh ... ities.html
It has some pretty big limitations, namely with lighting and blendfuncs. I don't recall the details, but I was helping sock with a bunch of this stuff, maybe he'll remember the conversation better than I.
You can also fake it using some kind of triggerable entity, say a func_door that appears and overlaps the original texture.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Re: Is it possible to change a brush's texture in-game?
Thank you very much for the reply obsidian!
I have tried making use of the info you listed but so far I cannot get it to work
I did some Google searches since you provided me something more specific to search for (that being "targetShaderName" and "targetShaderNewName") and came up with this tutorial on how to use these keys: (sorry for posting a link to a different site)
http://www.map-craft.com/modules.php?na ... it&lid=313
Following that tutorial I made a map with a func_button linked to a target_relay entity. I then added the "targetShaderName" and "targetShaderNewName" keys to the target_relay and provided full texture paths for both keys. But when I run the map and press the button nothing happens
I have tried creating my own shaders, using my shaders on some brushes in the map, and specifying those shaders instead of some basic textures. I have tried adding .tga and/or .jpg to the end of the specified texture names. I have even tried linking my func_button to a target_script_trigger, writing the script code for it so that it does an "alertentity" to the target_relay. Nothing seems to work 
Any ideas ?
(Thank you in advance too.)
I have tried making use of the info you listed but so far I cannot get it to work

I did some Google searches since you provided me something more specific to search for (that being "targetShaderName" and "targetShaderNewName") and came up with this tutorial on how to use these keys: (sorry for posting a link to a different site)
http://www.map-craft.com/modules.php?na ... it&lid=313
Following that tutorial I made a map with a func_button linked to a target_relay entity. I then added the "targetShaderName" and "targetShaderNewName" keys to the target_relay and provided full texture paths for both keys. But when I run the map and press the button nothing happens


Any ideas ?
(Thank you in advance too.)
Re: Is it possible to change a brush's texture in-game?
If you want to see this at work, Team Arena has hallways with invisible triggers and proximity warning lights in the flag rooms.
Cardigan's map Scorpion uses this for the red glow effect under the RA.
I suggested the use of triggerable shader entities to sock for his Edge of Forever map, which he used extensively for various electrical effects. Sock also released all his editor content, so you can take a look at his crazy .map file and see it at work. (click the "source" button in the link below:
http://www.simonoc.com/pages/design/maps_q3/moteof.htm
I believe you need to set the keys to the func_button, not the target_relay. What is the target_relay doing there anyway? Is it linked to something else?
What game are you mapping for? Q3 doesn't have a target_script_trigger, so I guess you're working on another idTech 3 engine game or mod?
Cardigan's map Scorpion uses this for the red glow effect under the RA.
I suggested the use of triggerable shader entities to sock for his Edge of Forever map, which he used extensively for various electrical effects. Sock also released all his editor content, so you can take a look at his crazy .map file and see it at work. (click the "source" button in the link below:
http://www.simonoc.com/pages/design/maps_q3/moteof.htm
I believe you need to set the keys to the func_button, not the target_relay. What is the target_relay doing there anyway? Is it linked to something else?
What game are you mapping for? Q3 doesn't have a target_script_trigger, so I guess you're working on another idTech 3 engine game or mod?
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Re: Is it possible to change a brush's texture in-game?
Sorry for not mentioning this earlier but I am making a map for Return to Castle Wolfenstein (RTCW).
I took a look at the source for the map you suggested...yes that map is crazy
I managed to locate some examples for the use of the "targetShaderName" and "targetShaderNewName" keys in the map. The keys were added to "target_delay" entities...which were then linked to other items. It will be very useful as a reference to see how to make use of these keys.
The reason I tried using a "target_relay" entity is only because the tutorial I found (linked above) mentioned that it was one of the 3 most common entities to use to make use of these keys.
I did some more google searching for "targetShaderName" and "targetShaderNewName" and found a forum post where someone mentioned that not all games based on the Q3 engine make use of these keys. Thinking that perhaps RTCW was one of these games I downloaded the game source code (it was released recently by ID) and found the code file where these keys are processed (the link in your first reply told me which file to look at). I am very familiar with C++ programming and the code clearly shows that RTCW does indeed check if the "targetShaderName" and "targetShaderNewName" keys are defined as entities are processed.
Here is a code snipet from RTCW's "g_utils.c" code file:
But I still cannot get it to work
I will continue trying and if I get it working I will post how I did it.
Thank you again for your help.
I took a look at the source for the map you suggested...yes that map is crazy

The reason I tried using a "target_relay" entity is only because the tutorial I found (linked above) mentioned that it was one of the 3 most common entities to use to make use of these keys.
I did some more google searching for "targetShaderName" and "targetShaderNewName" and found a forum post where someone mentioned that not all games based on the Q3 engine make use of these keys. Thinking that perhaps RTCW was one of these games I downloaded the game source code (it was released recently by ID) and found the code file where these keys are processed (the link in your first reply told me which file to look at). I am very familiar with C++ programming and the code clearly shows that RTCW does indeed check if the "targetShaderName" and "targetShaderNewName" keys are defined as entities are processed.
Here is a code snipet from RTCW's "g_utils.c" code file:
Code: Select all
void G_UseTargets( gentity_t *ent, gentity_t *activator ) {
gentity_t *t;
if ( !ent ) {
return;
}
if ( ent->targetShaderName && ent->targetShaderNewName ) {
float f = level.time * 0.001;
AddRemap( ent->targetShaderName, ent->targetShaderNewName, f );
trap_SetConfigstring( CS_SHADERSTATE, BuildShaderStateConfig() );
}
if ( !ent->target ) {
return;
}
But I still cannot get it to work

I will continue trying and if I get it working I will post how I did it.
Thank you again for your help.