Well, I was confused by ACS when I saw it for the first time. But believe me, it"s easier than you think.
If I want to make something that has an custom animation (I had the same idead as you have - have healing items with animation), I would use one of the simplest yet powerful functions, HudMessage
https://zdoom.org/wiki/HudMessage. It allows you to write what you want, where you want. Gives you full control of text. ALSO, it allows you to draw custom image onscreen. So you can make an ACS animation. With arrays, it much easier.
Here is little example of ACS driven animation. It changes texture on linedef.
Code: Select all
//string array holding the texture names; array is better, because it allows to hold multiple options
str statsGenDispAnim[22] = { "MNANM01",
"MNANM02",
"MNANM03",
"MNANM04",
"MNANM05",
"MNANM06",
"MNANM07",
"MNANM08",
"MNANM09",
"MNANM10",
"MNANM11",
"MNANM12",
"MNANM13",
"MNANM14",
"MNANM15",
"MNANM16",
"MNANM17",
"MNANM18",
"MNANM19",
"MNANM20",
"MNANM21",
"MNANM22", };
script "statsGeneratorAnimation" (void)
{
for(int count; count < 22; count++) //'for' loop automatically counts up to defined value; it's useful for purposes, where you need to automatically reach some value
{
SetLineTexture(297, SIDE_FRONT, TEXTURE_BOTTOM, statsGenDispAnim[count]); //every loop assigns new texture name from the string, based on the 'count' variable; you can put here almost everything
Delay(8); //delay is neccesary; without delay, you won't see any animation, because the script counts up to defined value and then stops. So you need to put some delay here, to see the animation. Delay is in ticks, so it's pretty simple to definig animation length in animdefs.
}
}
And for the HudMessages, as I said, you can draw images with it.
Here is simple function to display an image. It's a custom, user-defined function. It could be used as normal, built-in function, but you have to declare it before you want to use it (I mean, put this function before any script using it). If you want to read more about functions, look to zdoom wiki.
Code: Select all
function void printSprite(str msgSprite, int msgID, int msgX, int msgY, int delayX)
{
SetFont(msgSprite);
HudMessage(s:"A"; HUDMSG_PLAIN, msgID, CR_UNTRANSLATED, msgX, msgY, delayX);
}
And one useful custom function:
Code: Select all
function void eraseHudmsg(int msgID)
{
HudMessage(s:""; HUDMSG_PLAIN, msgID, CR_UNTRANSLATED, 0, 0, 0);
}
So, it simplifies the declaration. Instead of SetFont and HudMessage you write 'printSprite(str msgSprite, int msgID, int msgX, int msgY, int delayX)' and that's it.
So, for the animation you would need something like:
You have to keep in mind that arrays are counted from 0, so if you have four animation frames, their numbers will be 0 1 2 3.
Code: Select all
str animationSprites[] = {"<spriteName>", "<spriteName>", "<spriteName>", ...};
script "animtedItem" (void)
{
for(int counter, counter < 5, counter++)
{
printSprite(animationSprites[counter], counter, <correct X offset>, <correct Y offset>, 4);
Delay(4);
}
}
This will play you an animation sequence. But you have to lower the weapon, so this is other thing.