Aller au contenu

Photo

Event for Using Weapon in Fight


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

#1
Stormsong_NWN

Stormsong_NWN
  • Members
  • 11 messages

I am looking for a method for responding to an event when an item is used in a fight. So a start fight/end fight type event. I'm just coming back to building after a long time away and remember the frustration that I had when I couldn't latch on to this type of event. Has anyone had this figured out?



#2
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

OnHeartbeat - check to see if the character is in combat then do the other checks. However, using heartbeats can be processor intensive depending upon what you are trying to do.

 

OnCombatRoundEnd - checks if a combat round just ended.

 

OnAttacked - checks if a character was just attacked.

 

If you look at the BIC files for the pre-generated PCs, you'll see they all have a built in "default" script - no actual script in the game, but if you create one it will be recognized and accessed - which is used to handle ALL PC event calls if it exists.



#3
Stormsong_NWN

Stormsong_NWN
  • Members
  • 11 messages

Thank you! This should give me a place to move forward from.



#4
Stormsong_NWN

Stormsong_NWN
  • Members
  • 11 messages

So let me be sure I understand. Since the event is not in the module properties, I need to add it to the character, or if I create a script with that name does NWN pick it up when running?



#5
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

The "default" script will only work with PCs and is used for ALL events. you cannot use it for NPCs or monsters. Instead you would need to make custom event scripts to handle what you need to do.

 

Yes, NWN will "pick up" a script named "default" when running.



#6
Shadooow

Shadooow
  • Members
  • 4 465 messages

The "default" script will only work with PCs and is used for ALL events. you cannot use it for NPCs or monsters. Instead you would need to make custom event scripts to handle what you need to do.

 

Yes, NWN will "pick up" a script named "default" when running.

I dont think it runs for anything else than OnHeartbeat. And hearbeat type of even can be easily coded via recursive function.

 

Since I discovered that newly created traps via scripting runs "default" script too every 6seconds I abadoned this solution as Im creating random traps all the time.



#7
Pstemarie

Pstemarie
  • Members
  • 2 745 messages

I dont think it runs for anything else than OnHeartbeat. And hearbeat type of even can be easily coded via recursive function.

 

Since I discovered that newly created traps via scripting runs "default" script too every 6seconds I abadoned this solution as Im creating random traps all the time.

 

Yeah I don't know a lot about it. I know OMB used it for his PC as Henchmen system - can't remember what that was called...