Aller au contenu

Photo

Pausing a Battle for a Conversation


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
WoC_Builder

WoC_Builder
  • Members
  • 225 messages
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

B) I am missing another crucial command.

Can anyone help me with this?

Thanks, Russell :D

//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 .


#2
henesua

henesua
  • Members
  • 3 883 messages
SurrenderToEnemies()
You can read more about the function in the lexicon. Just search for the surrender functions.

#3
WoC_Builder

WoC_Builder
  • Members
  • 225 messages
*slaps forehead* DOH! Thanks for the pointer in the right direction! Looks exactly like what I need.

Many thanks again :)