Difference between revisions of "Talk:WillIntimidateSucceed - Actor"
Jump to navigation
Jump to search
imported>DavidJCobb m (typo in method name) |
imported>DavidJCobb (GetLevel ID'd) |
||
Line 1: | Line 1: | ||
I found this function in a disassembler; the calculations translate as follows: | I found this function in a disassembler; the calculations translate as follows: | ||
<source lang="cpp">SInt16 TESActorBaseData:: | <source lang="cpp">SInt16 TESActorBaseData::GetLevel() { | ||
if (!(this->flags & kFlag_PCLevelMult)) | if (!(this->flags & kFlag_PCLevelMult)) | ||
return this->level; | return this->level; | ||
Line 22: | Line 22: | ||
float a = (speechPlayer - speechTarget) / 100.0; | float a = (speechPlayer - speechTarget) / 100.0; | ||
float c = pow(1.0 + max(-1.0, a), GMST:fIntimidateSpeechcraftCurve); | float c = pow(1.0 + max(-1.0, a), GMST:fIntimidateSpeechcraftCurve); | ||
SInt16 | SInt16 levelPlayer = (*g_thePlayer)->baseForm->actorData.GetLevel(); | ||
SInt32 | SInt32 levelTarget = this->baseForm->actorData.GetLevel(); | ||
// | // | ||
float esp0C = | float esp0C = levelPlayer * c; | ||
CalculatePerkData(kEntryPoint_Mod_Player_Intimidation, *g_thePlayer, this, &esp0C); | CalculatePerkData(kEntryPoint_Mod_Player_Intimidation, *g_thePlayer, this, &esp0C); | ||
// | // | ||
Line 35: | Line 35: | ||
// Based on later usage, esp0C == how scary the player is. | // Based on later usage, esp0C == how scary the player is. | ||
// | // | ||
float esp04 = | float esp04 = levelTarget; // how scary is the NPC? | ||
float confidenceMult; | float confidenceMult; | ||
SInt32 confidence = this->baseForm->aiForm.GetConfidence(); | SInt32 confidence = this->baseForm->aiForm.GetConfidence(); | ||
Line 61: | Line 61: | ||
[[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 2018-08-07T09:03:00 (EDT) | [[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 2018-08-07T09:03:00 (EDT) | ||
:Update: Confirmed that that support method is a level getter; Papyrus Actor.GetLevel is a wrapper for it. [[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 2018-08-08T06:35:08 (EDT) |
Latest revision as of 05:35, 8 August 2018
I found this function in a disassembler; the calculations translate as follows:
SInt16 TESActorBaseData::GetLevel() {
if (!(this->flags & kFlag_PCLevelMult))
return this->level;
SInt32 result = this->level;
float a = this->level / 1000.0;
if ((*g_thePlayer)->baseForm) {
SInt32 playerLevel = (*g_thePlayer)->baseForm->actorData.level;
result = (playerLevel * a);
}
if (this->minLevel > 0 && result < this->minLevel)
return this->minLevel;
if (this->maxLevel > 0 && result > this->maxLevel)
return this->maxLevel;
return result;
};
bool Actor::WillIntimidateSucceed() {
double speechPlayer = (*g_thePlayer)->actorValueOwner->GetCurrent(0x11); // SpeechCraft
float speechTarget = this->actorValueOwner.GetCurrent(0x11);
float a = (speechPlayer - speechTarget) / 100.0;
float c = pow(1.0 + max(-1.0, a), GMST:fIntimidateSpeechcraftCurve);
SInt16 levelPlayer = (*g_thePlayer)->baseForm->actorData.GetLevel();
SInt32 levelTarget = this->baseForm->actorData.GetLevel();
//
float esp0C = levelPlayer * c;
CalculatePerkData(kEntryPoint_Mod_Player_Intimidation, *g_thePlayer, this, &esp0C);
//
// CalculatePerkData took a perk type, two actors, and a pointer to esp0C. This
// means that it can read and modify esp0C however it wishes. That function
// handles EVERY perk, so I'm not gonna even try to figure out what it's doing
// here, lol
//
// Based on later usage, esp0C == how scary the player is.
//
float esp04 = levelTarget; // how scary is the NPC?
float confidenceMult;
SInt32 confidence = this->baseForm->aiForm.GetConfidence();
switch (confidence) {
case 0:
esp04 *= GMST:fIntimidateConfidenceMultCowardly;
break;
case 1:
esp04 *= GMST:fIntimidateConfidenceMultCautious;
break;
case 2:
esp04 *= GMST:fIntimidateConfidenceMultAverage;
break;
case 3:
esp04 *= GMST:fIntimidateConfidenceMultBrave;
break;
case 4:
esp04 *= GMST:fIntimidateConfidenceMultFoolhardy;
break;
}
return (esp04 <= esp0C); // NPC less scary than player?
}
First draft, mind you.
DavidJCobb (talk) 2018-08-07T09:03:00 (EDT)
- Update: Confirmed that that support method is a level getter; Papyrus Actor.GetLevel is a wrapper for it. DavidJCobb (talk) 2018-08-08T06:35:08 (EDT)