Author Topic: Any way to launch an immediate script when PC is damaged?  (Read 354 times)

Legacy_Fallyn Rayne

  • Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
Any way to launch an immediate script when PC is damaged?
« on: April 22, 2011, 10:56:25 pm »


               Hi,

My module has an arena where the PC fights gladiators. I have it scripted when the PC or the opponent is at less than 20 hitpoints, they will fall down or sleep so that they don't die. At that point the arena boss announces the winner (the one left standing).

To do this, I have put a knockdown effect on the NPC's onDamaged script when the NPC reaches less than 20 hp and do a startconversation script for the arena boss to announce the PC as the winner.

In the NPC onCombatRoundEnd script I make the PC go to sleep when PC reaches less than 20 and announcing the opponent as the winner.

This works for the most part. The problem is if they both put each other below 20 before the combat round ends. For instance, the NPC puts the PC below 20 and then the PC puts the NPC below 20 before the combat round ends. This causes the boss to say that the NPC is the winner and then say the PC is the winner. It also messes up my follow up scripts.

It would be a lot easier to accomplish what I'm trying to do if the PC had an onDamaged script that I could assign the script to instead of waiting on a combat round to end or heartbeat. Does anyone know if there is a way to trigger a script the instant a PC is damaged?

Thanks!
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Any way to launch an immediate script when PC is damaged?
« Reply #1 on: April 22, 2011, 11:03:15 pm »


               Yes, in brief: on hit cast spell on armor. If PC has no armor you must create a new that looks like no armor...
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Any way to launch an immediate script when PC is damaged?
« Reply #2 on: April 23, 2011, 01:22:52 pm »


               All PC events are run in a script called "default" (noexistant, but look at the default character bics) - check out OHS by OldMansBeard for more information about how player events are implemented through this script.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Any way to launch an immediate script when PC is damaged?
« Reply #3 on: April 23, 2011, 06:19:29 pm »


               

ShaDoOoW wrote...

Yes, in brief: on hit cast spell on armor. If PC has no armor you must create a new that looks like no armor...


Couldn't this go on the PC Properties Skin? (X3_SKIN_)