[zscript] Determine if ripper projectile is activly ripping?

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.

[zscript] Determine if ripper projectile is activly ripping?

Postby zrrion the insect » Tue Feb 13, 2018 1:06 pm

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.
User avatar
zrrion the insect
Like a fish in a child's hands.
 
Joined: 25 Jun 2009
Location: Time Station 1: Moon of Glendale

Re: [zscript] Determine if ripper projectile is activly ripp

Postby Xaser » Wed Feb 14, 2018 12:11 pm

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. :shrug:
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: [zscript] Determine if ripper projectile is activly ripp

Postby zrrion the insect » Wed Feb 14, 2018 6:10 pm

SpecialMissileHit did the trick! Thank you for your help.
User avatar
zrrion the insect
Like a fish in a child's hands.
 
Joined: 25 Jun 2009
Location: Time Station 1: Moon of Glendale

Re: [zscript] Determine if ripper projectile is activly ripp

Postby Arctangent » Wed Feb 14, 2018 7:18 pm

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. :shrug:

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.
User avatar
Arctangent
squawky
 
Joined: 06 Nov 2014
Discord: SquawkyAtan#2371

Re: [zscript] Determine if ripper projectile is activly ripp

Postby zrrion the insect » Wed Feb 14, 2018 11:10 pm

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 allExpand view
override int SpecialMissileHit (Actor victim)
    {
        if (victim != target && victim.bSHOOTABLE && !victim.bDontRip)
        {
            HasRipped = TRUE;
        }
        return super.SpecialMissileHit(victim);
    
User avatar
zrrion the insect
Like a fish in a child's hands.
 
Joined: 25 Jun 2009
Location: Time Station 1: Moon of Glendale


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest