Announcement

Collapse
No announcement yet.

NWN Scripting Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Making NPCs Initiate Dialogue (untested, but should work)

    When the NPC sees a PC, he or she will walk up to the PC and start a conversation.
    This will not work if the PC starts visible to the NPC (no OnPercieve event fires).

    Create an OnSpawn (by editing the standard OnSpawn) with: SetSpawnInCondition (NW_FLAG_PERCIEVE_EVENT); uncommented.

    In your NPC's dialogue file, go to the very first line where he starts his dialogue with
    the PC. If you only want him to start this with any given PC once, add the following script
    into Actions Taken:
    Code:
    void main()
    {
    SetLocalInt(GetPCSpeaker(), "Dlg_Init_" + GetTag(OBJECT_SELF), TRUE);
    }
    This sets the variable that is used in the script you were using, so the dialogue
    isn't done more than once. Now create a new script in the OnUserDefined event for your NPC.

    You can put that second script in here, as follows:

    Code:
    void main()
    {
    int nEvent = GetUserDefinedEventNumber();
    if (nEvent == 1002) // OnPerceive event
    {
    object oPC = GetLastPerceived();
    if(GetIsPC(oPC) && GetLocalInt(oPC, "Dlg_Init_" + GetTag(OBJECT_SELF)) == FALSE && !IsInConversation(OBJECT_SELF))
    {
    ClearAllActions();
    AssignCommand(oPC, ClearAllActions());
    ActionMoveToObject(oPC);
    ActionStartConversation(oPC);
    }
    }
    }
    Now the first time the NPC COMES INTO SIGHT of the player, he should apporach and start his conversation. By adding a second conversation branch, you can mek him say someting else when the PC come up to him later.

    Should work *crosses fingers*

    As for making them move....

    -Jam
    1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
    That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
    Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
    Taht 'ventisular link be woo to clyck.

    Comment


    • #17
      Ok... WalkWayPoints is NOT ActionWalkWayPoints. ActionWalkWayPoints does nothing in Aurora. That's what you did wrong. It (for some dumb reason) doesn't have the standard "Action" prefix.

      So :

      Code:
      void main()
      {
      ClearAllActions() ;
      WalkWayPoints(WP_caretaker_05) ;
      }
      Placed in the "actions taken" slot of the dialogue tree.

      That could work...

      -Jam
      1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
      That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
      Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
      Taht 'ventisular link be woo to clyck.

      Comment


      • #18
        Or...

        Code:
        void main ()
        {
        AssignCommand (OBJECT_SELF, WalkWayPoints(WP_caretaker_05);
        }
        Although I'm not sure its needed to assign the command, as waypoints are tied to specific NPCs anyway.

        -Jam
        1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
        That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
        Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
        Taht 'ventisular link be woo to clyck.

        Comment


        • #19
          Thank you, I'll try those sometime soon!
          -->Visit CGN!
          -->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944

          Comment


          • #20
            Jamski,

            Thank you for your scripting help.
            The script for having the NPC approach the character worked Perfectly!
            I am amazed by it and was so giddy, I couldn't stop smiling for a time...

            However, the most important problem with my game... the one that I find essential to the plot of my little campaign is still having difficulties. I might be missing files or something because "WalkWayPoints" does not show in the Funcitons list and when I try either suggestion you gave me...
            the problem states that there is an "error:UnidentifiedIdentifier- "WalkWayPoints") The same thing seems to happen with ActionWalkWaypoints in the other place.

            Do you know any way to fix this?

            Just one more question for today...
            1.) Do you know how to make the NPC stop approaching the character after the first time? The NPC kept approaching me after a lull of about 30 seconds...


            Thank you again!

            -DarkCloud
            -->Visit CGN!
            -->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944

            Comment


            • #21
              Make the script only trigger if a variable = 0. Add a line to the end of the script that changes the variable to 1. I'm sure you can manage that

              I don't have the compiler open at the moment... Perhaps WalkWayPoints needs to be "WalkWaypoints" Look at the default OnSpawn script on a standard goblin or something, and copy and paste whatever command it is that makes the goblin walk its waypoints. That's what I always do if I'm stuck.

              I'm glad the approach script worked though

              -Jam
              1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
              That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
              Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
              Taht 'ventisular link be woo to clyck.

              Comment


              • #22
                Walkwaypoints isn't a standard function in the game. It is found in a script library instead. You'll have to include that library into your script. Just type #include "x0_i0_anims" before the void main function, and you should be able to use walkwaypoints(). This script may be different if you don't have an expansion or haven't upgraded to 1.61.
                “As a lifelong member of the Columbia Business School community, I adhere to the principles of truth, integrity, and respect. I will not lie, cheat, steal, or tolerate those who do.”
                "Capitalism ho!"

                Comment


                • #23
                  Doh!
                  I feel stupid now.

                  -Jam
                  1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
                  That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
                  Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
                  Taht 'ventisular link be woo to clyck.

                  Comment


                  • #24
                    Thank you DaShi, I'll try that next time I work on the game!

                    I wonder why none of the sites I visited mentioned that particular quirk? Maybe it was fixed in a later patch?

                    -
                    by the way, I think I have version 1.10... without any patches, the basic basic basic version...
                    -
                    -->Visit CGN!
                    -->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944

                    Comment


                    • #25
                      Get the patches or at least the first XP. They improve the editor's stabilty, add more creature models and area textures and basically make everything a little less stressful.

                      -Jam
                      1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
                      That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
                      Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
                      Taht 'ventisular link be woo to clyck.

                      Comment


                      • #26
                        Maybe I'll get the expansion *sigh*...

                        Do you think that If I get Gold Edition, I would still need to download the Shadows of Undrentide Patch?
                        -->Visit CGN!
                        -->"Production! More Production! Production creates Wealth! Production creates more Jobs!"-Wendell Willkie -1944

                        Comment


                        • #27
                          The gold edition is pre-patched to v.1.31

                          You'd still need to get v.1.61 (well, not NEED, but this patches it up with the fixes in HOTU, it works fine without though)

                          -Jam
                          1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
                          That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
                          Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
                          Taht 'ventisular link be woo to clyck.

                          Comment


                          • #28
                            Originally posted by Jamski
                            Doh!
                            I feel stupid now.

                            -Jam
                            Don't worry. That's nothing compared to the mistakes that I often make. I'd probably work on my mod more, if I didn't have to keep rewriting scripts on the time.
                            “As a lifelong member of the Columbia Business School community, I adhere to the principles of truth, integrity, and respect. I will not lie, cheat, steal, or tolerate those who do.”
                            "Capitalism ho!"

                            Comment


                            • #29
                              I've finally realised how scripts really work. I was doing a few dumb things. Now I'm ready for any challenge.

                              -Jam
                              1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
                              That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
                              Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
                              Taht 'ventisular link be woo to clyck.

                              Comment


                              • #30
                                Good, I need help.

                                I have a locked door. I want the player to be able to open it by switching four switches. When all 4 are set to the 'on' position, the door unlocks.

                                I've altered Ceolowin's version in his tutorial on the bioware forums by adding objects and integers for four switches and changing the end result to unlocking my door. For some reason, this doesn't work. Debuging indicates that all but the last switch switched is activated. But no matter how many times I switch it, it doesn't activate. It seems so simple, but it has been frustrating me for months.
                                “As a lifelong member of the Columbia Business School community, I adhere to the principles of truth, integrity, and respect. I will not lie, cheat, steal, or tolerate those who do.”
                                "Capitalism ho!"

                                Comment

                                Working...