Aller au contenu

Photo

Event Firing not working at the end of Convo [SOLVED]


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

#1
SynysterLyfe

SynysterLyfe
  • Members
  • 32 messages
So I have a script that runs when a conversation ends. It sets a couple of local variables on the NPC speaker then signals an Event to the NPC speaker to continue their custom ambient behaviour I've written up.

Now, if I rush through the conversation quickly, the Event signals properly and the NPC continues on his way. However, if I wait in conversation mode with the NPC for a couple of seconds, then when the conversation ends the NPC just stands there, obviously not receiving the Event it's supposed to.

Now I've done some tests and I know the code is still running in both cases (the local variables are set properly), so I have no idea why the Events aren't working. Any ideas?

Modifié par SynysterLyfe, 17 juin 2010 - 07:44 .


#2
SynysterLyfe

SynysterLyfe
  • Members
  • 32 messages
So, did some more tests, and turns out this thing is weirder than I thought. Let me explain a little more. My ambient behavior system runs off of EVENT_TYPE_CUSTOM_COMMAND_COMPLETE events (found that cleaner than using a heartbeat). So, at the end of the conversation, after setting the local vars, I signal one of these events. Now, as a test, I decided instead of signaling the event directly I'd add a CommandMoveAwayFromObject() to the NPCs command queue, which should fire off a CUSTOM_COMMAND_COMPLETE event on it's own when it's done.

So, with this small change, if I rush through the conversation the NPC walks away at the end then resumes his ambient behavior. If i stall, the NPC walks away then stands there.

So it's not that the event isn't firing (at least as far as I can tell at this point), it's about the event not being handled. I don't see how wasting time in conversation mode would affect this. Thoughts?

Modifié par SynysterLyfe, 17 juin 2010 - 04:21 .


#3
Phaenan

Phaenan
  • Members
  • 315 messages
Not much of a thought, but when I was playing with the ambient system I seemed to notice creature events being blocked from time to time. At some point I wrote on the MotB wiki that it may occur when the creature is "occupied" doing some animation. Maybe, just maybe, it's the same with the dialog animations ? Don't quote me on this tho, assaying this quickly became frustrating so I didn't test it thoroughly.
In any case, even if I couldn't put my finger on it, I can confirm I had the same impression : creatures occasionally snub events sent to their core.

Modifié par Phaenan, 17 juin 2010 - 04:45 .


#4
SynysterLyfe

SynysterLyfe
  • Members
  • 32 messages
I'm glad I'm not the only one who's noticed this. But just the fact that waiting in conversation mode changes something is really weird. Nothing should change if you're just sitting there doing nothing.

#5
SynysterLyfe

SynysterLyfe
  • Members
  • 32 messages
Events are very unreliable. Did more testing, and these are my results:

Before we get into it, I'm using EVENT_TYPE_AMBIENT_CONTINUE to catch when a conversation ends. When I initiate the conversation I set the AMBIENT_SYSTEM_STATE on the NPC speaker to 1 (so that the event will actually fire when the conversation ends), and when I end the conversation I set the AMBIENT_SYSTEM_STATE back to 0 (to stop the event from being triggered when I don't want it to be). My reasons for doing this is that I will need my code to run at the end of EVERY conversation, so having a general solution like this makes it easier to add new conversations without having to make sure to set the OnConversationEnd script every time.

Anyways, back to my results:

1. I can signal any event other than EVENT_TYPE_CUSTOM_COMMAND_COMPLETE from within the EVENT_TYPE_AMBIENT_CONTINUE handler and they are processed perfectly no matter how long I wait in conversation mode.

2. If I try to signal an EVENT_TYPE_CUSTOM_COMMAND_COMPLETE event it will either work, or it won't. At first it seemed to depend on how long I waited in conversation mode, (rushing through made it work while waiting made it not work), but after a while it started working and not working randomly no matter how long I spent in conversation mode.

Edit: Signalling a random event from within the EVENT_TYPE_AMBIENT_CONTINUE handler, then having that random event signal a EVENT_TYPE_CUSTOM_COMMAND_COMPLETE also does not work. I've tested this by sending the random event first to the NPC speaker, then when that didn't work, to the Area.

3. I have not been able to pinpoint the exact circumstances, but it has happened multiple times where EVENT_TYPE_AMBIENT_CONTINUE does not fire at the end of a conversation, causing problems in my code because I can't set the local vars. This would also cause problems with the internal ambient behavior system as the NPC speaker would not get the signal to continue his/her behavior. Possible bug?

Modifié par SynysterLyfe, 17 juin 2010 - 05:47 .


#6
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages
Don't know if it could be useful, but I found the following advice here (http://social.biowar...bient_behaviour):

The script sys_ambient_h contains the implementation of the ambient behaviour system. The AMBIENT_* local variables should never be directly modified at run-time. Instead, use the following functions to customize a creature's ambient behaviour through script.


Modifié par _L_o_B_o_, 17 juin 2010 - 06:02 .


#7
SynysterLyfe

SynysterLyfe
  • Members
  • 32 messages
Tried using Ambient_Start/Stop but now instead of working sometimes, it doesn't work at all. There must be a better way to make a custom ambient behavior system.

#8
SynysterLyfe

SynysterLyfe
  • Members
  • 32 messages
Phaenan, you were right. During the conversation the NPC was issued an animate command, which I guess do not signal an EVENT_TYPE_CUSTOM_COMMAND_COMPLETE when they finish.



I can't believe I didn't test for that before. Thanks.

#9
Phaenan

Phaenan
  • Members
  • 315 messages
Well, that's always good to know. :o

#10
SynysterLyfe

SynysterLyfe
  • Members
  • 32 messages
yea my behavior script checked the NPCs current command, and if it wasnt COMMAND_INVALID it returned, assuming that whatever command it was currently executing would fire off another CUSTOM_COMMAND_COMPLETE when it was finished. Quick change to check if current command != INVALID && != PLAY_ANIMATION and everything's working fine :)



Still having some problems with EVENT_TYPE_AMBIENT_CONTINUE not firing, but I think I'll just take the hit and attach a script to the end of every conversation like I should have done in the first place.