×
Меню
Индекс

MSFD Use sound to detect events

 
This to me was a very smart idea (thanks to BalorNG), so it bears mentioning again here, although it’s also described in the sound section above. You can use the GetSoundPlaying function to determine certain events in the game that would otherwise not be accessible. Just take a look at the sounds in the Gameplay/sounds menu, and it may give you some ideas: determine if someone is falling, determine whether a certain monster is near, determine a hit with a weapon etc.
Here is some more info on this (thanks Horatio):
GetSoundPlaying is a very powerful command that can be used to detect when the PC ( and I’m assuming other Actors ) is doing a certain action like casting a spell or swinging a weapon. I used it in my spellcasting mod to determine when the PC is casting a spell and what school of magic the spell is in. the format is as follows:
 
if ( player->GetSoundPlaying, "Sound ID" == 1 )
;do something cool here
endif
 
Look in the sounds menu in the TESCS to find which Sound ID  corresponds to a specific action. For instance "illusion cast" corresponds to the player casting an illusion based spell. You'll probably have to experiment a little. Note: for some reason the Sound ID "drink" causes an error, so no checking if the PC is drinking a potion.