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!)
I'm trying to replace the stimpack's graphic with a custom animated sprite. In-game, the first loop displays correctly; but after the first loop, instead of replaying the animation, the sprite simply disappears. The item is still there and can be picked up, but it's invisible.
class SmallLE : HealthBonus replaces HealthBonus
{
Default
{
+COUNTITEM
+INVENTORY.ALWAYSPICKUP
Inventory.Amount 1;
Inventory.MaxAmount 200;
Inventory.PickupMessage "Small Life Energy (+1 Health)";
}
States
{
Spawn:
BON1 ABCB 1;
Loop;
}
}
My wild guess it has something to do with the fact that the default health bonus sprite is already animated (as opposed to the static stimpack sprite), but I still don't know exactly what's causing the issue.
Thanks in advance.
Last edited by DuoDynamo2 on Fri Dec 09, 2022 2:53 pm, edited 1 time in total.
Your first example works fine for me when copied verbatim (even though I don't have the extra STIM sprites, so I see the item blinking in and out of existence all the time).
First, please make sure you're using the latest GZDoom release (4.10.0 as of now). If you still get this problem, please post your entire mod here so that it can be investigated further.
Player701 wrote: ↑Thu Dec 08, 2022 4:57 am
I see the item blinking in and out of existence all the time
Yeah, when I first tried out the code I hadn't replaced the graphics yet, and I also got the blinking stimpack.
I have updated GZDoom to version 4.10.0, but the issue still persists.
You haven't set up the proper offsets for your STIM sprites. You need to use a tool such as SLADE or grabpng to edit the sprite files and assign the offsets.
The weird thing here is that you can see the sprite at all, even if only for a few ticks. Might be a bug, or one of those quirks of the GZDoom engine that were left in to avoid breaking existing mods that rely on them.
*facepalm* Duh, of course. It was the offset.
I'm using SLADE, but I keep forgetting about the offset. Normally when I get an invisible sprite I remember about it straight away, but I guess I was thrown off this time because of the first frames showing up. Made me think it was something else.
I adjusted the offset and now it's working as intended. Thank you very much for the help!