forked from mirror/openmw-tes3mp
Handle the OnPCHitMe script variable
This commit is contained in:
parent
f215d2cc30
commit
5379e607cb
2 changed files with 18 additions and 2 deletions
|
@ -167,7 +167,15 @@ namespace MWClass
|
||||||
return;
|
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;
|
float health = getCreatureStats(ptr).getHealth().getCurrent() - damage;
|
||||||
setActorHealth(ptr, health, attacker);
|
setActorHealth(ptr, health, attacker);
|
||||||
|
|
|
@ -392,7 +392,15 @@ namespace MWClass
|
||||||
return;
|
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)
|
if(damage > 0.0f)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue