Hello all. I am trying to "pause' a battle between a PC and an NPC when the NPC reaches a certain number of HP; in this case, 1 HP.
I set the NPC to immortal, so I am not worried about a crit sneaking through ruining my convo. But what I am having trouble with is getting my PC to "settle down", as he remains hostile no matter what I have tried, and cannot engage in a conversation because he is "too excited" to talk to the NPC.
Below is the script I wrote, and I know, it looks like crap. I tried everything I could think of, looking in the Lexicon to see what functions approximate the behavior I am trying to achieve, but I just can't either
a) Get the order right
or
I am missing another crucial command.
Can anyone help me with this?
Thanks, Russell
'>
//placed in the OnCombatRoundEnd handle
void main()
{
//Setting oAttacker as the last object to attack the NPC; object will only be a PC
object oAttacker = GetLastHostileActor(OBJECT_SELF);
//Here I am trying to find how many HP are left on the NPC
int iHP = GetCurrentHitPoints(OBJECT_SELF);
//When the HP's drop to 1, fire the script. Side note, the NPC is immortal, so
//I am not worried that a lucky crit at this juncture will ruin what I am
//trying to achieve.
if (GetCurrentHitPoints(OBJECT_SELF) != 1)
//Still more than 1 hp, so exit the script
return;
else
{
//Thought this would set me up properly, clearing all actions
ClearAllActions(TRUE);
//Tried to clear reputations, hoping that would make them stop hitting each other
ClearPersonalReputation(oAttacker, OBJECT_SELF);
ClearPersonalReputation(OBJECT_SELF, oAttacker);
//Then tried this to achieve the same
SetIsTemporaryFriend(oAttacker, OBJECT_SELF);
//And finally, my convo.
ActionStartConversation(oAttacker, "chl_brokwounded", FALSE, FALSE);
}
}
Modifié par WoC_Builder, 11 juin 2011 - 02:49 .