Script to redirect npc attacker's target
I've created an item a PC can use with the taunt skill to make a target npc attack them instead of another party member. It compiles, but I don't see the "ClearAllActions" or "ActionAttack(oActivator)" happen. I appreciate any help.
void main()
{
object oActivator = GetItemActivator();
object oTarget=GetItemActivatedTarget();
SendMessageToPC(oActivator, "Using Taunt Skill Item");
// get target to perform concentration skill check
int iSkill=GetSkillRank(SKILL_CONCENTRATION, oTarget);
int iRoll=d20(1);
int iResult = iRoll + iSkill;
//compare target skill check to activator's taunt skill check
if(GetIsSkillSuccessful(oActivator, SKILL_TAUNT, iResult))
{
SendMessageToPC(oActivator, "Taunt Succeeded");
ClearAllActions(TRUE, oTarget);
SendMessageToPC(oActivator, "Cleared Actions");
AssignCommand(oTarget, ActionAttack(oActivator));
SendMessageToPC(oActivator, "Attack Taunter");
}
else
{SendMessageToPC(oActivator, "Taunt failed");}
}
0
Comments
void main() { object oActivator = GetItemActivator(); object oTarget=GetItemActivatedTarget(); SendMessageToPC(oActivator, "Using Taunt Skill Item"); // get target to perform concentration skill check int iSkill=GetSkillRank(SKILL_CONCENTRATION, oTarget); int iRoll=d20(1); int iResult = iRoll + iSkill; //compare target skill check to activator's taunt skill check if(GetIsSkillSuccessful(oActivator, SKILL_TAUNT, iResult)) { SendMessageToPC(oActivator, "Taunt Succeeded"); AssignCommand(oTarget, ClearAllActions(TRUE, oTarget)); SendMessageToPC(oActivator, "Cleared Actions"); AssignCommand(oTarget, ActionAttack(oActivator)); SendMessageToPC(oActivator, "Attack Taunter"); } else {SendMessageToPC(oActivator, "Taunt failed");} }