ACS function: CheckActorInSector(tag, tid)

Moderator: GZDoom Developers

DoomerMr_T
Posts: 54
Joined: Fri Nov 09, 2007 7:25 am
Location: Budapest,Hungary
Contact:

ACS function: CheckActorInSector(tag, tid)

Post by DoomerMr_T »

A simple acs function what returns true if any object with the specified tid is in the tagged sector(s).
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

Re: ACS function: CheckActorInSector(tag, tid)

Post by Skippy »

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?
Worst
Posts: 115
Joined: Sat Apr 28, 2007 5:29 am
Location: finland
Contact:

Re: ACS function: CheckActorInSector(tag, tid)

Post by Worst »

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 :)
User avatar
esselfortium
Posts: 3862
Joined: Tue Sep 19, 2006 8:43 pm
Contact:

Re: ACS function: CheckActorInSector(tag, tid)

Post by esselfortium »

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.
DoomerMr_T
Posts: 54
Joined: Fri Nov 09, 2007 7:25 am
Location: Budapest,Hungary
Contact:

Re: ACS function: CheckActorInSector(tag, tid)

Post by DoomerMr_T »

Originally I wanted this for my wad because I need to check that every player is in a tagged sector before the action executes.
User avatar
Skippy
Posts: 695
Joined: Sun Nov 20, 2005 9:57 am
Location: Belfast, NI

Re: ACS function: CheckActorInSector(tag, tid)

Post by Skippy »

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. :|
Onslaught Six
Posts: 572
Joined: Sun Dec 11, 2005 9:17 pm
Location: Hell.
Contact:

Re: ACS function: CheckActorInSector(tag, tid)

Post by Onslaught Six »

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

Re: ACS function: CheckActorInSector(tag, tid)

Post by HotWax »

You're overthinking it. :P Every actor has to store its current sector for rendering purposes anyway.
JL_Harkster
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)

Post by JL_Harkster »

I would love this feature. It would allow for many new types of gameplay mechanics.
User avatar
esselfortium
Posts: 3862
Joined: Tue Sep 19, 2006 8:43 pm
Contact:

Re: ACS function: CheckActorInSector(tag, tid)

Post by esselfortium »

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.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: ACS function: CheckActorInSector(tag, tid)

Post by Kate »

Onslaught Six wrote:[...]
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.
Thomas
Posts: 53
Joined: Wed May 30, 2007 2:13 pm
Location: The Netherlands

Re: ACS function: CheckActorInSector(tag, tid)

Post by Thomas »

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.
Karate Chris
Posts: 307
Joined: Wed Aug 23, 2006 7:58 am

Re: ACS function: CheckActorInSector(tag, tid)

Post by Karate Chris »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ACS function: CheckActorInSector(tag, tid)

Post by Graf Zahl »

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.
User avatar
esselfortium
Posts: 3862
Joined: Tue Sep 19, 2006 8:43 pm
Contact:

Re: ACS function: CheckActorInSector(tag, tid)

Post by esselfortium »

Thank you Chris for making this, and Graf for accepting it. :)
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”