Page 1 of 1

A way to get an actor's sector

Posted: Fri Apr 29, 2005 2:39 pm
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.

Re: A way to get an actor's sector

Posted: Fri Apr 29, 2005 2:49 pm
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.

Posted: Fri Apr 29, 2005 3:14 pm
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.

Posted: Sun Jun 18, 2006 4:41 am
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.

Posted: Mon Jun 19, 2006 9:04 am
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.

Posted: Mon Jun 19, 2006 9:05 am
by Cutmanmike
MartinHowe wrote:trying to simulate monster-damaging areas.
Hmm got an example of that?

Posted: Mon Jun 19, 2006 9:38 am
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.

Posted: Mon Jun 19, 2006 3:44 pm
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!

Posted: Mon Jun 19, 2006 4:35 pm
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;