Aller au contenu

Photo

starting conditionals in scripts, Journal entries?


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

#1
harjoblog

harjoblog
  • Members
  • 19 messages
 Is it possible to have a journal entry in an onenter script of a trigger, and if the player is at the specific entry of the journal, the script fires, otherwise it does nothing.

I have a script that works for what I want it to do. But I also want a starting conditional that states the player(party) must have a specific journal entry.
this is the beginning of my script. I am trying to start it off with the journal entry restriction, but I don't know if this is possible this way. Does the Journal restriction only apply in conversations?



void main(){    object oTarget;    object oSpawn;
    // Get the creature who triggered this event.    object oPC = GetEnteringObject();
    if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYLH_beginning") == 2 )        return;    // Only fire for (real) PCs.    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )        return;
    // Only fire once.    if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )        return;    SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);
]

Modifié par harjoblog, 16 juillet 2012 - 01:33 .


#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Hmm. A little confused. A starting conditional script is used for conversations. So do you already have a conversation set up and you just want it so that a part of the conversation shows up if you don't have a specific journal entry? Or did you just want something added to the script you posted above to let the player know that they need to be at a specific point in the journal?

#3
harjoblog

harjoblog
  • Members
  • 19 messages
I don't have a conversation set up, I have a trigger set up with an onenter script. I want to know if it's possible for me to set the script to fire if the player or party has a journal entry that's at a specific ID.

I can't get the [] to work to show the beginning of the script right in my first post.

#4
harjoblog

harjoblog
  • Members
  • 19 messages
but this is what I am trying to use to check the pc entering the trigger, to check for the proper journal ID

if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYLH_beginning") == 2 )
return;

#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Change:

if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYLH_beginning") == 2 )return;

To:

if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYLH_beginning") != 2 )return;

#6
harjoblog

harjoblog
  • Members
  • 19 messages
Thanks, that worked lightfoot8, but I don't understand why. I thought == meant equal to and != meant not equal to. So it has me confused that not equal to journal ID 2 would work when equal to journal ID is what I wanted.
But thanks again.

#7
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
This is just an example of different things you could do

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

    //if the journal entry = 2...
    if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYLH_beginning") == 2 )
    {
        //...do stuff here
        //you are on the right part of the quest so this stuff will happen
    }

    //or


    //if the journal entry does NOT = 2...
    if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYLH_beginning") != 2 )
    {
        //...do stuff here
        //SendMessageToPC(oPC, "I'm sorry but you don't have the right journal entry.");
        //return;
    }

}


Hopefully this is kinda what you are looking for?

Modifié par GhostOfGod, 16 juillet 2012 - 02:11 .


#8
harjoblog

harjoblog
  • Members
  • 19 messages
yeah thats the kind of stuff, but the little change from == to != worked without have to do the other stuff. But thanks

#9
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

harjoblog wrote...

Thanks, that worked lightfoot8, but I don't understand why. I thought == meant equal to and != meant not equal to. So it has me confused that not equal to journal ID 2 would work when equal to journal ID is what I wanted.
But thanks again.


== does mean equal and
!= does mean not equal. 

So tell me what where you asking the script to do when NW_JOURNAL_ENTRYLH_beginning was equal to 2

#10
harjoblog

harjoblog
  • Members
  • 19 messages
Here's the scenario.

PC gets journal updated to ID 2 in a journal entry. They enter a zone and then enter a trigger at the beginning of the zone, the script in the trigger checks for that specific entry ID, the script then creates creatures at waypoints.

The next trigger is near where the NPCs are created. When the player enters that trigger, it again checks to see if the journal entry is at ID 2, if it matches, the script then runs some floating text over a few NPCs plays some animations then destroys some creatures and objects. Everything is working after I changed the == to !=, i'm just not sure why since the journal was updated to ID 2 before the player ever enters the zone or trigger.

#11
harjoblog

harjoblog
  • Members
  • 19 messages
if I knew how to post scripts here I would post the entire script, but I don't know exactly how and when I try, the script just runs together, like my first post.

#12
harjoblog

harjoblog
  • Members
  • 19 messages
essentially what I am doing is creating a scripted scene ( i only found the gest cutscene download today) based on whether or not the pc or party has a specific journal entry.

Modifié par harjoblog, 16 juillet 2012 - 02:37 .


#13
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Basically what this line is saying:

if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYLH_beginning") != 2 )return;

If the journal entry does not = 2 then just exit out of this script right now (return;). Otherwise everything else that is under this line will continue.

Modifié par GhostOfGod, 16 juillet 2012 - 02:54 .


#14
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
you are asking to understand why changing the == to != worked to make you script work correctly. To help you understand that I asked the Question:

In your original script what statement where you having the script execute when the local int NW_JOURNAL_ENTRYLH_beginning was equal to 2?

I will even add the question: What does that statement that is being executed when NW_JOURNAL_ENTRYLH_beginning is equal to 2 do?


I am not asking what you where trying to do. I am asking you to look at what your script was doing. You ca do that by answering the questions.

EDIT:  Oh well, ghost already answered them for you.
Now look back at the examples that ghost posted and see you you can understand them.  

Modifié par Lightfoot8, 16 juillet 2012 - 02:54 .


#15
harjoblog

harjoblog
  • Members
  • 19 messages
Yes ghost, that's what is confusing me.

Lightfoot8
I have it right after the objects in the original script. I'll type out of the beginning of the script and show you what I'm talking and what I don't quite understand.

onenter script of a trigger

void main()
{
object oTarget;
object oSpawn;
object oActor;
object eVFX;
object oPC = GetEnteringObject();

if ( GetLocalInt(oPC, "NW_JOURNAL_ENTRYLH_beginning") != 2 )
return;
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )
return;
if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
return;
SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

eVFX = EffectVisualEffect(471);
oTarget = GetWaypointByTag("wp_mystwiz01");
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "mystwiz001", GetLocation(oTarget));
DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpawn));


/* after the above, everything else in the rest of the script are AssignCommand, DelayCommand, Destroyobject */

}

#16
harjoblog

harjoblog
  • Members
  • 19 messages
ah ok ghost I see how it works now. It isn't if equal to then run, it's if not equal to, don't run. OK I understand how that works. Thanks