Aller au contenu

Photo

Cannot Seem to Trigger OnDeath/OnPerception/OnHeartbeat Script for Henchmen


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

#1
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

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?



#2
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

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!"



#3
Shadooow

Shadooow
  • Members
  • 4 468 messages

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



#4
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

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.



#5
WhiZard

WhiZard
  • Members
  • 1 204 messages

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



#6
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

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.



#7
Shadooow

Shadooow
  • Members
  • 4 468 messages

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.



#8
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

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?



#9
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

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. 



#10
WhiZard

WhiZard
  • Members
  • 1 204 messages

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.



#11
WhiZard

WhiZard
  • Members
  • 1 204 messages

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.



#12
Shadooow

Shadooow
  • Members
  • 4 468 messages

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



#13
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

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.



#14
Shadooow

Shadooow
  • Members
  • 4 468 messages

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.



#15
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

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  



#16
BortSonofBort

BortSonofBort
  • Members
  • 63 messages

Hi All,

 

Bort here—this module’s author.

 

Firstly, I want to thank MM for taking the time to help me sift through these issues. Secondly, I want to thank everyone in the thread for offering their insights and opinions. It’s so appreciated.

 

If someone has the knowledge to be able to pinpoint what scripts I would need to delete from the module, please let me know. I’m happy to make whatever modifications are necessary to see the work MM is putting in come to fruition, I would just need help identifying the problem scripts for replacement/deletion.

 

This update/refresh to the module is 11 years in the making, so you can imagine I’m very excited to see it uploaded in top form.

 

Thank you!



#17
WhiZard

WhiZard
  • Members
  • 1 204 messages

I have the module and looked at it with NWN Explorer.  The module created compiled scripts (.ncs) and the Toolset viewable scripts of the module (.nss) do not have a 1:1 ratio. 

 

The compiled only have the following for the creature events

x0_ch_hen_attack
x0_ch_hen_block
x0_ch_hen_damage
x0_ch_hen_distrb
x0_ch_hen_rest
 

They are thus missing these events and the script you are viewing in the Toolset for these events is not what has been compiled.

Combat round end
Conversation
Death
Heartbeat
Perception
Spawn
Spell
User Defined

 

I then opened the module and tried to compile the combat round, and immediately got a compiling error in x0_inc_henai for an undefined function ClearActions().  I noticed that the module had updated x0_inc_henai, so I went to NWNExplorer and found that this update had never compiled.  Same thing for x0_i0_henchman, and finally got to the problem in your updated nw_i0_generic (which did compile).  The updated nw_i0_generic is missing the proper includes.  The usual path to ClearActions() is from nw_i0_generic is x0_i0_anims -> x0_i0_walkway -> x0_i0_spawncond -> x0_i0_combat -> x0_i0_talent -> x0_inc_generic -> x0_i0_equip -> x0_i0_assoc.  The reason why you could update nw_i0_generic and get it to compile is that the script was changed to never call ClearActions() even though scripts that include it will call ClearActions().  To get this script working properly you will need to include x0_i0_behavior and x0_i0_anims, and recompile x0_i0_henchman, x0_inc_henai, and then finally your event scripts.



#18
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

Thanks, Whizard.

 

Why am I apparently able to compile the CombatRoundEnd script, though?  Open the script, press "Save and Compile," and it compiles with no issues.

 

Nor did using Build Module detect any issue.



#19
WhiZard

WhiZard
  • Members
  • 1 204 messages

Thanks, Whizard.

 

Why am I apparently able to compile the CombatRoundEnd script, though?  Open the script, press "Save and Compile," and it compiles with no issues.

 

Nor did using Build Module detect any issue.

 

Does your override folder contain nw_i0_generic, x0_i0_henchman, or x0_inc_henai?



#20
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

No, only some head files and soundset.2da.



#21
WhiZard

WhiZard
  • Members
  • 1 204 messages

Check with NWN Explorer to see if the script actually compiled.  There should be an .ncs file with the script name.  If one does not exist, then the issue you are having is with the Toolset compiler not reporting errors.



#22
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

Huh.  That is weird.  So I just randomly added a letter 's' in the CombatRoundEnd script and it compiled just fine...which it should now.

 

Then I opened a module of my own, randomly picked a script, randomly added an 's'...and it threw an error.

 

Why would it detect the problem in my module but not in Bort's?



#23
WhiZard

WhiZard
  • Members
  • 1 204 messages

As I stated above, check to see if the compiling actually happened (by NWN Explorer), or whether the Toolset is giving you a false message.



#24
MagicalMaster

MagicalMaster
  • Members
  • 2 000 messages

Sorry, yeah, it's giving me a false "things are okay" message in Bort's module (but the script doesn't actually compile).  But it's completely fine in my module.  Why would that be?



#25
WhiZard

WhiZard
  • Members
  • 1 204 messages

When I tried compiling x0_i0_henchman it timed out without producing an error; so a resource count may be the issue.  I have counted (roughly) 2567 scripts of which only 2520 actually compiled.  Most of the scripts have trivial differences and thus could whittled down with the use of local variables as trackers.  Just the time delay of the response to expanding the script category to view the number of scripts takes a while for my computer to process.