Starting Conversation While In Combat
Zephirius
Member Posts: 419
I just keep getting a message that the PC is "busy" right now... (
I put it on the NPC's OnDamaged handler...
Yeah...
I put it on the NPC's OnDamaged handler...
object oPC = GetLastDamager(); if (!GetIsPC(oPC)) return; int nCurrentHP = GetCurrentHitPoints(); int nMaxHP = GetMaxHitPoints(); if (nCurrentHP < (nMaxHP/2)) { if (GetIsInCombat(oPC) && GetIsEnemy(OBJECT_SELF, oPC)) { ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_COMMONER); AssignCommand(OBJECT_SELF, ClearAllActions()); ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_HEAD)); AddJournalQuestEntry("Lord Zuul's Proposal", 1, oPC, TRUE, FALSE); AssignCommand(OBJECT_SELF, ActionStartConversation(oPC, "lord_zuul")); } } }
Yeah...
0
Comments
Normally, after combat, there is a cool down before the PC can speak. TRUE by-passes that.
If associates or others could be attacking the victim, you also need the victim to SurrenderToEnemies() after changing faction.
After a quarter of the NPC's HP's are gone, the conversation starts, then immediately stops and the attack resumes. No time to talk, I guess.
Can you guys figure this out. I'm at a loss.
Who is attacking whom, exactly?
If the victim is attacking the PC, ensure they ClearAllActions(TRUE), too.
This is the revised version:
The guy who is being attacked is the owner of the script - OBJECT_SELF
ForceRest is only necessary if OBJECT_SELF is a spellcaster. It's the only way I know to stop spells that have already been unleashed turning folk hostile again. Unfortunately, it also restores full HP.
I see from my notes that the brief delay on starting the conversation is to ensure that the PC has cleared all actions (when you assign commands to two creatures at the same time, there's no telling which will execute first).
I've left the new faction as Commoner, but personally I always use a neutral custom faction for safety, in an abundance of caution, just in case some bug turns Commoners hostile.
Hope that works for you.