Author Topic: Destroy NPC/Attack PC  (Read 249 times)

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Destroy NPC/Attack PC
« on: February 14, 2013, 05:29:02 am »


               Evening all.  I'm having a bit of an issue with a script, and hope someone can show me the error of my ways.  '<img'>

The principals in this script are the PC, Leila, (the owner of the convo) and Jassad (ultimate hostile actor).  Implementation is that this is being called in an action_taken handle of a conversation owned by Leila, on a PC line [End Dialogue].

What works:
Not much truth be told.  All that happens is that Jassad indeed goes hostile, but he does not attack Leila nor the PC.  I've tinkered and tweaked til I'm blue in the face, but am getting no closer.  Can someone please take a look and say "oh yes, put this there and that there and it will fire"  lol

#include "nw_i0_generic"

object oPC     = GetPCSpeaker();
object oLeila  = GetNearestObjectByTag("nh_Leila");
object oJassad = GetNearestObjectByTag("muo_jasaadalshad");
effect eVFX;

// Get the PC who is in this conversation.
void AttackPC()
{
    AdjustReputation(oPC, oJassad, -100);
    SetIsTemporaryEnemy(oPC, oJassad);
    AssignCommand(oJassad, DetermineCombatRound());
}

void main()
{


    // Remove plot flag from Leila so we can kill her
    SetPlotFlag(oLeila, FALSE);

    // Have Leila say something.
    AssignCommand(oLeila, ActionSpeakString("No my love!  Resist!  Resist!!"));

    // Have Jassad attack Leila by having him fake-cast Implosion.
    AssignCommand(oJassad, ActionCastFakeSpellAtObject(SPELL_IMPLOSION, oLeila));
    effect eVFX = EffectVisualEffect(VFX_FNF_IMPLOSION);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oLeila);

    // Destroy Leila.
    DestroyObject(oLeila, 2.0);

    // Have text appear over the PC's head.
    DelayCommand(3.0, AssignCommand(oJassad, ActionSpeakString("And now ~YOUR~ turn!")));

    // Attack the PC.
    DelayCommand(3.1, AttackPC());


}

               
               

               


                     Modifié par WoC_Builder, 14 février 2013 - 05:29 .
                     
                  


            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Destroy NPC/Attack PC
« Reply #1 on: February 14, 2013, 05:51:52 am »


               And I tinkered some more, and think one of my issues was that Leila was the owner of the script, but I destroyed her.  So I changed it around a bit, and simply made her invisible first, then allowed Jassad to run, then destroyed her.  Everything works much better, except Jassad still won't physically attack the PC.  Any ideas why that is?


#include "nw_i0_generic"

object oPC     = GetPCSpeaker();
object oLeila  = GetNearestObjectByTag("nh_Leila");
object oJassad = GetNearestObjectByTag("muo_jasaadalshad");
effect eVFX;

// Get the PC who is in this conversation.
void AttackPC()
{
    AdjustReputation(oPC, oJassad, -100);
    SetIsTemporaryEnemy(oPC, oJassad);
    AssignCommand(oJassad, DetermineCombatRound(oPC));
}

void main()
{


    // Remove plot flag from Leila so we can kill her
    SetPlotFlag(oLeila, FALSE);

    // Have Leila say something.
    AssignCommand(oLeila, ActionSpeakString("No my love!  Resist!  Resist!!"));

    // Have Jassad attack Leila by having him fake-cast Implosion.
    AssignCommand(oJassad, ActionCastFakeSpellAtObject(SPELL_IMPLOSION, OBJECT_SELF));
    effect eVFX = EffectVisualEffect(VFX_FNF_IMPLOSION);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, OBJECT_SELF);

    // Destroy Leila.
    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_INVISIBLE_HUMAN_MALE);

    // Have text appear over the PC's head.
    DelayCommand(3.0, AssignCommand(oJassad, ActionSpeakString("And now ~YOUR~ turn!")));

    // Attack the PC.
    DelayCommand(3.1, AttackPC());

    DestroyObject(OBJECT_SELF, 4.0);


}

               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Destroy NPC/Attack PC
« Reply #2 on: February 14, 2013, 06:06:18 am »


               And success!  I simply delayed destroying the NPC Leila a second longer, and that gave my attacking NPC the time to run all his commands.  He attacks as normal now.  '<img'>