Commit 5379e607 authored by Chris Robinson's avatar Chris Robinson

Handle the OnPCHitMe script variable

parent f215d2cc
......@@ -167,7 +167,15 @@ namespace MWClass
return;
}
// TODO: Handle HitOnMe script function and OnPCHitMe script variable.
// TODO: Handle HitOnMe script function
if(!attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
{
const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript;
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
if(!script.empty())
ptr.getRefData().getLocals().setVarByInt(script, "onpchitme", 1);
}
float health = getCreatureStats(ptr).getHealth().getCurrent() - damage;
setActorHealth(ptr, health, attacker);
......
......@@ -392,7 +392,15 @@ namespace MWClass
return;
}
// TODO: Handle HitOnMe script function and OnPCHitMe script variable.
// TODO: Handle HitOnMe script function
if(!attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
{
const std::string &script = ptr.get<ESM::NPC>()->mBase->mScript;
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
if(!script.empty())
ptr.getRefData().getLocals().setVarByInt(script, "onpchitme", 1);
}
if(damage > 0.0f)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment