Author Topic: Successful player attack  (Read 306 times)

Legacy_Calvix

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Successful player attack
« on: March 12, 2011, 10:58:01 am »


               Hi, 
is there any way how i can be sure that player did succesful attack to target ?
There are some function with damage, but i just need info if player hits or miss.
Cant found  anything in default functions.

(sry for my eng.)
Any suggest ?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Successful player attack
« Reply #1 on: March 12, 2011, 11:19:37 am »


               OnPhysicalAttacked gets run when another object attacked oTarget, however you cant determine hit/miss here yet. OnDamaged runs if another object hits oTarget either in melee or ranged (not spells). And OnSpellCastAt runs if oTarget was hit by spell.

Note though, that these events are NPC only, you can't script this player-to-play unfortunately.
               
               

               
            

Legacy_Calvix

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Successful player attack
« Reply #2 on: March 12, 2011, 11:23:29 am »


               

ShaDoOoW wrote...
OnDamaged runs if another object hits oTarget either in melee or ranged (not spells).
.

I tried this, but theres problem when target has damage reduction . If all damage is reduced that event dont run.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Successful player attack
« Reply #3 on: March 12, 2011, 11:55:09 am »


               Ok, right. There is a workaround for this.

Give your creature armor and put On Hit Cast Spell: Unique Power (OnHit) on it. Then edit x2_s3_onhitcast script or if you use tagbased scripting then just change tag of the armor and make a script of tag name.

This will make a OnPreDamaged event where the damage is not yet done.

EDIT: this works for PCs as well.
               
               

               


                     Modifié par ShaDoOoW, 12 mars 2011 - 11:57 .