canary icon indicating copy to clipboard operation
canary copied to clipboard

[Enhancement] Protocol 13.05 (Sound effects)

Open marcosvf132 opened this issue 2 years ago • 2 comments

Preview

https://user-images.githubusercontent.com/66353315/193288117-be5d4df1-d6ac-4a07-8e6d-84cf00542327.mp4

WIP

  • This PR implement a huge amount of features ingame that need time and test to verify all of then and to adjust the details on it.

Musics and anthem

  • Musics and anthem are not on this PR yet because i'm still catalogating then all, check for further commits on this PR.

Features implemented so far

Player combat

  • Player weapon sounds are implemented, with future adjustments like a specifc sound on a different item.
  • Wand and rods so far have the same sound, which will be changed on the next commits.

Monster combat

  • There is a script that run on monster spell declarations that automaticlly detect which spell sound it should be.
  • If the user want's to select a custom sound to a spell, can use the following tags: image image

Item movement

  • All items have sound on their movement, some can have the wrong sound, if you know an item that does not have the sound so accurated, please help me improving it.

Npc sounds

  • The NPC Canary does emit sounds on his sourrounds, check the new functions label on this description for more information.

New function

Enums

  • We have a LOT of sounds on tibia (512 so far), all those sounds are catalogated on the /src/creatures/creatures_definitions.hpp file, rigth here: image

NOTE: You can use then all on LUA env

C++

Sound movement

  • The item sound movement comes from this new function, based on item loot category. I know this is not 100% accurated but its the best shot so far.
  • The sound can change if the it's is being moved inside depot or player backpacks/inventory on the game.cpp call. image

Sound notification to spectators

  • On this topic we have 2 new functions, the first one is used to send a unique sound to the spectators on the area. It already check the sound source if it's coming from the own player, other player, a creature or it's meant to be a global sound. This source type is used on the client to balance and mix the volume as the player desire. image
  • This second function is used on distance weapons or any other sound that must be reproduced on a sequence. Like a casting sound and an impact sound. image

OnThink sounds

  • Some creatures emits sounds while in battle or when you get close to then. The first function is for the NPCs: image
  • The monsters sounds: image

Player client functions

  • The player.h functions are used to send the sound to the client, can be used to send a sound directly to the player client and not send to all the players on the area. image

Player sound functions

  • Functions that return the sound ID by the weapond attack and impact sound.
  • Impact function: image
  • Attack function: image

LUA

Spell (local spell = Spell("spell"))

  • We have the possibility to add sounds on the spell, can be the sound when casting the spell AND the sound when the spell hits the target/area.
  • Casting sound: image
  • Impact sound: image

Bestiary charm

  • We have the possibility to add sounds on the spell, can be the sound when casting the spell AND the sound when the spell hits the target/area. image

Npc

  • You can add sound effects on the NPC just like the old text system, can be used as a environment sound as a blacksmith sound, hitting a wood, casting a spell etc.
  • A random sound will be picked on the list to be reproduced. image

Position

  • You can used this function to send sounds on the specific position, just like the position:sendMagicEffect(...) image image

The optional 'actor' on this function right here can be used to specify if you want to send the sound pretending is was coming from the creature. If you don't send a creature on the param, it will be sent as a global sound.

XML

  • The imbuement system can emits sounds too, you can set a sound on the imbuements.xml files be using the id: image

marcosvf132 avatar Sep 30 '22 13:09 marcosvf132

It seems that after the last changes, spells and runes are not playing any sounds. Was it tested after these few changes?

I've noticed that the limits to max health and max mana were changed, but the mana display is still locked at 65535. Is this intended?

For the rest, it looks great!

Peixonauta2 avatar Oct 20 '22 05:10 Peixonauta2

Nice! That fixed it.

With that, I've noticed that monsters are not playing sounds when casting a script spell.

I've added this code to bool InstantSpell::executeCastSpell(Creature* creature, const LuaVariant& var) and it fixed it temporarily if (soundCastEffect != SOUND_EFFECT_TYPE_SILENCE) { g_game().sendDoubleSoundEffect(creature->getPosition(), soundCastEffect, soundImpactEffect, creature); }

Still don't know if that is the best choice.

Peixonauta2 avatar Oct 22 '22 02:10 Peixonauta2

It seems that there's a problem with this new way to handle the store. After some interaction with the menu, the client crashes:

Animação

After that crash, every time any character tries to open the store, the client will crash. Server restart is required to "fix" it until someone make it crashable again.

After buying a Hireling, the client also crashes.

Peixonauta2 avatar Oct 24 '22 01:10 Peixonauta2

@Peixonauta2 Did you manage to solve it?

tutbarao avatar Nov 11 '22 04:11 tutbarao

Same issue, error seems to be somewhere here in the disabled reasons but unsure on how to fix it.

local canBuy = player:canBuyOffer(offer)
		if (canBuy.disabled == 1) then
			for index, disableTable in ipairs(disableReasons) do
				if (canBuy.disabledReason == disableTable.reason) then
					offer.disabledReadonIndex = index
				end
			end

			if (offer.disabledReadonIndex == nil) then
				offer.disabledReadonIndex = #disableReasons
				table.insert(disableReasons, canBuy.disabledReason)
			end
		end

aokisama avatar Dec 07 '22 13:12 aokisama

As far as I've tested, the problems I've found are in the spells used by monsters that still don't play any sound - I guess that there is missing the new function to play a sound in InstantSpell::executeCastSpell, and the problem of the store crashing the client after a few interactions.

Peixonauta2 avatar Dec 23 '22 21:12 Peixonauta2

As far as I've tested, the problems I've found are in the spells used by monsters that still don't play music - I guess that there is missing the new function to play a sound in InstantSpell::executeCastSpell, and the problem of the store crashing the cliente after a few interactions.

Not the entire sound system will be done on this pull. Only a few things were implemented. As for the store, it has already been corrected.

dudantas avatar Dec 28 '22 15:12 dudantas

Everything seems fine by now.

Peixonauta2 avatar Jan 03 '23 17:01 Peixonauta2

Everything seems fine by now.

Can you test again? We've made several changes related to wrong conversions. It will probably be necessary to test several things, from attack, combat, mana, health, etc.

dudantas avatar Jan 28 '23 01:01 dudantas

Tested Yesterday in a fresh machine and runs without any issue & stable.

Olimpotibia avatar Jan 29 '23 09:01 Olimpotibia

I was testing this code and it causes a server crash when using objects or food

mebriso avatar Jan 30 '23 00:01 mebriso

When selecting an object in the market and pressing the down key and keeping it pressed for a while, the tibia client breaks

mebriso avatar Jan 30 '23 06:01 mebriso

When attacking a creature, it stays red alive on first hit and doesn't die.

mebriso avatar Jan 31 '23 05:01 mebriso

when walking with the character outside the city the character walks without movement it is as if he were floating

mebriso avatar Jan 31 '23 20:01 mebriso

We are going to develop this branch again, soon we will have news about the bug reports that have been made.

dudantas avatar Feb 13 '23 17:02 dudantas

I was testing this code and it causes a server crash when using objects or food

image image image

You need to be more specific... Which item? I was unable to reproduce crash.

dudantas avatar Feb 13 '23 21:02 dudantas

It was fixed in a commit that said fix condition a few days ago that was uploaded to this pr. Only the bugs that the characters walk badly outside the city or when you take out skull and the bugs with the life charge of the creatures when you hit them that they remain black having a lifetime

mebriso avatar Feb 14 '23 02:02 mebriso

It was fixed in a commit that said fix condition a few days ago that was uploaded to this pr. Only the bugs that the characters walk badly outside the city or when you take out skull and the bugs with the life charge of the creatures when you hit them that they remain black having a lifetime

Ok... I'm looking into this one right now.

dudantas avatar Feb 14 '23 02:02 dudantas

When attacking a creature, it stays red alive on first hit and doesn't die.

Fixed. Thanks for reporting.

dudantas avatar Feb 14 '23 04:02 dudantas

When attacking a creature, it stays red alive on first hit and doesn't die.

Fixed. Thanks for reporting.

There's similar bug now. When you score a bloodhit on something health status does not update- game shows it to be full hp no matter how much hp creature has.

4190 avatar Feb 19 '23 19:02 4190

Mixed up display of club fighting and distance fighting in client.

When you skill up dist skill- bar under and number next to club fighting goes up Same when you skill up club skill - bar under and number next to distance fighting goes up

Skill itself works correctly it just got mixed up in display.

obraz

4190 avatar Feb 24 '23 00:02 4190

looks like sweet but server is some lagged sometimes.

Olimpotibia avatar Feb 25 '23 17:02 Olimpotibia

Cloning items bug. How to reproduce- Have some items in depot box (doesn't matter which one, let's use depot box number 1)

Put one of items on market for sale Remove the sell offer so the item goes back to inbox Logout and login All of items from depot box get cloned into inbox.

4190 avatar Mar 02 '23 13:03 4190

manaleach and lifeleach are displayed incorrectly from the xml to the client and also add much more than it should give in manaleach and lifeleach, this could be happening with all the imbuiments

codigostrueno avatar Mar 13 '23 09:03 codigostrueno

when you have a shared party and a member dies, they are not expelled and the shared party is lost

codigostrueno avatar Mar 14 '23 03:03 codigostrueno

when summoning a familiar and it dies it continues to appear infinitely

codigostrueno avatar Mar 15 '23 16:03 codigostrueno

Cloning items bug. How to reproduce- Have some items in depot box (doesn't matter which one, let's use depot box number 1)

Put one of items on market for sale Remove the sell offer so the item goes back to inbox Logout and login All of items from depot box get cloned into inbox.

Can you explain better, I could not replicate

lucassaraiva5 avatar Mar 15 '23 22:03 lucassaraiva5

video evidence for cloning market https://www.youtube.com/watch?v=q2WFxA2806c

codigostrueno avatar Mar 16 '23 01:03 codigostrueno

making look at items that have attribute absorb percentage does not show the element well

codigostrueno avatar Mar 16 '23 02:03 codigostrueno