Author Topic: Two Different Hit Sounds?  (Read 1240 times)

Would it be possible to make it so that when you hit a wall/brick it makes one sound while if you hit a person it will make a different sound?

Would it be possible to make it so that when you hit a wall/brick it makes one sound while if you hit a person it will make a different sound?
Hitting it as in a projectile hits it?

Hitting it as in a projectile hits it?

well I'm trying it for a sword for now.

You could let it check what type the hitted thing is.
Code: [Select]
%colType = %col.getType(); //%col changes to CorpseObjectType if you kill a player
if(%colType & $TypeMasks::put_a_TypeMask_here)


TypeMasks:
Raycasting bricks:        $TypeMasks::FxBrickObjectType
AI/Players:                   $TypeMasks::PlayerObjectType
Static shapes               $TypeMasks::StaticObjectType
Terrain:                        $TypeMasks::TerrainObjectType
                                    $TypeMasks::VehicleObjectType
This is from the support script from raycasting stuff, but it can also be used with:
function PutProjectileNameHere::onCollision(%this,%obj,%col,%fade,%pos,%normal)

Then you can use the above to let it play a sound in the right circumstances, like when you hitted a player/wall/whatever.
« Last Edit: May 11, 2010, 03:32:05 PM by lordician »

Script language overlode. :C

I suck at scripting. I need to look at a guide a friend sent me to understand this stuff. |:[

like, I don't even know where to put the script code part so it plays the sound itself. :(

Script language overlode. :C

I suck at scripting. I need to look at a guide a friend sent me to understand this stuff. |:[

like, I don't even know where to put the script code part so it plays the sound itself. :(
lolwin

somehow I suggest just editing existing weapons and playing around with things before going revolutionary. It will help you learn the basics just playing around. thats what I am doing..

Well, Look in the TF2 Basic Melee pack. They did it there.

Well, Look in the TF2 Basic Melee pack. They did it there.
Not like he wants it.
The Melee pack has two random sounds when it hits anything, however, Boom wants it to be a specific sound on a specific hit.

I gave him the needed piece of code as far as i know.

The TF2 melee set uses one of two random hit sounds for walls/bricks and then a different one for hitting a player, however that's set by the raycast weapon script rather than for projectiles.

Look at my Player->playSound event mod for how to play a specific sound in the server from a position.

The TF2 melee set uses one of two random hit sounds for walls/bricks and then a different one for hitting a player, however that's set by the raycast weapon script rather than for projectiles.

Look at my Player->playSound event mod for how to play a specific sound in the server from a position.
Speaking of your raycasting weapons, they don't cause damage to bricks, yet normal projectiles do. I don't want to use an explosion for this.

In other words, they don't call onProjectileHit.

They call the function Image::onHitObject(%this,%obj,%slot,%col,%pos,%normal,%shotVec) which you could use to detect the colliding object's type and destroy it if minigameCanDamage + small brick.

I think they should call fxDtsBrick::onProjectileHit regardless incase someone decides to use events instead of scripts.

The TF2 melee set uses one of two random hit sounds for walls/bricks and then a different one for hitting a player, however that's set by the raycast weapon script rather than for projectiles.

Look at my Player->playSound event mod for how to play a specific sound in the server from a position.
Oh yes, that's right.
Code: [Select]
   raycastExplosionBrickSound = tf2MeleeHitBrickSoundA;
   raycastExplosionPlayerSound = swordHitSound;
(For example)
However, he never stated he used raycasts, so i just thought to do it via the projectile.

Not like he wants it.
The Melee pack has two random sounds when it hits anything, however, Boom wants it to be a specific sound on a specific hit.

I gave him the needed piece of code as far as i know.

I know what I'm talking about. It has: WeaponHitPlayer, and WeaponHitBrick sounds.