TextureID of an actor's first spawn state?

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
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

TextureID of an actor's first spawn state?

Post by Matt »

I'm trying to do something like the equivalent of GetInventoryIcon except there's no instance of the actor in question and I need to work from GetDefaultByType.

I've gotten to this

Code: Select all

        let item=getdefaultbytype((class<inventory>)(invclasses[index]));
        let ddi=item.spawnstate.sprite;
and I'm stuck, with no way to translate that output into anything that can be read by TexMan.

What should I actually be doing?
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: TextureID of an actor's first spawn state?

Post by Apeirogon »

Did you try string.format("%s", ddi); ?

Oh, wait, sprites dont work in this way, since they already have some number defined by gzdoom internally.
User avatar
Player701
 
 
Posts: 1636
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: TextureID of an actor's first spawn state?

Post by Player701 »

To get a texture from a sprite, you need to know the frame and the angle of that sprite. While the frame can be accessed from the script side, it doesn't look like you can do anything with a SpriteID at the moment to retrieve TextureIDs from it. So I don't think it is currently possible.
User avatar
AFADoomer
Posts: 1322
Joined: Tue Jul 15, 2003 4:18 pm
Contact:

Re: TextureID of an actor's first spawn state?

Post by AFADoomer »

Can you use GetSpriteTexture instead of just returning the sprite ID?

In State definition:
native TextureID, bool, Vector2 GetSpriteTexture(int rotation, int skin = 0, Vector2 scale = (0,0));
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: TextureID of an actor's first spawn state?

Post by Matt »

Sweet, thanks! Had no idea that function existed...
Post Reply

Return to “Scripting”