Non bounce projectile disappear in water

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
peewee_RotA
Posts: 407
Joined: Fri Feb 07, 2014 6:45 am

Non bounce projectile disappear in water

Post by peewee_RotA »

In zscript I have a projectile based on VolcanoBlast. It has gravity 0.125 and almost all of the same properties. This is a standard projectile with gravity, not a bouncey projectile.

I want it to disappear if it hits water.

My understanding is that removing the related water flag (-EXPLODEONWATER) only works if it is considered a bounce projectile.

So my question is: how do I get this projectile to explode on floors but disappear in water?

Thanks!
peewee_RotA
Posts: 407
Joined: Fri Feb 07, 2014 6:45 am

Re: Non bounce projectile disappear in water

Post by peewee_RotA »

As an update, I am using a workaround. It is now a bouncey projectile, but I have it emulate a normal projectile impact
Spoiler:
Heisanevilgenius
Posts: 95
Joined: Wed Dec 15, 2021 8:38 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: Non bounce projectile disappear in water

Post by Heisanevilgenius »

There is a variable "waterlevel" that you can use to check if the projectile is underwater, and if true, you can have it make your projectile disappear.

Code: Select all

VFBL A 0
{
if (waterlevel > 0)
  {
    return ResolveState("Disappear");
  }
  return ResolveState(null);
}
User avatar
Enjay
 
 
Posts: 27072
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Non bounce projectile disappear in water

Post by Enjay »

I usually go for a slightly simply syntax:

Code: Select all

FLRE A 0 A_JumpIf(waterlevel > 0, "Spent"); //jump straight to spent if under water
For what it's worth, this page explains the values for waterlevel:
https://zdoom.org/wiki/Swimming#Waterlevel



However, I note that the original query says "I want it to disappear if it hits water", although the title says "in water". So, if peewee_RotA wants the projectile to disappear when it hits regular non-deep water (like the liquids in vanilla Doom maps) I don't think waterlevel will help.
peewee_RotA
Posts: 407
Joined: Fri Feb 07, 2014 6:45 am

Re: Non bounce projectile disappear in water

Post by peewee_RotA »

That's for the info.

I'm targeting vanilla heretic maps. I'll give it a try.
Post Reply

Return to “Scripting”