Author Topic: onhit add ability  (Read 305 times)

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
onhit add ability
« on: April 07, 2014, 01:05:06 am »


               

Is there any way to add an ability increase on a successful on hit? Specifically a temporary strength increase.


               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
onhit add ability
« Reply #1 on: April 07, 2014, 01:49:49 am »


               

on hit cast spell would work if you created a spell that does what you want.



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
onhit add ability
« Reply #2 on: April 07, 2014, 01:55:41 pm »


               

Use OnHit Cast Spell: Unique Power (OnHit) as the weapon's item property. Then you'll need a unique item script whose name matches the tag of the item you created. Below is an example script that casts Bull's Strength on the weapon wielder when the target is hit.


#include "x2_inc_switches"
 
void main()
{
    int nEvent =GetUserDefinedItemEventNumber();
    object oPC, oItem;
 
    if (nEvent ==X2_ITEM_EVENT_ONHITCAST)
    {
        //do bull's strength bonus on the wielder for one hour
        oItem = GetSpellCastItem();
        oPC = GetItemPossessor(oItem);
        
        effect eStr = EffectAbilityIncrease(ABILITY_STRENGTH, 4);
        effect eVis = EffectVisualEffect(VFX_IMP_IMPROVE_ABILITY_SCORE);
        effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
        effect eLink = EffectLinkEffects(eStr, eDur);
 
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, HoursToSeconds(1));
    }
}