Author Topic: Unique power onhit help please  (Read 323 times)

Legacy_strakej01

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Unique power onhit help please
« on: September 29, 2010, 09:21:44 pm »


               Hi everyone,

I was hoping that someone could help me with this onhit script? I would like this unique power onhit to: have a 20% chance of success per hit + if succeeded, apply a VFX of phantasmal killer coming from PC towards the target, and then deal an additional 30 + 1d12 cold damage to the target. If this could some how be timed to deal the damage when the phantasmal killer strikes the target, that would be great, but it's no problem if it can't.

Thanks
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Unique power onhit help please
« Reply #1 on: September 30, 2010, 03:55:54 am »


               Some good news and some bad news.

The good news is that most of what you want can be done via tag based scripting with a script like so:



#include "x2_inc_switches"
void main()
{
    // * This code runs when the item has the OnHitCastSpell: Unique power property
    // * and it hits a target(weapon) or is being hit (armor)
    // * Note that this event fires for non PC creatures as well.
    int iEvent = GetUserDefinedItemEventNumber();
    if (iEvent != X2_ITEM_EVENT_ONHITCAST) return;
    int iPercent = d100();
    if (iPercent <= 20)
    {
        object oTarget = GetSpellTargetObject();
        object oPC = OBJECT_SELF;
        object oItem = GetSpellCastItem();
        int iDamage = 30 + d12();
        effect eEffect = EffectDamage(iDamage, DAMAGE_TYPE_COLD);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);
        //Example visual effect to apply to the target
        //effect eVis = EffectVisualEffect(VFX_FNF_DEMON_HAND);
        //ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    }
}



Just make sure you give this script the same name as the tag of the weapon or ammunition you are using for this.

The bad news is that I beleive there is no vfx for phantasmal killer. I think it is a hard coded visual. So the only thing you might be able to do is cast a fake spell in this script but that would require the player to stop in the middle of fighting and cast the spell, which includeds the hand gestures. Only other option would be to also add the actual On Hit Cast Spell (Phantasmal Killer) to the weapon in addition to the Unique power.

Hope that helps. Good luck.
               
               

               


                     Modifié par GhostOfGod, 30 septembre 2010 - 02:57 .