Author Topic: Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen  (Read 861 times)

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0


               

Edit: correction, I mainly seem to be able to trigger the OnPhysicalAttacked and OnDamaged scripts.  I'm not getting any messages about heartbeat, combat round end, perception, etc.


 


Pretty much what the title says, trying to help someone else with some scripting but finding something weird.


 


Here's an image of the NPC in the toolset with the scripts:


 


SMWDeathScript_zpsd1933cb4.jpg


 


Here's the top of the OnDeath script:


 


SMWDeathScript2_zpsb2b281fa.jpg


 


At the top of EACH of those scripts is a similar line sending a message to the PC...and only the OnPhysicalAttacked and OnDamaged are firing.  No enemy spellcasters so I'm not surprised OnSpellCastAt isn't firing...but how about Perception?  CombatRoundEnd?  Heartbeat?  Those three should at least be firing but they are not.


 


Any ideas?



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #1 on: August 03, 2014, 08:42:26 pm »


               

Anyone able to shed some light on this?  Should be super simple to simply have the creature heartbeat/perception/etc broadcast a message saying "Hey, this is the heartbeat/perception/etc script!"



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #2 on: August 03, 2014, 08:54:59 pm »


               

Its creature like any else and creatures do fire all these events. Can you post the module? I will take a look.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #3 on: August 03, 2014, 08:59:35 pm »


               

Shoot me an email at balkothwarcraft at gmail dot com and I'll email it to you.  It's someone else's module and in beta so I don't want to link it publicly.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #4 on: August 03, 2014, 10:45:23 pm »


               

The creature wouldn't be under a status effect (e.g. paralysis) would it?



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #5 on: August 03, 2014, 10:59:27 pm »


               

No, no status effects at all to my knowledge.


 


Can shoot me an email at the above and I can send you the mod, can verify the issue yourself within 5 minutes.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #6 on: August 04, 2014, 02:33:58 am »


               

you get no messages because those scripts failed to compile - this module has old or modified libraries such as x0_i0_henchman, x0_inc_henai etc. Delete them all (but backup them before just in case there would be some new custom function inside them - that needs to be readded but I would advise to do it in custom include, modifying default includes should be avoided for singleplayer module at least)


 


Then it will compile and you can see the message in game.



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #7 on: August 04, 2014, 03:48:04 am »


               

The author of the module has included quite a few AI modifications so I'm hesitant to start ripping things out if it can be avoided.


 


Maybe I'm missing something fundamental about the toolset -- if I choose "Build Module" I get no compile errors.  If I save and compile those event scripts individually I get no compile errors.  I was under the impression that meant that the scripts compiled?  I get that there may be a problem if we're messing with includes several levels down below other default scripts that are not being compiled, but shouldn't making adjustments to the basic event scripts work?


 


Why do you think they are not compiling?



               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #8 on: August 04, 2014, 04:43:14 am »


               

If I remember correctly,  once an NPC becomes a henchman it runs the script set from statescripts.2da. 


 


EDIT: It my just be simpler to check and see what scripts the Henchman is running.     Save the game and open the saved game with the toolset.   Then you can just inspect the Henchman to see what scripts it is running.   It may be necessary to make a copy of the henchman before saving the game.   Sometimes henchman/companions get saved into the TURD with the PC. 



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #9 on: August 04, 2014, 06:56:00 am »


               


If I remember correctly,  once an NPC becomes a henchman it runs the script set from statescripts.2da. 


 




 


Nope,  once an NPC becomes dominated (by a PC) it runs the PC dominated script set from statescripts.2da. Applying AddHenchman() to a creature that does not have the correct script set, does not simply give the creature the correct script set for controlling it as a henchman.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #10 on: August 04, 2014, 07:02:15 am »


               


No, no status effects at all to my knowledge.


 


Can shoot me an email at the above and I can send you the mod, can verify the issue yourself within 5 minutes.




 


I have sent an email.  Though since my account is through hotmail, it could possibly arrive in your junk folder.


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #11 on: August 04, 2014, 07:08:18 am »


               


The author of the module has included quite a few AI modifications so I'm hesitant to start ripping things out if it can be avoided.


 


Maybe I'm missing something fundamental about the toolset -- if I choose "Build Module" I get no compile errors.  If I save and compile those event scripts individually I get no compile errors.  I was under the impression that meant that the scripts compiled?  I get that there may be a problem if we're messing with includes several levels down below other default scripts that are not being compiled, but shouldn't making adjustments to the basic event scripts work?


 


Why do you think they are not compiling?




because I got an compile error in toolset in x0_inc_henai and the nwnclientlog1 showed all scripts running correctly yet there is no message


 


well the module author used some kind of ancient AI modification that is now outdated and cause several issues - I was also testing this module and my suggestion to the module author was to remove all AI modifications at all and use default scripts - that should make AI better than it is now and it will allow to take effect of CPP AI changes if player plays it with CPP


               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #12 on: August 04, 2014, 08:14:39 am »


               

EDIT: It my just be simpler to check and see what scripts the Henchman is running.     Save the game and open the saved game with the toolset.   Then you can just inspect the Henchman to see what scripts it is running.   It may be necessary to make a copy of the henchman before saving the game.   Sometimes henchman/companions get saved into the TURD with the PC. 



 


Would I be wanting to open the .sav file?  Move a copy to the modules folder or something?


 




I have sent an email.  Though since my account is through hotmail, it could possibly arrive in your junk folder.




 


Got it, replied.


 




because I got an compile error in toolset in x0_inc_henai and the nwnclientlog1 showed all scripts running correctly yet there is no message




 


I'm...not.  Compiling that script specifically with zero issues.


 


Interesting to know that you recommended that in regards to the AI.  Meh.  Out of our hands.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #13 on: August 04, 2014, 09:23:56 am »


               


I'm...not.  Compiling that script specifically with zero issues.


 


Interesting to know that you recommended that in regards to the AI.  Meh.  Out of our hands.




weird, i have CPP installed but that shouldnt be the cause of the error, since when I do remove all ancient libraries from module it works (and also because I make sure vanilla libraries from CPP can be used to compile old scripts without errors). Will see what Whizard says.


 


Imo its better to keep hench AI to default, that way a custom content AI that players often do install such as TonyK will work. Or tweaks from CPP. Alternatively install TonyK right away or rip AI scripts from CPP and import them there. That should fix most of the AI issues itself no need for additional tailoring.


               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen
« Reply #14 on: August 04, 2014, 02:44:50 pm »


               


Would I be wanting to open the .sav file?  Move a copy to the modules folder or something?


 




 


 


If you are using windows,   Just right-click the saved game and select "open with..."    then select the toolset to open it with.    I am not sure about other OS's