Talk:WillIntimidateSucceed - Actor
Revision as of 05:35, 8 August 2018 by imported>DavidJCobb (GetLevel ID'd)
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)