Hi, I just have a question. I have an NPC spawned into an area and I want that NPC to start a conversation with the PC right away once it is spawned. I guess I could try and get the NPC to move to a trigger to trigger the conversation, but…why does the script actually need a trigger? Can’t the NPC just start to talk once it is spawned or…maybe I’m missing something vital here? I mean, my script just tells the NPC (I think) to start talking, and yet it doesn’t happen. I usually use triggers to start conversations, of course, but I was wondering. The script looks like this:
Edit: Nevermind, I realized it’s a wrapper in the incs.
Although I’m not sure it’s the problem, in a single player game GetFirstPC should be equivalent.
Thanks for the replies. I will try out your code kevL_s and yours too Clangeddin.
The way it is now is that the creature spawns, cutscene mode starts and then nothing.
Will see if your cleanup of the code changes anything.
I actually use SetCutSceneMode() all the time. In this instance it is not necessary though. I found in the first module I made when an companion should start a conversation when the PC entered a trigger, that if the PC ran too far in front of the companion, the conversation would sometimes not start, but when using cutscenemode that has never failed as the PC can’t do anything when in cutscene mode. I just had to make sure that I set the cutscenemode to off once the conversation started.
I tested both your scripts and still nothing works. The NPC just stands there once spawned in. I tried to delay it with 2 seconds but that didn’t do anything. I think I’ll have to try CreateIPSpeaker instead. That usually works when triggering a conversation fails for me.
Ok. Now it worked. There always seem to be a lot of timing issues with NWN2. Scripts that won’t fire because something else happens or another script is running or whatnot. Here’s how my script looks now:
I have another similar problem in another script now. It’s a bug that I’m quite familar with, and it has to do with the PC or an NPC sitting on chairs, interact with an object. Most of the time this works but now I’ve encountered a few times when it doesn’t work, and it’s quite frustrating. Part of the script looks like this:
The problem is, I’ve encountered it two times now, that the NPC sits down but the PC doesn’t. If this doesn’t happen the dialog won’t fire (the CreateIPSpeaker won’t fire). Is there a way perhaps to try and make the PC try to sit down again if he fails? Like to check if the character has sat down? Now that I look at the script again, is the problem perhaps that the delay of all the three actions are delayed by 1.5 seconds? Maybe I should delay the CreateIPSpeaker 2.0 seconds instead?
I don’t have too much to add to what has already been said, but I do understand the frustration you are going through … I have very similar ones.
As to having conversations start, I have found that probably THE best way of guaranteeing a conversation starts OK is to have the NPC already present (script hidden) and then unhide them and start the conversation. Secondly. if the NPC is already present, (due to coming to the area for the first time), make sure you start any conversation from the area on client enter hook. In my own mod, I even delay firing a second script from this one (by 0.25) on the main PC to ensure the script fires.
As for your second issue, why not just add the animation to the first (or second) conversation node?
This is how it is laid out in my module in this situation: The PC and a companion enters an inn. When entering the area they walk through a trigger that triggers a conversation (I use the SpeakTrigger but with SetCutSceneMode() to make sure it happens, and set it to “off” in a node so that the characters can move once the dialog is done) which always works by the way. At the end of this conversation a script (made with help from KevL_s and/or Aqvilinus, I believe) runs, where the companion is removed from the roster and teleported to behind a chair in this same inn, while the PC is teleported to behind another chair. Then this part of the script in my previous post runs.
When trying to do a delaycommand to 1.7 on the second ActionInteractObject and then 2.0 on the CreateIPSpeake the conversation runs almost all of the time, but then the characters seem to, for most of the time, happen to sit themselves beside the chairs and not on them. Really weird.
I think I’ll actually go back to what I had here with all the delays to 1.5 seconds, and if the conversation doesn’t run, the player will probably go to the companion and click to try and start the conversation. This conversation, that is supposed to start, is another conversation that isn’t on this character normally, but I’ll think I’ll copy that to the companion’s main/normal conversation and put it above everything else with the use of gc_area. This companion is a temporary companion (in fact she is an NPC most of the time but I’ve put the companion scripts on her since there’s influence points to be gained etc.) and this is the only time she is ever at the inn, and that’s why I think this will work.
It’s tedious work to make all these kind of “debug things” just because a script doesn’t fire the way it should. And this is the most frustrating thing with NWN2 in my opinion. Maybe it’s because I want NWN2 to behave in a way it really wasn’t made for. I love conversations, characters, choices and story…battles are just filler for me to add to the excitement. And NWN2, like most RPGs, seems to be made primarily with fighting and battles in mind.
Did you try “ClearPendingActions”? (from the scripts for the animations I sent you [for the other readers: sorry, but I don’t want to spoil andgalf’s next module])
Now, the first time I had it (long time ago), it was due to a light (above where they were sitting) not set to “walkable” and so the PC would fail to reach the seats below it.
The more recent time … I believe I was clearing the action (via another script like a heartbeat check or something), which was making them sit before they got there … very frustratingly, I have forgotten the exact reason now … argh! I know I got it to work in the end though. It may have even required a rebake or something. If I remember the exact reason, I will post, but check those points I mention as well.
Tell me about it … I have just had to rewrite my “death” scripts (hard core mode) because I had messed something up … admittedly that was my fault and due to a change in the way it was meant to work … it is still frustrating though.
Hi there, 4760. I know, I should probably take a good close look to how you did it with your animations, with your scripts I got from you. And no, I haven’t used ClearPendingActions. Didn’t know about that function. I will take a closer look at that. Thanks!
Haha. That’s really weird. A light that needs to be set to walkable. I’ll try that. I think I actually have some litght or lights above that table. Maybe that’s what’s messing with things.
Yeah, and you are ten times more good at scripting than I am so…that’s one thing that sometimes hinders me. I don’t always know how to do things the “slick and effecient way”, like most of you content creators out there seem so good at. I just try to learn, even though my mind was apparently never made to understand scripts. I think I’m a bit too dumb and illogical , my mind being more of a silly and artistic nature, and I just love to create stuff…but, I have began to grasp at least a few things by now. It took over 2 years…so I’m an extremely slow learner.
You mean Lilac Soul’s Script Generator? I’ve used that a lot…though not that much anymore. I guess I could try that, even if it works well with CreateIPSpeaker now, and it seems that there was something else that was wrong since Clangeddin’s script worked for him and not for me. Maybe it’s something to do with my computer not being able to keep up or something. And kevL_s’ scripts are often state of the art and almost never fails when he’s done something for me, so when this didn’t work…All I’m saying is I’m having a hard time believing the Script Generator could do it better.
Hi again, Lance. I actually made the table the characters sit at walkable, and when I tested now, they both sat down. It could have been that it worked just this time, however, when they rose from the chairs afterwards it looked a lot better, maybe because of the table being walkable.
It gets easier with time. After all, when you hit the same issue time and time again,something normally sticks in your mind to get around it next time. The only problem is, when you look back over your old code (like I am doing now), you see where all the problems need fixing! Frightening!