Aller au contenu

Photo

Checking for current PCs in trigger?


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

#1
Xeneize

Xeneize
  • Members
  • 133 messages

Hello there, thanks for reading once again in advance.

 

What I am trying to accomplish is finding a way to check if there is a player currently already within an area(Trigger).

 

What this script is doing is that when a PC enters it, it will fire a dynamic conversation between two nearby NPCs, however I seem to have the problem that the conversation starts each time additional players enter the trigger.

 

My goal is to make it so when a PC is already within the trigger, a new player coming in won't trigger the script.

 

Any way to do this?



#2
kevL

kevL
  • Members
  • 4 070 messages

have the script check for a "bLocked" boolean on the area.

if (bLocked==FALSE)
    set bLocked(TRUE)
    // fire conversation


end of conversation sets bLocked false again.



#3
Xeneize

Xeneize
  • Members
  • 133 messages

It's actually just a series of string messages that pop up above the head of npcs in a sort of delayed sequence, not an actual conversation. Will it still work? Here's the script:

Spoiler


#4
kevL

kevL
  • Members
  • 4 070 messages

here's the simplest way to do it. This script can't be triggered again until after the last SpeakString runs. You could adjust the final delay to make it longer if wanted. But to get more complicated you'd prob. need an onExit script from the trigger-area as well. Or you can do things like not let it repeat until PC has left the area, etc. But try this for now,

void main()
{
    object oPC = GetEnteringObject();

    if (!GetIsPC(oPC)) return;

    if (GetHitDice(oPC) > 10)
        return;

    if (GetLocalInt(oPC, "NW_JOURNAL_ENTRYxenq_ud_uuthli") >= 861260)
        return;

    if (GetLocalInt(OBJECT_SELF, "bLocked") == TRUE)
        return;

    SetLocalInt(OBJECT_SELF, "bLocked", TRUE);

    DelayCommand(3.0, AssignCommand(GetObjectByTag("gac_xen_ud_uuthli_quest"), ActionSpeakString("Text")));

    DelayCommand(10.0, AssignCommand(GetObjectByTag("gac_xen_ud_khaliizi_quest"), ActionSpeakString("Text")));

    DelayCommand(20.0, AssignCommand(GetObjectByTag("gac_xen_ud_uuthli_quest"), ActionSpeakString("Text")));

    DelayCommand(30.0, AssignCommand(GetObjectByTag("gac_xen_ud_khaliizi_quest"), ActionSpeakString("Text")));

    DelayCommand(35.0, AssignCommand(GetObjectByTag("gac_xen_ud_uuthli_quest"), ActionSpeakString("Text")));

    DelayCommand(35.1, SetLocalInt(OBJECT_SELF, "bLocked", FALSE));
}


#5
kevL

kevL
  • Members
  • 4 070 messages

ps. The check for bLocked should come right after void main() ...



#6
Xeneize

Xeneize
  • Members
  • 133 messages

Will try that, thanks for the help :)