turning EVERY sector a color
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
-
Zell
- Posts: 791
- Joined: Thu Jul 24, 2003 7:47 am
- Location: IN A GODDAMN BOX[In Erie.]
turning EVERY sector a color
is it possible to make EVERY sector go to a color with one script, or do i need to tag them all? (i want the player to flip a swicth then something like an alarm goes off and you have to escape, and the entire level turns red)
-
Cyb
- Posts: 912
- Joined: Tue Jul 15, 2003 5:12 pm
yes
where MAXTAG is the highest numbered sector tag on the map. note if you use negative sector tags (which nobody does, and I don't think they're even supported by zdoom) you'll need to make x have the proper starting value, but I'm sure you're not using them so disregard that heh
edit: oh yeah, if you want the script to leave out some sectors (for deep water or whatever purposes) do this:
that will change all sectors red except ones tagged 12, 98 or 127
Code: Select all
script 1 (void)
{
for(int x = 0; x <= MAXTAG; x++)
sector_setcolor(x, 255, 0, 0);
}
edit: oh yeah, if you want the script to leave out some sectors (for deep water or whatever purposes) do this:
Code: Select all
script 1 (void)
{
for(int x = 0; x <= MAXTAG; x++)
{
if(x != 12 && x != 98 && x != 127)
sector_setcolor(x, 255, 0, 0);
}
}
-
The Ultimate DooMer
- Posts: 2109
- Joined: Tue Jul 15, 2003 5:29 pm
- Location: Industrial Zone
-
Ultraviolet
- Posts: 1152
- Joined: Tue Jul 15, 2003 9:08 pm
- Location: PROJECT DETAILS CLASSIFIED.
-
Hirogen2
- Posts: 2033
- Joined: Sat Jul 19, 2003 6:15 am
- Operating System Version (Optional): Tumbleweed x64
- Graphics Processor: Intel with Vulkan/Metal Support
- Location: Central Germany
-
HotWax
- Posts: 10002
- Joined: Fri Jul 18, 2003 6:18 pm
- Location: Idaho Falls, ID
What's your point? Cyb's method is by far the best. All sectors in the map (tagged or not) will be turned red, except those explicitely tagged otherwise in the second example. This could be useful if there are outdoor areas. Just slap on a certain tag and it'll be skipped during the coloration process.Hirogen2 wrote:Cyb: He did not want to tag all the sectors, and sector_setcolor takes a sector
tag...
Zell: Taking the sector 0-tag approach, you still need to make tagged sectors
red with (single) calls to sector_setcolor.
Cyb's example does exactly what TUD's does (Change colors of all untagged (tag 0) sectors), and then goes through every other used tag and changed their colors as well. A for loop is a series of "(single)" commands being executed multiple times, after all.
-
Hirogen2
- Posts: 2033
- Joined: Sat Jul 19, 2003 6:15 am
- Operating System Version (Optional): Tumbleweed x64
- Graphics Processor: Intel with Vulkan/Metal Support
- Location: Central Germany