mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-02 04:45:32 +00:00
Use iVoiceHitOdds
This commit is contained in:
parent
15e48107f7
commit
d9d6f37619
1 changed files with 7 additions and 1 deletions
|
@ -615,7 +615,13 @@ namespace MWClass
|
||||||
// 'ptr' is losing health. Play a 'hit' voiced dialog entry if not already saying
|
// 'ptr' is losing health. Play a 'hit' voiced dialog entry if not already saying
|
||||||
// something, alert the character controller, scripts, etc.
|
// something, alert the character controller, scripts, etc.
|
||||||
|
|
||||||
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
int chance = store.get<ESM::GameSetting>().find("iVoiceHitOdds")->getInt();
|
||||||
|
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||||
|
if (roll < chance)
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
|
||||||
|
}
|
||||||
getCreatureStats(ptr).setAttacked(true);//used in CharacterController
|
getCreatureStats(ptr).setAttacked(true);//used in CharacterController
|
||||||
|
|
||||||
if(object.isEmpty())
|
if(object.isEmpty())
|
||||||
|
|
Loading…
Reference in a new issue