If I use the on_enter event from an area I can start a conversation from the event whether the PC is posessing his owned character or a companion by forcing the PC to posess his owned companion using the proper function. This does not work if the script is called from the client_on_enter event.
Does anyone start conversations from the client_on_enter event?
Starting conversations from on_client_enter event vs on_enter event - conversation won't start if posessing companion
Débuté par
M. Rieder
, avril 16 2012 01:41
#1
Posté 16 avril 2012 - 01:41
#2
Posté 16 avril 2012 - 01:48
I'm pretty sure I did in Shaar Moan. Since the companions or NPCs the conversations started with didn't have the 'can talk to non-player-owned character' flags checked, the conversation seemed to automatically switch the focus to the first PC when it started.
I posted the script I use in a similar thread you created:
http://social.biowar...-8912250-1.html
I posted the script I use in a similar thread you created:
http://social.biowar...-8912250-1.html
Modifié par DannJ, 16 avril 2012 - 01:51 .
#3
Posté 16 avril 2012 - 02:01
Hi Dann,
Thanks for the reply. I looked on the Lexicon which seemed to suggest that the ClientOnEnter only fired in MP modules and also fired before everything was all loaded.
Of course, this is opposite of what the toolset says. It is quite misleading.
I'm going to check out Shaar Moan and see if looking at it in the toolset helps.
Thanks for the reply. I looked on the Lexicon which seemed to suggest that the ClientOnEnter only fired in MP modules and also fired before everything was all loaded.
Of course, this is opposite of what the toolset says. It is quite misleading.
I'm going to check out Shaar Moan and see if looking at it in the toolset helps.
#4
Posté 16 avril 2012 - 02:23
I used to use the OnEnter events to fire conversations in all my modules since I learned in NWN1 and there was no OnClientEnter events in NWN1 (read the comments section here for some of my experience with this). I think it was patch 1.21 that broke everyone of my modules and many others. We all had to go back and convert everything to OnClientEnter events when a conversation is fired upon entering an area. Sometimes it would work if you happened to be controlling your main character, but as you said, doesn't work when controlling companions. I think it may have something to do with the OnClientEnter only firing once and OnEnter fires every time something enters the area (iirc). Anyway, I never use OnEnter anymore for my SP or MP modules and that seems to be consistently working. Interestingly enough, I think the OC always used the OnClientEnter.
Modifié par slowdive.fan, 16 avril 2012 - 02:28 .
#5
Posté 16 avril 2012 - 04:15
I only resort to using OnEnter if I've got another important script in the OnClientEnter slot (and I don't want to merge the two). If you put enough of a delay on things then you can usually get away with it. Although a safe delay on my own machine may not be long enough on someone else's machine.
OnClientEnter fires every time the PC enters the area (or you reload from a saved game). I wonder if OnEnter would fire again when spawning in encounters? Or potentially multiple times in rapid succession when you enter with companions in tow?
OnClientEnter fires every time the PC enters the area (or you reload from a saved game). I wonder if OnEnter would fire again when spawning in encounters? Or potentially multiple times in rapid succession when you enter with companions in tow?
#6
Posté 16 avril 2012 - 11:08
DannJ wrote...
I wonder if OnEnter would fire again when spawning in encounters? Or potentially multiple times in rapid succession when you enter with companions in tow?
Yes, it does fire anytime any new object enters the area. I've had some pretty interesting bugs with this.
#7
Posté 16 avril 2012 - 11:09
@DannJ: Yes, it fires everytime a creature enters the area.
#8
Posté 16 avril 2012 - 11:37
Hi Matt,
Yes, I do have conversations starting using the On Client Enter hook. You have to use a specific function (GetFirstEnteringPC) to ensure a valid object is returned though. Here is an excert from my own script:
object oPlayer = GetFirstEnteringPC(); // ESSENTIAL TO USE THIS FUNCTION HERE!!!!
This is useful to use if you want to ensure only one incident of code fires when more than one player/object is entering. It's like a "fire once" for the party entering kind of thing, and I use it quite extensivel;y for MP aspects of coding. I only use the OnEnter hook for "general" aspects that I want applied to creatures entering an area.
(I replied to you email btw.)
Hope that helps.
Lance.
Yes, I do have conversations starting using the On Client Enter hook. You have to use a specific function (GetFirstEnteringPC) to ensure a valid object is returned though. Here is an excert from my own script:
object oPlayer = GetFirstEnteringPC(); // ESSENTIAL TO USE THIS FUNCTION HERE!!!!
This is useful to use if you want to ensure only one incident of code fires when more than one player/object is entering. It's like a "fire once" for the party entering kind of thing, and I use it quite extensivel;y for MP aspects of coding. I only use the OnEnter hook for "general" aspects that I want applied to creatures entering an area.
(I replied to you email btw.)
Hope that helps.
Lance.
Modifié par Lance Botelle, 16 avril 2012 - 11:38 .
#9
Posté 18 avril 2012 - 04:44
Thanks for all the help. I finally got them working. I ended up using GetFirstEnteringPC() and then switching character control from there. It works great now.
#10
Posté 20 avril 2012 - 05:49
M. Rieder wrote...
Thanks for all the help. I finally got them working. I ended up using GetFirstEnteringPC() and then switching character control from there. It works great now.
Hi Matt,
That's exactly what I do.
The essential part is what I say in the above post though ... You must use GetFirstEnteringPC.
Lance.





Retour en haut






