UE2 - UT2kX Grenade explosion when hitting a specific surface . . how?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

darwin604

New Member
Mar 6, 2008
4
0
0
Vancouver, BC
I'm currently working on a pseud-bowling mod for school. I have the pins set up as karma actors and they're flying around fine when I shoot them with the link gun/shock rife/etc so that's fine. I've based my bowling ball off the assault rifle grenade projectile and I'm wondering how I could get the ball to explode only when it hits the 'pins'.

I've been thinking of setting the surface properties of the KActor and performing a check in there to trigger the explosion function but I think my code is off. What I have is (just cut part of it out where I added it . . it's the assault rifle grenade class): (set the kactor surface to flesh)

Code:
simulated function HitWall( vector HitNormal, actor Wall )
{
    local Vector VNorm;
	local PlayerController PC;

    if ( SurfaceType == EST_Flesh)    /// attempting to check surface for flesh and explode
	{
       Explode(Location, HitNormal);
       return;
    }

    if ( (Pawn(Wall) != None) || (GameObjective(Wall) != None) )
	{
		Explode(Location, HitNormal);
		return;
	}

    if (!bTimerSet)
    {
        SetTimer(ExplodeTimer, false);
        bTimerSet = true;
    }

    // Reflect off Wall w/damping
    VNorm = (Velocity dot HitNormal) * HitNormal;
    Velocity = -VNorm * DampenFactor + (Velocity - VNorm) * DampenFactorParallel;

    RandSpin(100000);
    DesiredRotation.Roll = 0;

I added the if statement for SurfaceType but the ball is just bouncing off the thing. What am I doing wrong? Also if there's an easier way to just get a grenade to go off when hitting a certain surface (like the way it does when it hits a player) I'm open for suggestions.

Thanks!
 

ZippyDSMlee

New Member
May 11, 2006
386
0
0
If it helps any grenades tend to "cut" through shock balls and rockets,the only modification I made to them look like a flying shock ball with a smoke trail, I doubt this info will be of much help but sometimes every lil bit of info helps.
 

darwin604

New Member
Mar 6, 2008
4
0
0
Vancouver, BC
If it helps any grenades tend to "cut" through shock balls and rockets,the only modification I made to them look like a flying shock ball with a smoke trail, I doubt this info will be of much help but sometimes every lil bit of info helps.

The appearance and function of my 'bowling ball launcher' (aka reskinned grenade launcher) and karma (KActor) pins are both fine. All I'm trying to do is get it so when the ball (basically a grenade) detonates instantly on hitting a pin (exactly the same as it does when it hits another player) - instead of bouncing off of it.

In short form basically I want a grenade to explode upon hitting a karma actor the same way it does when it hits a player/bot and need to figure out what to change in the grenade projectile class to make this possible.
 

ZippyDSMlee

New Member
May 11, 2006
386
0
0
The appearance and function of my 'bowling ball launcher' (aka reskinned grenade launcher) and karma (KActor) pins are both fine. All I'm trying to do is get it so when the ball (basically a grenade) detonates instantly on hitting a pin (exactly the same as it does when it hits another player) - instead of bouncing off of it.

In short form basically I want a grenade to explode upon hitting a karma actor the same way it does when it hits a player/bot and need to figure out what to change in the grenade projectile class to make this possible.

that went totaly over my head (not really but kinda)

Anyway I managed to dup my glitch to a new grenade I am working on FT_Constant and a large force radius/scale(above 10)tends to exploded on the wrong things, maybe just maybe you have your force radius/scale to high.

I am just a code nawer sorry I am no real help ><