A way to get an actor's sector

Moderator: GZDoom Developers

Post Reply
User avatar
justin024
Posts: 379
Joined: Sun Nov 14, 2004 1:29 am
Location: Illinois
Contact:

A way to get an actor's sector

Post by justin024 »

As the title implies, there needs to be a way to get the sector an actor is currently in. It would return the sector that the thing with the specified tid and lowest number is in. This could be useful for running checks because the actor enters / leaves sector things aren't 100% foolproof.
GetActorSector(tid);

Also, dying monsters should activate actor leaves sector things.
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Re: A way to get an actor's sector

Post by Zippy »

justin024 wrote:Also, dying monsters should activate actor leaves sector things.
I contest this on the basis that a dying actor never actually leaves the sector (exception is when the carcass goes flying out of the sector from a rocket or what have you.) They make their grave in that sector. I don't believe it should function the way you are suggesting.
User avatar
justin024
Posts: 379
Joined: Sun Nov 14, 2004 1:29 am
Location: Illinois
Contact:

Post by justin024 »

Here is the idea, there is a big room with smaller sectors that light up depending on whether they are occupied. When a monster dies, the sector stays lit. It is also possible to light up a sector yourself and not have it dimmed again which goes beyond 'actor leaves sector' working with monsters. This is why I requested a get actor's sector function. Changing the thing itself isn't the best solution to my problem. I suppose that I could have that monster teleport to another sector, because using thing_remove doesn't trigger 'actor leaves sector' either. An 'actor dies' thing would help, but not as much as just getting the actor's current sector.

Edit: I did find a really roundabout way of making it work which involved making the monster tids lower than the player tids, keeping track of lower and upper tids, and lowering the light level only if the monster was in a different sector.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

No, for a simple reason: Since it has to return a tag and tags are not unique to sectors this would only work with specially designed maps and would cause more issues than it might solve.
User avatar
MartinHowe
Posts: 2062
Joined: Mon Aug 11, 2003 1:50 pm
Preferred Pronouns: He/Him
Location: East Suffolk (UK)

Post by MartinHowe »

Then can we at least have (G)ZDoom make Actor Enters/Leaves sector work properly? By this I mean that if a monster leaves a sector that has "actor leaves sector" and enters one with "actor enters sector", the engine needs to guarantee that the "leaves sector" triggers before the "enters sector" does. This caused me a lot of problems when trying to simulate monster-damaging areas. It would also be nice if "actor enters sector" can be set to trigger when an actor as been placed in that sector in a map editor.
User avatar
Cutmanmike
Posts: 11351
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

MartinHowe wrote:trying to simulate monster-damaging areas.
Hmm got an example of that?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

The exit sector action is triggered first. The problem you are having comes from ACS's inner workings. To guarantee proper order you have to do a one-tic delay at the start of the 'enter sector' script.
User avatar
MartinHowe
Posts: 2062
Joined: Mon Aug 11, 2003 1:50 pm
Preferred Pronouns: He/Him
Location: East Suffolk (UK)

Post by MartinHowe »

Graf Zahl wrote:The exit sector action is triggered first. The problem you are having comes from ACS's inner workings. To guarantee proper order you have to do a one-tic delay at the start of the 'enter sector' script.
Thanks; I have it in mind to rewrite those scrips and this would make them simpler.
Cutmanmike wrote:
MartinHowe wrote:trying to simulate monster-damaging areas.
Hmm got an example of that?
Not that I'd want to publicise too much at this stage, but think of nuclear reactor fuel rods being raised from their holes in the floor above the reactor core and a deep pool of opaque blue water full of spent fuel rods... heh heh heh!
User avatar
Anakin S.
Posts: 1067
Joined: Fri Nov 28, 2003 9:39 pm
Location: A long time ago in a galaxy far, far away...

Post by Anakin S. »

How about this:

Code: Select all

switch(lineside())
         case 0:
                do stuff when actor enters sector.
                break;
         case 1:
                do stuff when actor leaves sector.
                break;
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”