Would be possible to check if the player is in a sector?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
TimeTravelDuck
Posts: 1
Joined: Sun Jul 24, 2022 4:54 pm
Graphics Processor: nVidia with Vulkan support

Would be possible to check if the player is in a sector?

Post by TimeTravelDuck »

Hello there,
I'm playing a little bit with an item with AbsorbDamage and it works without problems.
A question: would be possible with ACS or ZScript to understand if the player is in a special sector like the one at the end of the first Doom Episode when the health points reach 10 and the episode ends?
I would like to remove that item if the player is in that particular sector.

Thank you.
User avatar
Player701
 
 
Posts: 1398
Joined: Wed May 13, 2009 3:15 am
Discord: Player701#8214
Graphics Processor: nVidia with Vulkan support
Location: Russia

Re: Would be possible to check if the player is in a sector?

Post by Player701 »

TimeTravelDuck wrote:A question: would be possible with ACS or ZScript to understand if the player is in a special sector like the one at the end of the first Doom Episode when the health points reach 10 and the episode ends?
Yes, with ZScript only. Use the following expression: Owner.curSector.Flags & Sector.SECF_ENDLEVEL in your item code.
e.g.:

Code: Select all

if (Owner.curSector.Flags & Sector.SECF_ENDLEVEL)
{
    Destroy();
}

Return to “Scripting”