Listing all inventory actors

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!)
Post Reply
echo4
Posts: 11
Joined: Fri Nov 09, 2018 2:35 am

Listing all inventory actors

Post by echo4 »

Hello,

I am trying to make an ACS function that prints the location of items I haven't collected yet, or at least the closest item I haven't collected yet. Something like

Health Powerup Remaining @ location x,y.z. Distance from player: 208.3 Direction: North North East

The problem I have is there doesn't appear to be a way to interate through all actors, or better yet, all actors of a given class.

The closest thing that may work seems to be the CheckProximity command where I could try lots of different radius, but I wonder if there is a more direct way to get all the items remaining in the map (powerups, armor /health pickups, pretty much anything that counts toward the item count...)

There does seem to be a console command, actorlist from https://zdoom.org/wiki/CCMDs:Informational so it seems like at least the code/functionality exists, so hopefully this can be exposed / used in a script somehow.

Any pointers / ideas would be much appreciated.

Thanks !
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: Listing all inventory actors

Post by m8f »

Important question: are you bound to ACS?

Because if not, ZScript's ThinkerIterator is exactly what you need. You can see the example of its usage in the wiki article or here.
echo4
Posts: 11
Joined: Fri Nov 09, 2018 2:35 am

Re: Listing all inventory actors

Post by echo4 »

Interesting, I read a bit about ZScript but haven't yet dove in.

However, I just found there are console commands that do exactly what I want:

countitems
and
myinfo

The first gives me the coordinates of any remaining countable item and the second gives my current position.
Post Reply

Return to “Scripting”