[zscript] Determine if ripper projectile is activly ripping?
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!)
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!)
- zrrion the insect
- Posts: 2411
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
[zscript] Determine if ripper projectile is activly ripping?
Thread title. What would be the best way to determine if a ripper projectile is actively ripping through an actor? I am trying to make an actor that changes behavior after ripping through a actor.
Re: [zscript] Determine if ripper projectile is activly ripp
Unless you're using the fancy-pants RipperLevel properties anywhere, overriding CanCollideWith in the projectile and checking if the other actor is bShootable and not bDontRip ought to suffice (don't forget to return true, too). Even though canonically that function is for testing if two objects are allowed to collide with each other, it's currently the best place to do special stuff when actors come in contact.
(If on the off chance your projectile has +NOBOSSRIP, you'll want to check to make sure the target doesn't have the bBoss flag set as well. I think that's all the edge cases, though chime in if something's missing).
[EDIT] There's also the SpecialMissileHit virtual, which would let you do the same thing and might be a slightly better place for it. Presumably there's some practical difference between the two, but I'm really not sure what it is, even after looking at the source.
(If on the off chance your projectile has +NOBOSSRIP, you'll want to check to make sure the target doesn't have the bBoss flag set as well. I think that's all the edge cases, though chime in if something's missing).
[EDIT] There's also the SpecialMissileHit virtual, which would let you do the same thing and might be a slightly better place for it. Presumably there's some practical difference between the two, but I'm really not sure what it is, even after looking at the source.
- zrrion the insect
- Posts: 2411
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
Re: [zscript] Determine if ripper projectile is activly ripp
SpecialMissileHit did the trick! Thank you for your help.
- Arctangent
- Posts: 1235
- Joined: Thu Nov 06, 2014 1:53 pm
- Contact:
Re: [zscript] Determine if ripper projectile is activly ripp
SpecialMissileHit occurs after a good chunk of checks have already been made, such as ProjectilePassHeight, +THRUGHOST, and +MTHRUSPECIES handling. If you use CanCollideWith instead, then you may need to reimplement these checks depending on what you shove into it.Xaser wrote:There's also the SpecialMissileHit virtual, which would let you do the same thing and might be a slightly better place for it. Presumably there's some practical difference between the two, but I'm really not sure what it is, even after looking at the source.
- zrrion the insect
- Posts: 2411
- Joined: Thu Jun 25, 2009 1:58 pm
- Location: Time Station 1: Moon of Glendale
Re: [zscript] Determine if ripper projectile is activly ripp
THe way I did it the actual behavior changes don't happen in SpecialMissileHit itself and it calls super.SpecialMissileHit anyway so I ended up not having to redo much of anything.
Code: Select all
override int SpecialMissileHit (Actor victim)
{
if (victim != target && victim.bSHOOTABLE && !victim.bDontRip)
{
HasRipped = TRUE;
}
return super.SpecialMissileHit(victim);
}