Author Topic: Help with onhit script  (Read 317 times)

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
Help with onhit script
« on: September 20, 2014, 07:41:58 pm »


               

I was hoping to get some help with an on hit script.  Basically what I’m trying to add to this script is when an NPC is hit it sends a message to the PC that’s says so-so has been diseased.

Any help with this would be appreciated.



#include "x2_inc_switches"
void main(){ int nEvent =GetUserDefinedItemEventNumber();
if (nEvent ==X2_ITEM_EVENT_ONHITCAST) { object oTarget = GetSpellTargetObject();


effect eEffect;
eEffect = EffectSlow();

eEffect = SupernaturalEffect(eEffect);

ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget);

effect aEffect;
aEffect = EffectAttackDecrease(2);

eEffect = SupernaturalEffect(aEffect);

ApplyEffectToObject(DURATION_TYPE_PERMANENT, aEffect, oTarget);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(259), oTarget, 60.0f);

}}


               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Help with onhit script
« Reply #1 on: September 20, 2014, 08:01:26 pm »


               

SendMessageToPC(OBJECT_SELF, GetName(oTarget)+" has been diseased");



               
               

               
            

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
Help with onhit script
« Reply #2 on: September 20, 2014, 08:44:05 pm »


               

Thank you it works great.