Author Topic: [beta] Fast projectiles support  (Read 5372 times)

Then I could have it check the projectile datablock for custom sounds. Can you give me an example of a system that you would find most useful?
you'd probably wanna do something like this

first choose default sound if a db sound exists check if theres a sound count to choose a random one otherwise just choose sound 0 assuming theres only one sound then play the sound

Code: [Select]
sound = default sound;
if(db.bulletFlyBySound[0] !$= "")
{
if(db.bulletFlyBySoundCnt !$= "")
{
sound = db.bulletFlyBySound[getRandom(0,db.bulletFlyBySoundCn)];
}
else
{
sound = db.bulletFlyBySound[0];
}
}
play sound

how do fly by sounds even work? just a boxcontainer along the raycast line, check for players, and play that sound to them at a certain time?

how do fly by sounds even work? just a boxcontainer along the raycast line, check for players, and play that sound to them at a certain time?
box container searches are expensive. he likely just iterates through the client list, and for each player calculates the closest point on the raycast vector to the player, and plays the sound there if they're close enough.

how do fly by sounds even work? just a boxcontainer along the raycast line, check for players, and play that sound to them at a certain time?

Pretty much what Conan said (Thanks btw Conan, I looked at your code as a reference)

1. Determines your closest point to the vector of that raycast, and then calculates the distance between your position and the closest point
2. If you're within the fly-by sound radius it will then check to make sure that the closest point on the vector is actually within the space of the raycast (so you're not hearing fly by sounds for a bullet that is yet to pass)
3. Compares the angle between the vector between the start point of the raycast and the player position, and the vector of the bullet, and if the angle is less than 90 we can assume that the bullet is coming towards you and not away from you
4. Calls the play3D method on the client object with the chosen fly-by sound and the closest point along the vector as the position

Originally I was doing some spaghetti bullstuff radius search stuff that made loud or quiet sounds or none at all depending on how far away you were from the middle of the raycast, you can actually look at my DMR weapon if you want to see lmfao
« Last Edit: March 27, 2018, 04:25:33 AM by Rally »

Sick stuff once more, used it in my new gun and it works great except when I give the gun to a bot the bot can't damage me. That's probably stuffty code on my end tho.

My fault brah. Since bots don't have clients minigameCanDamage will rule out bot damage. I can fix it by accepting a %player argument instead of a client but it'd require everyone to update their code lol.

My fault brah. Since bots don't have clients minigameCanDamage will rule out bot damage. I can fix it by accepting a %player argument instead of a client but it'd require everyone to update their code lol.
actually most code has support for player to client interaction for damage calculation. check the default minigamecandamage code to see. often it seems the objects are not client to client