turning EVERY sector a color

Archive of the old editing forum
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.
User avatar
Zell
Posts: 791
Joined: Thu Jul 24, 2003 7:47 am
Location: IN A GODDAMN BOX[In Erie.]

turning EVERY sector a color

Post by Zell »

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

Post by Cyb »

yes

Code: Select all

script 1 (void)
{
   for(int x = 0; x <= MAXTAG; x++)
      sector_setcolor(x, 255, 0, 0);
}
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:

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);
   }
}
that will change all sectors red except ones tagged 12, 98 or 127
User avatar
The Ultimate DooMer
Posts: 2109
Joined: Tue Jul 15, 2003 5:29 pm
Location: Industrial Zone

Post by The Ultimate DooMer »

Just use tag 0 - this will change all untagged sectors.
User avatar
Ultraviolet
Posts: 1152
Joined: Tue Jul 15, 2003 9:08 pm
Location: PROJECT DETAILS CLASSIFIED.

Post by Ultraviolet »

...and then you'd have to do it again for all tagged sectors.
User avatar
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

Post by Hirogen2 »

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.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

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.
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.

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.
User avatar
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

Post by Hirogen2 »

Sorry, had not seen he used x=0. (Thought that was x=1)

Return to “Editing (Archive)”