Creatures and Attack sounds: Difference between revisions

From PSwiki
Jump to navigation Jump to search
Created page with "In the Combat_Montage of our player character, we have the attack animation. In the attack animation segment we have one events (Notify) at the start of type PSAnimNotifyAttackSound File:PSAnimNotify.png In psAttack::Attack() we create a soundID = <race id (without gender)> - <Weapon skill> Example: Stonehammer hitting with a Fist = 0-4 this soundID is then sent to all clients this way: we call BroadcastAttackAnimation() to send it to all players in range, and..."
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
In the Combat_Montage of our player character, we have the attack animation. In the attack animation segment we have one events (Notify) at the start of type PSAnimNotifyAttackSound  
== Attack Sound ==
For humanoid and creatures we consider that they can use melee or use weapons. In the Combat_Montage of our player character, we have the attack animation. In the attack animation segment we have one events (Notify) at the start of type PSAnimNotifyAttackSound  


[[File:PSAnimNotify.png]]
[[File:PSAnimNotify.png]]


If you need to enable the attack sound on a creature, you need to add the PSAnimNotifyAttackSound in the attack Montage (not in the attack sequence).
In psAttack::Attack() we create a soundID with this rule:<blockquote>
if the weapon is melee then use the race: <race>-4 (because 4 is the melee skill ID)


In psAttack::Attack() we create a soundID = <race id (without gender)> - <Weapon skill>
otherwise use the weapon skill id: "w-" + <weapon skill>


Example: Stonehammer hitting with a Fist = 0-4
Example: Stonehammer hitting with a Fist = 0-4


this soundID is then sent to all clients this way: we call BroadcastAttackAnimation() to send it to all players in range, and then we call ReceiveAttackAnimation() on clients BP, this is then calling PlayPSAnimMontage()
Example: Stonehammer hitting with a sword = w-0</blockquote>this soundID is then sent to all clients this way: we call BroadcastAttackAnimation() to send it to all players in range, and then we call ReceiveAttackAnimation() on clients BP, this is then calling PlayPSAnimMontage()


Inside PlayPSAnimMontage() we use the soundid
Inside PlayPSAnimMontage() we use the soundid


UPSAnimNotifyAttackSound: <Race of Attacker> + "-" + <Weapon Type>
The class used is UPSAnimNotifyAttackSound


== Hit sound ==
When someone is hit.


In the Combat_Montage of the hit creature , example the trepor, we have one in the Hit animation of type PSAnimNotifyCombatResultSound
in psAttack::AffectTarget() we create a soundID <Weapon Type> + "-" + <Material> + <hit:1 or block:0>


[[File:PSAnimCombatResults.png]]
Material is defined in [[Race infoTable]].skin_type (0-flesh, 1-wood, 2-metal, 3-carapace, 4-fur, 5-slime)


Example: fist hitting carapare of a trepor: 4-3-1


UPSAnimNotifyCombatResultSound: <Weapon Type> + "-" + <Material> / Hit or Block
Example: sword getting blocked by flesh: 0-0-0
 
this soundID is then sent to all clients this way: we call BroacastCombatResultSound() to send it to all players in range
 
The hit sounds are decoupled from the hit animation because they need to play regardless.
 
== Death Sound ==
If we want to have a sound when the creature dies, we have it in the Death Montage, on the death animation
 
[[File:Death Sound.png]]

Latest revision as of 23:35, 28 January 2026

Attack Sound

For humanoid and creatures we consider that they can use melee or use weapons. In the Combat_Montage of our player character, we have the attack animation. In the attack animation segment we have one events (Notify) at the start of type PSAnimNotifyAttackSound

If you need to enable the attack sound on a creature, you need to add the PSAnimNotifyAttackSound in the attack Montage (not in the attack sequence).

In psAttack::Attack() we create a soundID with this rule:

if the weapon is melee then use the race: <race>-4 (because 4 is the melee skill ID)

otherwise use the weapon skill id: "w-" + <weapon skill>

Example: Stonehammer hitting with a Fist = 0-4

Example: Stonehammer hitting with a sword = w-0

this soundID is then sent to all clients this way: we call BroadcastAttackAnimation() to send it to all players in range, and then we call ReceiveAttackAnimation() on clients BP, this is then calling PlayPSAnimMontage()

Inside PlayPSAnimMontage() we use the soundid

The class used is UPSAnimNotifyAttackSound

Hit sound

When someone is hit.

in psAttack::AffectTarget() we create a soundID <Weapon Type> + "-" + <Material> + <hit:1 or block:0>

Material is defined in Race infoTable.skin_type (0-flesh, 1-wood, 2-metal, 3-carapace, 4-fur, 5-slime)

Example: fist hitting carapare of a trepor: 4-3-1

Example: sword getting blocked by flesh: 0-0-0

this soundID is then sent to all clients this way: we call BroacastCombatResultSound() to send it to all players in range

The hit sounds are decoupled from the hit animation because they need to play regardless.

Death Sound

If we want to have a sound when the creature dies, we have it in the Death Montage, on the death animation