Checking if within a certain sector in a certain map

Status
Not open for further replies.

742mph

My work is never done yet
In Lua, how might I check if object X is within sector Y and map MAPZZ (or map number A) is loaded up at the moment? I can't seem to find anything about it in the Lua documentation threads. I could also use a check for if linedef executor tag Y has been activated in map MAPZZ to do what I'm trying to do, so that would be helpful as well.
 
You can check what sector an object (or mobj) is in by using "mobj.subsector.sector". As for the current map you're playing though, there's no way to obtain this directly right now.
 
I tried mobj.subsector.sector last night before posting this, and it didn't work, but after you replied I tried it again and it seems to be working fine. Hm.
 
Hardcoding something like that is a pretty bad idea anyway. It'd be a much better idea to pick a sector special that won't conflict with anything else in your intended use (I use Trigger Linedef Executors on FOFs and the various Bustable Block Sprite sectors for the purpose), then use P_PlayerTouchingSectorSpecial(player, section, special) to detect if the player is in that special. That way you don't have to adjust your script if, say, you want to change the triggering sector, or the map is moved elsewhere in the rotation.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top