Author Topic: NPCs say random things when battled  (Read 638 times)

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
NPCs say random things when battled
« on: June 07, 2012, 03:29:28 pm »


                Well, I ran into a strange problem. When I attacked some NPCs in my module's town they start fighting me but at the same time say random lines of their conversations. These lines are chosen completely randomly, I think, from different branches of conversation and often the ones my current PC couldn't trigger normally.

It's not only the enemy NPCs, my henchmen do that too. What the heck? 0_0

Thanks for help. '<img'>
               
               

               
            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
NPCs say random things when battled
« Reply #1 on: June 07, 2012, 06:23:38 pm »


               No one knows what might cause this problem?
It only occurs in the town and town's buildings, I have no idea why.
With some further tests I can tell that the problem is with townsfolk. If one of them is attacked, he and all other NPCs start talking this random stuff. But as long as no citizen is attacked, everything seems to be alright. I cannot figure out what's wrong with this NPC, though.
               
               

               


                     Modifié par Grani, 07 juin 2012 - 05:44 .
                     
                  


            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
NPCs say random things when battled
« Reply #2 on: June 07, 2012, 07:15:34 pm »


               Odds are that in your NPCs OnSpawn events, one of the following is enabled

    SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);

or

    SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);

Give them a custom version with both of those options removed or commented out. Should fix your issues.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
NPCs say random things when battled
« Reply #3 on: June 07, 2012, 07:51:50 pm »


               

kalbaern wrote...

Odds are that in your NPCs OnSpawn events, one of the following is enabled

SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);

or

SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);

Give them a custom version with both of those options removed or commented out. Should fix your issues.


Hmm,  What kind of odds are you giving?   

Ahh,  doesn't matter,  Ill put 20 copper on the  OnConversation event.
               
               

               
            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
NPCs say random things when battled
« Reply #4 on: June 07, 2012, 09:55:57 pm »


               I checked it, but it looks like something else is the reason.

The scripts of my villager NPC are as follows:
x2_def_onblocked
x2_def_endcombat
x2_def_onconv
x2_def_ondamage
nw_c2_default7
x2_def_ondisturb
x2_def_heartbeat
x2_def_percept
x2_def_attacked
x2_def_rested
x2_def_spawn
x2_def_spellcast
x2_def_userdef

As you can see, I didn't modify any scripts, these are all the default ones - except for death script, because I wanted to adjust PC's alignment by killing townsfolk. But this one was not modified either.

Thanks for help. '<img'>
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
NPCs say random things when battled
« Reply #5 on: June 07, 2012, 10:59:55 pm »


               "x2_def_spawn" just calls "nw_c2_default9". The X2 scripts were added so you could customize stuff, then still fire the default scripts after (or not) depending on your changes in the X2 scripts. The X2 scripts also enable the horse scripts for NPCs.

So first check your "nw_c2_default9". That's what is actually called in your current OnSpawn Event. Normally, unless it's been customized, your OnConversation Event will not fire the convos if it was not first enabled in the OnSpawn Event.
               
               

               
            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
NPCs say random things when battled
« Reply #6 on: June 07, 2012, 11:23:14 pm »


               I see, I never really checked those scripts myself.
But there's nothing suspicious about nw_c2_default9, both "SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);"
and
"SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);"
are commented in.
               
               

               


                     Modifié par Grani, 07 juin 2012 - 10:27 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
NPCs say random things when battled
« Reply #7 on: June 07, 2012, 11:25:50 pm »


               In the onConversation script. NW_C2_DEFAULT4 that is being ran by x2_def_convo.

Make sure that you still have the filter for when the listening pattern is -1. in the original script it looks like this.

int nMatch = GetListenPatternNumber();
object oShouter = GetLastSpeaker();

if (nMatch == -1)

Without that filter in the script every time someone shouts, because they where attacked, or utters a word for any reason  the NpC is treating the Chat/Shout  the same way they would handle the PC clicking on them.
               
               

               


                     Modifié par Lightfoot8, 07 juin 2012 - 10:27 .
                     
                  


            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
NPCs say random things when battled
« Reply #8 on: June 07, 2012, 11:30:56 pm »


               Oh? Nw_c2_default4 script looks totally different for me, somehow. Hmm, maybe I accidentally replaced it with something else sometime ago. I will check it in like twenty minutes and write the outcome.

But that will probably be it, so thanks. '<img'> Will edit.

Edit: I took the script of the same name from OC but it didn't seem to work. I will check the rest of the villager's scripts, maybe more are messed up, but will do it tomorrow, since it's really late for me now.
If you have any other ideas, I will be grateful to hear them! Thanks for help given already!
               
               

               


                     Modifié par Grani, 07 juin 2012 - 10:57 .
                     
                  


            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
NPCs say random things when battled
« Reply #9 on: June 08, 2012, 09:47:51 pm »


               Ehh... When I try to replace the content of the scripts with the original ones, taken from fresh module, I get compilation errors. o_o
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
NPCs say random things when battled
« Reply #10 on: June 08, 2012, 11:02:12 pm »


               It sounds like someone changed the includes that it uses.  

But you do not have to recompile the script to revert it back to the standard boiware script, All you have to do is delete the custom script.   It is basicly overriding the script that is in the .bif's. once it is deleted the original script will take back over.

You may want to make a back of the module/script before you do that though. Just incase there is something else that they did that you decide that you want later.
               
               

               
            

Legacy_Grani

  • Hero Member
  • *****
  • Posts: 1040
  • Karma: +0/-0
NPCs say random things when battled
« Reply #11 on: June 08, 2012, 11:31:21 pm »


               Ahh, looks like everything is back to normal now. '<img'> Thanks a lot! Thank goodness there is still such a good community for such an old game.