"Clean" way to inflict continuous damage

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

"Clean" way to inflict continuous damage

Post by Apeirogon »

Is there are any "clean" way to damage some monster some certain amount of time, like burning?
I can use overridden do effect inventory virtual, which damage its owner every tick and given to monster on attack. But I want to know is there are another way to do so with build in functions.
User avatar
hideousdestructor
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

Re: "Clean" way to inflict continuous damage

Post by hideousdestructor »

I don't think a truly "clean" method exists.

My own favourite at the moment is to have a projectile continuously call DamageMobj against the actor it has hit until it runs out.
ZzZombo
Posts: 339
Joined: Mon Jul 16, 2012 2:02 am

Re: "Clean" way to inflict continuous damage

Post by ZzZombo »

Given you already somehow have the reference of the target actor:
  • Call an ACS script on it to damage it. Can easily configure damage interval, damage amount and duration.
  • Make it launch a static, invisible and otherwise harmless missile that hurts its target in a possibly looped state sequence. Can also configure those properties by tweaking the state sequence; by warping it to the actor and giving an appropriate appearance you can also display "burning" FX. You can force the victim launch the said missile even w/o making any changes to it by giving it a `CustomInventory` that calls missile spawning function in its `Pickup` sequence.
  • A variation of the above, spawn a regular actor instead of the missile and save the victim in an actor field such as `master` and then act on that reference. This is less hacky since it doesn't abuse missiles into doing something they weren't designed for, but requires to store and manage the reference to the victim yourself.
  • In ZScript, you have much better ways, like a custom `Tick` override to do damage given some variables set on the actor, a dedicated `PeriodicDamage` routine, etc.
Last edited by ZzZombo on Wed Jun 10, 2026 1:57 am, edited 1 time in total.
User avatar
hideousdestructor
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

Re: "Clean" way to inflict continuous damage

Post by hideousdestructor »

I'm going to take Graf's response here as the "official" recommended way to do it, inasmuch as any exists especially given his comment at the end:
Graf Zahl wrote:You do not need hacks. What you need is a thinker that periodically inflicts the damage. Internally I couldn't do it any other way.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: "Clean" way to inflict continuous damage

Post by Apeirogon »

I try to do example for this, but I cant understand how make ticking thinker.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: "Clean" way to inflict continuous damage

Post by Graf Zahl »

Every thinker ticks, unless you change its statnum to something explicitly non-thinking.

Return to “Scripting”