ACS function: CheckActorInSector(tag, tid)
Moderator: GZDoom Developers
-
- Posts: 54
- Joined: Fri Nov 09, 2007 7:25 am
- Location: Budapest,Hungary
- Contact:
ACS function: CheckActorInSector(tag, tid)
A simple acs function what returns true if any object with the specified tid is in the tagged sector(s).
Re: ACS function: CheckActorInSector(tag, tid)
A similar suggestion was made a very long time ago, but yielded no results.
Feature suggestions are generally more likely to be considered if there's a rationale given for their inclusion. What would you want this feature for?
Feature suggestions are generally more likely to be considered if there's a rationale given for their inclusion. What would you want this feature for?
Re: ACS function: CheckActorInSector(tag, tid)
This would be rather usefull in all kind of scripted events where you have to make sure the actor is inside certain sectors.
And much cleaner than using Actor Enters Sector / Actor Leaves Sector + arrays instead.
But I think it'd be better off as something like ThingCount()
eg. ThingCountSector(int type, int tid, int sectortag)
and possibly too ThingCountNameSector(str classname, int tid, int sectortag)
or maybe if possible, just add the sector tag argument to the existing ThingCount functions?
I'm pretty sure this could allow many interesting things if implemented
And much cleaner than using Actor Enters Sector / Actor Leaves Sector + arrays instead.

But I think it'd be better off as something like ThingCount()
eg. ThingCountSector(int type, int tid, int sectortag)
and possibly too ThingCountNameSector(str classname, int tid, int sectortag)
or maybe if possible, just add the sector tag argument to the existing ThingCount functions?
I'm pretty sure this could allow many interesting things if implemented

- esselfortium
- Posts: 3862
- Joined: Tue Sep 19, 2006 8:43 pm
- Contact:
Re: ACS function: CheckActorInSector(tag, tid)
I agree, this would be exceptionally useful for lots of things, like making sure that no players are standing where they'll block part of a multi-sector lift's movement.
Maybe there could also be a way to just determine how many solid things are in a sector, too (regardless of type), if that'd be possible.
Maybe there could also be a way to just determine how many solid things are in a sector, too (regardless of type), if that'd be possible.
-
- Posts: 54
- Joined: Fri Nov 09, 2007 7:25 am
- Location: Budapest,Hungary
- Contact:
Re: ACS function: CheckActorInSector(tag, tid)
Originally I wanted this for my wad because I need to check that every player is in a tagged sector before the action executes.
Re: ACS function: CheckActorInSector(tag, tid)
I guess the most flexible way to handle these types of things is an accessible array property for the things present in a sector. I fear that's a job for DoomScript. Anything else would probably be considered a half-assed implementation.
Hopefully I'll be proved wrong.
Hopefully I'll be proved wrong.

-
- Posts: 572
- Joined: Sun Dec 11, 2005 9:17 pm
- Location: Hell.
- Contact:
Re: ACS function: CheckActorInSector(tag, tid)
I dunno, it seems like a basic check to me--perhaps, if the sector's coordinates are stored somewhere. Actually, just using raw coordinate values for this could possibly work too--CheckActorInSector(xMin, xMax, yMin, yMax, tid) and then it checks to see if the thing with the tid's position is between xMin and xMax and between yMin and yMax. That might actually be more flexible and valuable than in a sector--if you only wanted the effect to happen on the left half of a room, for example. (Yes, there's always "You could just make the left half a seperate sector!" but the coordinates method might be easier for Graf to program or more practical given the engine or something.)
I dunno, though.
I dunno, though.
Re: ACS function: CheckActorInSector(tag, tid)
You're overthinking it.
Every actor has to store its current sector for rendering purposes anyway.

-
- Posts: 94
- Joined: Wed Sep 13, 2006 2:03 pm
- Location: In front of a Baron, holding a Plasma Rifle
Re: ACS function: CheckActorInSector(tag, tid)
I would love this feature. It would allow for many new types of gameplay mechanics.
- esselfortium
- Posts: 3862
- Joined: Tue Sep 19, 2006 8:43 pm
- Contact:
Re: ACS function: CheckActorInSector(tag, tid)
So, is there much chance of something like this being implemented? It'd be really nice to hear the official word from Randy or Graf about it.
Re: ACS function: CheckActorInSector(tag, tid)
You could just use [wiki]GetActorX[/wiki] and [wiki]GetActorY[/wiki] in combination with CheckActorInSector anyway to figure out where in the sector the actor is if you really do need that information.Onslaught Six wrote:[...]
Re: ACS function: CheckActorInSector(tag, tid)
I managed to make this ACS function for my personal ZDoom build. I could submit a patch for it tomorrow. Current syntax is: CheckActorInSector(int tid, int tag).
Though it would be nice to have an official dev say something about this.
Though it would be nice to have an official dev say something about this.
-
- Posts: 307
- Joined: Wed Aug 23, 2006 7:58 am
Re: ACS function: CheckActorInSector(tag, tid)
I have made the following:
int ThingCountSector (int type, int tid, int tag)
int ThingCountNameSector (str classname, int tid, int tag)
I uploaded two different patches, one for the ACC and one for ZDoom.
int ThingCountSector (int type, int tid, int tag)
int ThingCountNameSector (str classname, int tid, int tag)
I uploaded two different patches, one for the ACC and one for ZDoom.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49234
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ACS function: CheckActorInSector(tag, tid)
Added. But I removed the PCD_THINGCOUNTSECTORDIRECT Pcode.
This isn't really needed and with current ACS doesn't even offer any optimization. Direct calls are a relic of Hexen's ACS which was quite a bit less efficient as the modern variant.
This isn't really needed and with current ACS doesn't even offer any optimization. Direct calls are a relic of Hexen's ACS which was quite a bit less efficient as the modern variant.
- esselfortium
- Posts: 3862
- Joined: Tue Sep 19, 2006 8:43 pm
- Contact:
Re: ACS function: CheckActorInSector(tag, tid)
Thank you Chris for making this, and Graf for accepting it. 
