Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
scifista42

Calling a script on all actors inside a given sector

Recommended Posts

HYPOTHETICALLY: In my map and at one specific moment, I would like to get references to all things currently standing in sector(s) with a specific tag, and call one instance of an ACS script on each of them (with the thing as the activator). I don't want to assume anything about the thing's type or tag. The less hacky solution, the better. Is this possible anyhow?

Share this post


Link to post

I can't think of a way to do that. I haven't kept up with everything that has been added to ZDoom recently but the only action I'm aware of that you can perform on all actors in a given tagged sector is damage or destroy them.

Based on that, you could imagine using custom damage type hacks but that'd be very very ugly.

Share this post


Link to post

You could do this by controlling the TIDs of the actors that enter and leave the sector. Have a script run when an actor walks into the sector that sets its TID to 1337 or whatever, and then have a script that sets it back to 0 or whatever when it leaves. Then whenever your event happens just have that affect all actors with the corresponding TID. The special you want for this is Thing_ChangeTID and the things to add for script activations are 9997 and 9998. If you need to treat the various actors separately you can give them each a unique TID as long as you track what you're using so you can pass them to scripts.

Share this post


Link to post

Is the "enter sector activation" / "leave sector activation" 100% reliable? If the player will dance in and out while bumping into walls and moving with exact precision right on the linedef while other things cross the same linedef, will it ALWAYS detect that he entered the sector / left the sector exactly once?

Share this post


Link to post

I don't see why it would be unreliable. I don't know how the engine detects when a player enters a sector. All I can say is to test it and make sure it runs scripts with ACS_ExecuteAlways.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×