Aller au contenu

Photo

Trigger Script with 2 NPCs [solved]


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

#1
BillHoyt

BillHoyt
  • Members
  • 109 messages
I am trying to trigger the death (or seeming death) of an NPC during an event triggered by a second NPC. In short, if NPC oDog crosses my trigger, it causes NPC oLady to scream and fall over dead (yes, killing dear old Mrs. Schmooples is a bad thing). I have been able to create the effect using the OWNER_DIES action in conversation, but I have not yet found an action that can do it in a script.

Here's the trigger script:

// -----------------------------------------------------------------------------
// scared_to_death trigger script
// Owner: Bill Hoyt
// -----------------------------------------------------------------------------
/*

    Dog Scares Mrs. Schmooples to death

    Note: this script redirects all events not handled into trigger_core.

*/
// -----------------------------------------------------------------------------

#include "events_h"
#include "global_objects_h"
#include "plot_h"
#include "utility_h"
#include "plt_who_let_the_dog_out"
object oPC = GetHero();
object oDog = UT_GetNearestCreatureByTag(oPC, "marabi1", 0);
object oLady = UT_GetNearestCreatureByTag(oPC, "mrs_schmooples", 0);

void main ()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    int bEventHandled = FALSE;
    switch (nEventType)
    {
        case EVENT_TYPE_ENTER:
        {
            object oCreature = GetEventCreator(ev);
            if(oCreature == oDog)
            {
                WR_SetPlotFlag (PLT_WHO_LET_THE_DOG_OUT,
                    SCARED_MRS_SCHMOOPLES, TRUE);
            // Mrs. Schmooples joins the bleedin' choir invisibile
            //  MISSING LINES HERE
            }
         }
         break;
    }
    //If this event wasn't handled by this script, let the core script try
    if (!bEventHandled)
    {
        HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
    }
}
            }
            break;
        }
         break;
// end script

Can anyone fill in the missing lines for me?  I would eventually like to convert it to a (I hope amusing) cutscene, but for now, I'm just trying to get the plot operational.  Thanks.

Modifié par BillHoyt, 30 avril 2010 - 04:49 .


#2
TimelordDC

TimelordDC
  • Members
  • 923 messages
Is the dog tag correct?

Edit: Missed the question in the end :)
You can add the required actions in the plot script. I'll put in a more detailed response when I get home.
As an example, you can check how it is done (killing someone through script) in the Sacred Ashes quest where the PC can kill Genitivi in the cutscene.

Modifié par TimelordDC, 29 avril 2010 - 10:05 .


#3
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages
 I have taken a swift look at the function list and maybe this one can be useful:

KillCreature
(effect_death_h)
Kills a creature.

Description:
Kills a creature by creating and applying a death effect. - Does
nothing if applied to an already dead creature. - Does nothing on immortal or
plot flagged creatures

void KillCreature (
object oVictim,
object oKiller = OBJECT_INVALID,
int nAbilityId = 0,
int bProcessInline = FALSE,
int nDamage = 0
)

Parameters:

oTarget
- The unfortunate creature to die.

oKiller
- The killer (OBJECT_INVALID for creatures killed by plot).

nAbilityId
- If used from an ability script, pass in stEvent.nAbility.


Next time I suggest to use the search tool in the script editor. I just typed kill, et voilà ;)

Modifié par _L_o_B_o_, 29 avril 2010 - 10:44 .


#4
BillHoyt

BillHoyt
  • Members
  • 109 messages

_L_o_B_o_ wrote...

Next time I suggest to use the search tool in the script editor. I just typed kill, et voilà ;)


Yeah, I got hung up by EffectDeath and FeignEffectDeath (thus my aside about seeming death). I guess I should have been more aggressive in finding different ways to kill off old Mrs. Schmooples.

I'll give it a try, but it looks like just what the mortician ordered.

Just curious: know of an easy way to make her scream? :whistle:


Edit: O yeah, that worked. She's dead. Poor old bag.  Thanks again.

Modifié par BillHoyt, 30 avril 2010 - 03:06 .