[H E L P] Retrieving a thing's sector tag
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.
[H E L P] Retrieving a thing's sector tag
Surely. Surely there's a way to retrieve the tag of the sector a certain thing is standing in. But either I've forgotten or it hasn't existed all along.
Re: [H E L P] Retrieving a thing's sector tag
I am sure there isn't such feature. 
But you can substitute with a very ugly hack...
If you work with a grid pattern of equally sized sectors, then the solution is using your actor's X Y position.
But you can substitute with a very ugly hack...
Spoiler:Or you can just rethink what you are trying to do and try to think of an another way to do it.
If you work with a grid pattern of equally sized sectors, then the solution is using your actor's X Y position.
Re: [H E L P] Retrieving a thing's sector tag
That's helpful though, thank you! Honestly ugly hacks are pretty much all I'm doing at this point. 
Though I'm a bit concerned about runaway. How likely is this to happen? I realise doing 10,000 checks in one tic is already pushing it...
Though I'm a bit concerned about runaway. How likely is this to happen? I realise doing 10,000 checks in one tic is already pushing it...
Re: [H E L P] Retrieving a thing's sector tag
There is no danger of runaway here, as far as I know. The instruction limit lies at 500,000 per tic. If this is inside of your own maps, you can do the fairly trivial optimisation of setting MAX_SECTOR_TAG to the highest sector tag in your map. If they are not inductive, use an array and cycle through that. You can use acsprofile in the console to see if the trade-off is worthwhile!
I think ThingCount can also use const in the first argument to reduce instructions being pushed (I am unaware of the details here, but if you do not use expressions, you may use const to lower the probability of runaway happening). May be worth trying for ThingCount_Sector, if it does work for that function.
I think ThingCount can also use const in the first argument to reduce instructions being pushed (I am unaware of the details here, but if you do not use expressions, you may use const to lower the probability of runaway happening). May be worth trying for ThingCount_Sector, if it does work for that function.
Re: [H E L P] Retrieving a thing's sector tag
I wouldn't worry too much about it. You probably will not end up needing to write custom collision and hitscan detection in ACS...Jimmy wrote:That's helpful though, thank you! Honestly ugly hacks are pretty much all I'm doing at this point.
True, but even without getting terminated, it can still cause frame-rate drops.KeksDose wrote:There is no danger of runaway here, as far as I know. The instruction limit lies at 500,000 per tic.
As my knowledge goes, you can use const, only when all arguments are constantsKeksDose wrote: I think ThingCount can also use const in the first argument to reduce instructions being pushed (I am unaware of the details here, but if you do not use expressions, you may use const to lower the probability of runaway happening). May be worth trying for ThingCount_Sector, if it does work for that function.
Re: [H E L P] Retrieving a thing's sector tag
I always wonder why it can't be as simple as a function to do exactly this, something like "checkThingSector(TID)" and you put in the TID and the function returns the sector number.
- NeuralStunner
-

- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: [H E L P] Retrieving a thing's sector tag
I'm pretty sure it would be possible, but nobody's done it yet.
Re: [H E L P] Retrieving a thing's sector tag
Yes, the main problem here is that you cannot retrieve the sector tags at all, so the only option to circumvent the problem is to use the previously written for loop to test whether the thing with an actual tid exists in a sector with given tag or not.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [H E L P] Retrieving a thing's sector tag
Besides, what should it return for sectors with multiple tags?
Threads like this exist because people try to use some information for doing stuff it was never meant for.
And instead of asking how to do what they really intend to do, they ask how they can implement it in the broken way they cooked up.
(In clear English: What is missing here is, why the hell do you need this information to begin with?)
Threads like this exist because people try to use some information for doing stuff it was never meant for.
And instead of asking how to do what they really intend to do, they ask how they can implement it in the broken way they cooked up.
(In clear English: What is missing here is, why the hell do you need this information to begin with?)
Re: [H E L P] Retrieving a thing's sector tag
Have I missed something here? I don't know anything about sectors with multiple tags.sectors with multiple tags
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [H E L P] Retrieving a thing's sector tag
Yes, you have missed something there. That feature has been available for more than a year.
Re: [H E L P] Retrieving a thing's sector tag
And is there a wiki article or a description about it?
Re: [H E L P] Retrieving a thing's sector tag
http://zdoom.org/wiki/tag
The Wiki wrote:ZDoom, using UDMF maps, have the ability to read in multiple tags per line or sector. Doom and Hexen map types will not work with this, however, and neither can things.
Re: [H E L P] Retrieving a thing's sector tag
I apologise for astounding you with my idiocy. Geez.Graf Zahl wrote:Besides, what should it return for sectors with multiple tags?
Threads like this exist because people try to use some information for doing stuff it was never meant for.
And instead of asking how to do what they really intend to do, they ask how they can implement it in the broken way they cooked up.
(In clear English: What is missing here is, why the hell do you need this information to begin with?)
Say you want to quickly place things in a bunch of sectors, and affect only the sectors those things are placed in. Like have a torch that sets the sector color to red, for a crude example. You probably don't want to hear what I was originally planning on doing, it'd take way too long to explain and I quickly found it wasn't going to work out anyway. My initial query was just vague because I wasn't aware that there was apparently a lack of connectivity between thing and sector, and wanted confirmation on that. It sounds like the sort of thing that should be possible, is all.
Maybe something like ActivatorSector() would be more useful. Like ActivatorTID(), except it would only return the singular sector the actor is currently in. Sector tags needn't be involved. I'm not familiar with ZDoom's internals on any conceivable level but if the sector number a thing is currently in could be exposed to ACS, then this, I imagine, would be handy to have as a quick void function.
- Graf Zahl
- Lead GZDoom+Raze Developer

- Posts: 49252
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [H E L P] Retrieving a thing's sector tag
Since ACS has no access to single entities like that it simply cannot be done. This is very deep in WFDS territory.

